:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-subtle: #30363d;
    --border-muted: #21262d;
    --accent-emphasis: #1f6feb;
    --accent-muted: rgba(31, 111, 235, 0.15);
    --success-emphasis: #238636;
    --attention-emphasis: #9e6a03;
    --severe-emphasis: #da3633;
    --canvas-default: #0d1117;
    --canvas-overlay: #161b22;
    --canvas-inset: #010409;
    --canvas-subtle: #161b22;
    --btn-primary-bg: #238636;
    --btn-primary-hover-bg: #2ea043;
    --google-blue: #4285f4;
    --google-red: #ea4335;
    --google-yellow: #fbbc05;
    --google-green: #34a853;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background-color: var(--canvas-default);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative; /* For absolute positioning of settings menu */
}

/* Sidebar (now the expanding menu) */
.sidebar {
    width: 72px; /* Collapsed width */
    background-color: var(--canvas-subtle);
    display: flex;
    flex-direction: column;
    align-items: center; /* Center items when collapsed */
    padding: 20px 0;
    border-right: 1px solid var(--border-subtle);
    flex-shrink: 0;
    justify-content: space-between; /* Pushes top/bottom sections apart */
    transition: width 0.3s ease-in-out; /* Animation for width */
    overflow: hidden; /* Hide overflowing text */
    position: relative; /* For overlay z-index context */
    z-index: 1001; /* Above overlay */
}

.sidebar.open {
    width: 280px; /* Expanded width */
    align-items: stretch; /* Stretch items to full width when open */
    padding: 16px 0; /* Adjust padding for expanded view */
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center; /* For collapsed state */
    padding: 0 12px; /* Padding for header content */
    width: 100%; /* Take full width of sidebar */
}

.sidebar.open .sidebar-header {
    align-items: flex-start; /* Align left when open */
    padding: 0 16px; /* Adjust padding for expanded view */
}

.sidebar-menu-sections {
    flex-grow: 1; /* Push footer to bottom */
    display: flex;
    flex-direction: column;
    gap: 8px; /* Gap between menu sections */
    padding: 8px 0; /* Vertical padding for menu sections */
    width: 100%; /* Take full width of sidebar */
    overflow-y: auto; /* Allow scrolling for recent chats */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.sidebar-menu-sections::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center; /* For collapsed state */
    padding: 0 12px; /* Padding for footer content */
    width: 100%; /* Take full width of sidebar */
}

.sidebar.open .sidebar-footer {
    align-items: flex-start; /* Align left when open */
    padding: 0 16px; /* Adjust padding for expanded view */
}

/* Common button styles for expandable menu items */
.new-chat-button,
.menu-item,
.settings-help-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px; /* Default padding for expanded */
    margin: 2px 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease, width 0.3s ease-in-out, padding 0.3s ease-in-out;
    width: 100%; /* Default for expanded, will be overridden for collapsed */
    text-align: left;
    font-size: 14px;
    white-space: nowrap; /* Prevent text wrapping */
}

/* Collapsed state for expandable menu items */
.sidebar:not(.open) .new-chat-button,
.sidebar:not(.open) .menu-item,
.sidebar:not(.open) .settings-help-btn {
    width: 48px; /* Icon-only width for collapsed state */
    height: 48px; /* Icon-only height */
    padding: 0; /* No padding for icon-only */
    justify-content: center; /* Center the icon */
    border-radius: 12px; /* Make it look like an icon-button */
}

.sidebar:not(.open) .new-chat-button {
    background-color: var(--bg-tertiary); /* Highlight new chat button even when collapsed */
    color: var(--text-primary);
}

.new-chat-button:hover,
.menu-item:hover,
.settings-help-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.new-chat-button .material-symbols-outlined,
.menu-item .material-symbols-outlined,
.settings-help-btn .material-symbols-outlined {
    font-size: 20px; /* Standard icon size for menu items */
}

.icon-button { /* General icon button style (e.g., for the menu toggle) */
    width: 48px;
    height: 48px;
    border: none;
    background: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.icon-button:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.icon-button .material-symbols-outlined {
    font-size: 24px;
}

/* Specific styling for expandable text */
.button-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    margin-left: 0;
    transition: opacity 0.2s ease-in-out, width 0.2s ease-in-out, margin-left 0.2s ease-in-out;
}

.sidebar.open .button-text {
    opacity: 1;
    width: auto; /* Allow text to take natural width */
    margin-left: 12px; /* Gap between icon and text */
    transition-delay: 0.1s; /* Slight delay for text to appear after width expands */
}

/* Specific animations for items */
.explore-gems-btn .button-text {
    transition: opacity 0.3s ease-out 0.15s; /* Fade in with a delay */
}

/* Sliding Menu (now Settings Menu Popup) */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Settings Menu Popup styles */
.settings-menu-popup {
    position: absolute; /* Will be set dynamically by JS based on sidebar width */
    top: 0;
    left: 0; /* Will be overridden by JS */
    width: 260px; /* Fixed width as per screenshot */
    background-color: var(--canvas-overlay); /* Slightly darker than sidebar */
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1002; /* Above sidebar */
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px); /* Start slightly left for pop-out effect */
    transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0.2s ease-out;
}

.settings-menu-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.settings-overlay,
.model-selector-overlay,
.memory-manager-overlay { /* Apply to all overlays */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000; /* Between sidebar and popups */
    visibility: hidden; /* No background, just for click capture */
}

.settings-overlay.active,
.model-selector-overlay.active,
.memory-manager-overlay.active {
    visibility: visible;
}

/* Model Selector Popup styles */
.model-selector-popup {
    position: absolute; /* Positioned by JS */
    width: 200px; /* Adjust width as needed */
    background-color: var(--canvas-overlay);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1002; /* Same as settings menu, ensures it's on top */
    padding: 8px 0;
    display: flex;
    flex-direction: column;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px); /* Slightly up for pop-down effect */
    transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0.2s ease-out;
}

.model-selector-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.model-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    gap: 12px;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    border-radius: 8px; /* To match hover effect */
    transition: background-color 0.2s ease, color 0.2s ease;
}

.model-menu-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.model-menu-item .material-symbols-outlined {
    font-size: 20px;
}

.model-menu-name {
    flex-grow: 1;
}

.model-menu-item.selected .check-icon {
    display: block; /* Show when selected */
}

.menu-section {
    padding: 8px 16px; /* Default for expanded state */
    width: 100%; /* Take full width */
}

.sidebar:not(.open) .menu-section {
    padding: 0; /* Collapse padding */
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease-in-out, padding 0.3s ease-in-out;
}

.menu-section-title {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 16px 0 8px 0;
    padding: 0 16px;
    opacity: 0; /* Hidden when collapsed */
    height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease-in-out, height 0.3s ease-in-out, margin 0.3s ease-in-out, padding 0.3s ease-in-out;
}

.sidebar.open .menu-section-title {
    opacity: 1; /* Visible when expanded */
    height: auto;
    margin: 16px 0 8px 0;
    padding: 0 16px;
    transition-delay: 0.1s;
}

.recent-chat-item { /* Same as menu-item, just for specific styling */
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 2px 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
    font-size: 14px;
    opacity: 0; /* Hidden when collapsed */
    height: 0;
    overflow: hidden;
    position: relative; /* Needed for absolute positioning of delete button */
}

.sidebar.open .recent-chat-item {
    opacity: 1; /* Visible when expanded */
    height: auto;
    transition: all 0.2s ease, opacity 0.3s ease-in-out 0.1s;
}

.recent-chat-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.recent-chat-item .delete-button {
    position: absolute;
    right: 8px; /* Position from the right edge */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px; /* Icon size */
    width: 24px; /* clickable area */
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0; /* Prevent the button from shrinking */
}

.recent-chat-item:hover .delete-button {
    opacity: 1; /* Visible on hover */
    background-color: var(--bg-secondary); /* Slight background on hover */
    color: var(--text-primary);
}

.recent-chat-item .delete-button:hover {
    background-color: var(--severe-emphasis); /* Red background on hover of the delete button itself */
    color: var(--text-primary);
}

.recent-chat-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 32px; /* Sufficient space for the button */
}

/* Add a message style for empty recent chats */
.sidebar-menu-sections .empty-recent-chats-message {
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
    font-size: 14px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin-left: 72px; /* Initial margin for collapsed sidebar */
    transition: margin-left 0.3s ease-in-out; /* Animate margin */
}

.sidebar.open ~ .main-content {
    margin-left: 280px; /* Margin when sidebar is open */
}

.main-header {
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.product-name {
    font-size: 22px;
    font-weight: 400;
    color: var(--text-primary);
    font-family: 'Google Sans', sans-serif;
}

.model-selector {
    height: 32px;
    padding: 0 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.model-selector:hover {
    background: var(--bg-secondary);
}

.model-selector .material-symbols-outlined {
    font-size: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.upgrade-button {
    height: 32px;
    padding: 0 12px;
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    color: var(--google-blue);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: 'Google Sans', sans-serif;
}

.upgrade-button:hover {
    background: var(--accent-muted);
}

.upgrade-button .material-symbols-outlined {
    font-size: 16px;
}

.pfp {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-view {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 0 24px;
    overflow-y: hidden; /* Prevent vertical scroll */
}

.welcome-content {
    width: 100%;
    max-width: 768px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px - 120px);
    gap: 48px; /* Increased gap for better spacing */
}

.welcome-message {
    text-align: center;
    margin: 0;
    width: 100%;
}

.welcome-message h1 {
    font-size: 48px;
    font-weight: 400;
    line-height: 1.1; /* Tightened line height */
    display: flex;
    justify-content: center;
    align-items: baseline; /* Better alignment */
    gap: 12px;
    margin: 0; /* Remove any default margin */
}

.hello-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-family: 'Google Sans', sans-serif;
}

.user-name {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-family: 'Google Sans', sans-serif;
}

.user-name:focus {
    background: var(--bg-tertiary);
    padding: 0 8px;
    border-radius: 4px;
}

.results-view {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.chat-messages {
    max-width: 768px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.chat-message {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.prompt-message {
    justify-content: flex-end;
}

.prompt-message .pfp {
    width: 32px;
    height: 32px;
    margin-top: 8px;
}

.prompt-message .message-content {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 12px 16px;
    max-width: 70%;
    display: flex;
    flex-direction: column;
    gap: 10px; /* Space between image and text */
}

.prompt-message .message-text {
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
}

.response-message .message-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    overflow: hidden;
}

.response-message .message-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.response-message .message-content {
    flex: 1;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.6;
}

.response-message .message-content h1,
.response-message .message-content h2,
.response-message .message-content h3 {
    margin: 1.5em 0 0.5em 0;
    font-weight: 500;
}

.response-message .message-content p,
.response-message .message-content ul,
.response-message .message-content ol {
    margin: 0 0 1em 0;
}

.response-message .message-content ul,
.response-message .message-content ol {
    padding-left: 20px;
}

.response-message .message-content li {
    margin-bottom: 8px;
}

.response-message .message-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 14px;
}

.response-message .message-content pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

.response-message .message-content pre code {
    background: none;
    padding: 0;
}

/* New: Toast notification for copy to clipboard */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Upgrade modal styles */
.upgrade-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}
.upgrade-modal.active {
    display: flex;
}
.upgrade-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}
.upgrade-modal-content {
    position: relative;
    background: var(--canvas-overlay);
    border: 1px solid var(--border-subtle);
    padding: 20px;
    border-radius: 12px;
    width: 320px;
    max-width: calc(100% - 40px);
    color: var(--text-primary);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
    z-index: 3001;
}
.upgrade-modal-content h2 {
    margin: 0 0 8px 0;
    font-size: 18px;
}
.upgrade-modal-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}
.upgrade-modal-close {
    position: absolute;
    right: 10px;
    top: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}
.upgrade-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.toast-notification {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 14px;
    border: 1px solid var(--border-subtle);
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* New: Styles for message action buttons */
.message-actions {
    display: flex; /* Make children horizontal */
    gap: 8px; /* Space between buttons */
    margin-top: 10px; /* Add some space above the buttons */
    justify-content: flex-end; /* Align buttons to the right within the message content */
}

.message-actions .icon-button {
    width: 32px; /* Smaller size for action icons */
    height: 32px;
    background: none;
    color: var(--text-secondary);
}

.message-actions .icon-button:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Input Footer */
.input-footer {
    padding: 24px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.input-container {
    max-width: 768px;
    margin: 0 auto;
}

.chat-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-wrapper {
    background: var(--canvas-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 4px 4px 12px 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.2s ease;
}

.input-wrapper:focus-within {
    border-color: var(--google-blue);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

.attachment-button {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.attachment-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    padding: 12px 16px;
    font-family: inherit;
}

.chat-input::placeholder {
    color: var(--text-secondary);
}

.send-button {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.send-button:hover {
    background: var(--bg-secondary);
}

.send-button.has-text {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.send-button.has-text:hover {
    background: var(--bg-secondary);
}

.send-button:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 8px;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-buttons {
    display: flex;
    gap: 8px;
}

.option-button {
    height: 32px;
    padding: 0 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.option-button:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.option-button .material-symbols-outlined {
    font-size: 16px;
}

.option-button.active {
    background: var(--google-blue); /* A prominent color for active state */
    border-color: var(--google-blue);
    color: var(--text-primary); /* Ensure text is readable */
}

.option-button.active:hover {
    background: var(--google-blue); /* Keep background consistent on hover */
    border-color: var(--google-blue);
    color: var(--text-primary);
}

/* Loading animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-spinner {
    width: 32px; /* Same size as message-icon */
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: relative; /* For centering the image */
}

.loading-spinner img {
    width: 24px; /* Smaller Gemini logo */
    height: 24px;
    object-fit: contain;
}

/* Grow animation for response logo */
.gemini-logo-grow {
    transform: scale(0.7); /* Start smaller */
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease-in; /* spring-like effect */
}

.gemini-logo-grow.animate-grow {
    transform: scale(1); /* Grow to normal size */
    opacity: 1;
}

/* Old loading dots (hide them) */
.loading-dots {
    display: none;
}

/* For the text "Generating Image..." */
.response-message .message-content p {
    /* Existing paragraph styles, ensure they look good for loading messages too */
}

/* Added style for generated images within the chat */
.response-message .message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
    display: block; /* Ensures image is on its own line */
}

/* Update the suggestion cards section */
.suggestion-cards {
    display: flex;
    gap: 16px;
    margin: 0;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    padding: 0;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.suggestion-cards::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.suggestion-cards {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.suggestion-card {
    min-width: 180px;
    width: 180px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px 16px; /* Increased top/bottom padding */
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 100px; /* Slightly increased height */
    color: inherit;
    flex-shrink: 0; /* Prevent cards from shrinking */
}

.suggestion-card:hover {
    background-color: var(--bg-secondary);
    border-color: var(--accent-emphasis);
}

.suggestion-card .card-content {
    display: flex;
    flex-direction: column;
    gap: 2px; /* Reduced gap between title and subtitle */
    overflow: hidden; /* Prevent text overflow */
}

.suggestion-card .card-title {
    font-size: 16px; /* Explicit font size */
    font-weight: 500; /* Medium weight */
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2; /* Tight line height */
}

.suggestion-card .card-subtitle {
    font-size: 16px; /* Same size as title */
    font-weight: 400; /* Regular weight */
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2; /* Tight line height */
}

/* New styles for image upload preview */
.image-preview-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    margin-left: 8px; /* Space from attachment button */
    position: relative;
    overflow: hidden;
}

.image-preview-container img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.remove-image-button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.remove-image-button:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.remove-image-button .material-symbols-outlined {
    font-size: 18px;
}

/* Adjust chat input to shrink when image preview is visible */
.input-wrapper #chat-input {
    flex-grow: 1; /* Allow input to fill available space */
    min-width: 50px; /* Prevent it from completely collapsing */
}

/* Additional CSS for uploaded image in prompt message */
.uploaded-prompt-image-wrapper {
    margin-bottom: 10px; /* Space between image and text */
    max-width: 100%;
    text-align: center;
}
.uploaded-prompt-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block; /* Ensure it takes full width */
    margin: 0 auto; /* Center the image if it's smaller than max-width */
}

/* Ensure responsive behavior */
@media (max-width: 768px) {
    .suggestion-cards {
        padding-bottom: 12px;
    }
    
    .suggestion-card {
        min-width: 180px; /* Slightly smaller on mobile */
        width: 180px;
    }
}

/* New: Memory Button */
.memory-button { /* New button in header */
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    margin-left: 8px; /* Spacing from model selector */
}

.memory-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* New: Memory Manager Popup */
.memory-manager-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    visibility: hidden; /* No background, just for click capture */
}

.memory-manager-overlay.active {
    visibility: visible;
}

.memory-manager-popup {
    position: absolute; /* Will be set dynamically by JS */
    width: 300px;
    background-color: var(--canvas-overlay);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0.2s ease-out;
}

.memory-manager-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.memory-manager-popup h2 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.memory-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px; /* Scrollable area for memories */
    overflow-y: auto;
    padding-right: 8px; /* For scrollbar */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.memory-list::-webkit-scrollbar {
    display: none;
}

.memory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-muted);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.memory-item span {
    flex-grow: 1;
    word-break: break-word; /* Allow long values to wrap */
    white-space: normal; /* Override nowrap */
}

.memory-item .delete-memory-button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    margin-left: 8px;
    transition: color 0.2s ease;
    flex-shrink: 0; /* Prevent button from shrinking */
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.memory-item .delete-memory-button:hover {
    color: var(--severe-emphasis);
    background-color: var(--bg-secondary);
    border-radius: 4px;
}

.memory-input-section {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on small screens */
    gap: 8px;
}

.memory-input-section input[type="text"] {
    flex: 1;
    min-width: 100px; /* Ensure inputs are not too small */
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background-color: var(--canvas-subtle);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.memory-input-section input[type="text"]::placeholder {
    color: var(--text-muted);
}

.memory-input-section button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background-color: var(--google-blue);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.memory-input-section button:hover {
    background-color: #357ae8; /* Darker blue on hover */
}

.clear-button {
    width: 100%; /* Full width button */
    padding: 8px 16px;
    border: 1px solid var(--severe-emphasis);
    border-radius: 8px;
    background-color: rgba(218, 54, 51, 0.15); /* Light red background */
    color: var(--severe-emphasis);
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.clear-button:hover {
    background-color: var(--severe-emphasis);
    color: var(--text-primary);
}

/* NEW: Voice Chat View Styles */
.voice-chat-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #202020; /* Dark background as in the image */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1003; /* Above all other content */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.voice-chat-view.active {
    opacity: 1;
    visibility: visible;
}

.voice-chat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px; /* Space between circle, message, and controls */
}

.voice-chat-mic-circle {
    width: 120px; /* Size of the central circle */
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #333333; /* Fallback background */
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.05); /* Subtle outer ring */
    position: relative; /* For pulsing animation */
}

.voice-chat-mic-circle.listening {
    animation: pulse 1.5s infinite ease-out; /* Add pulse animation when listening */
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0px rgba(66, 133, 244, 0.7);
        transform: scale(1);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(66, 133, 244, 0);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0px rgba(66, 133, 244, 0);
        transform: scale(1);
    }
}

.voice-chat-circle-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.voice-chat-message {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.voice-chat-controls {
    display: flex;
    gap: 20px;
}

.voice-chat-mic-button,
.voice-chat-close-button {
    width: 56px; /* Larger buttons for voice controls */
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.2s ease;
}

.voice-chat-mic-button {
    background-color: var(--text-primary); /* White background for mic */
    border: none;
    color: var(--canvas-default); /* Dark icon */
}

.voice-chat-mic-button:hover {
    background-color: #e0e0e0;
}

.voice-chat-mic-button.recording {
    background-color: var(--google-red); /* Red when recording */
    color: var(--text-primary);
}

.voice-chat-mic-button.recording:hover {
    background-color: #cc312e;
}

.voice-chat-close-button {
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
}

.voice-chat-close-button:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

/* Headset button in main chat input */
.voice-chat-toggle-button {
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.voice-chat-toggle-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}