/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Font Awesome Spin Animation (backup if CDN fails) */
.fa-spin {
    animation: fa-spin 1s infinite linear !important;
    display: inline-block !important;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Pure CSS Spinner - More reliable alternative */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark mode (default) */
:root {
    --bg-primary: #212121;
    --bg-secondary: #2f2f2f;
    --bg-tertiary: #424242;
    --bg-hover: #3d3d3d;
    --text-primary: #ececec;
    --text-secondary: #b4b4b4;
    --border-color: #4e4e4e;
    --accent-color: #d4af37;
    --accent-hover: #b8941f;
    --danger-color: #ef4444;
    --message-user-bg: #1e88e5;
    --message-bot-bg: transparent;
    --scrollbar-bg: #2f2f2f;
    --scrollbar-thumb: #555;
}

/* Light mode */
body.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e8e8e8;
    --bg-hover: #eeeeee;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --border-color: #d0d0d0;
    --accent-color: #d4af37;
    --accent-hover: #b8941f;
    --danger-color: #ef4444;
    --message-user-bg: #1e88e5;
    --message-bot-bg: #f9f9f9;
    --scrollbar-bg: #e8e8e8;
    --scrollbar-thumb: #c0c0c0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    /* CSS variable for mobile viewport height */
    height: calc(var(--vh, 1vh) * 100);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    transition: width 0.3s ease, transform 0.3s ease;
    position: relative;
    z-index: 100;
}

.sidebar.minimized {
    width: 70px;
}

.sidebar-logo {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-color);
}

.logo-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--accent-color);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.logo-btn:hover {
    background-color: var(--bg-hover);
}

.logo-btn i {
    font-size: 24px;
}

.logo-btn .logo-img {
    width: 35px;
    height: 35px;
    object-fit: contain;
    border-radius: 4px;
}

.sidebar.minimized .logo-btn span {
    display: none;
}

.sidebar.minimized .logo-btn {
    justify-content: center;
    padding: 8px;
}

.sidebar.minimized .sidebar-header {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
}

.sidebar.minimized .sidebar-toggle-btn {
    margin-left: 0;
    width: 100%;
}

.sidebar.minimized .new-chat-btn {
    justify-content: center;
    padding: 10px;
    width: 100%;
    flex: none;
}

.sidebar.minimized .new-chat-btn span,
.sidebar.minimized .session-title,
.sidebar.minimized .user-info,
.sidebar.minimized .setting-btn span,
.sidebar.minimized .login-text {
    display: none;
}

.sidebar.minimized .session-item {
    justify-content: center;
    padding: 10px;
}

.sidebar.minimized .session-delete-btn {
    display: none !important;
}

.sidebar.minimized .user-profile {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    cursor: default;
}

.sidebar.minimized .user-profile:hover {
    background-color: transparent;
}

.sidebar.minimized .settings-btn {
    margin-left: 0;
}

.sidebar.minimized .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.sidebar.minimized .settings-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.sidebar.minimized .login-button:not([style*="display: none"]) {
    padding: 10px !important;
    justify-content: center;
    display: flex !important;
    align-items: center;
}

.sidebar.minimized .login-button i {
    margin-right: 0 !important;
}

.sidebar-header {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.new-chat-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.new-chat-btn:hover {
    background-color: var(--bg-hover);
}

.search-chat-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    margin-left: 4px;
}

.search-chat-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* Search Modal - Centered on Desktop, Full-screen on Mobile */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.search-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.search-modal-container {
    background: var(--bg-primary);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-modal-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    transition: all 0.2s;
}

.search-modal-input-wrapper:focus-within {
    border-color: var(--accent-color);
    background: var(--bg-primary);
}

.search-modal-input-wrapper i.fa-search {
    color: var(--text-secondary);
    font-size: 16px;
    margin-right: 12px;
}

.search-modal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
}

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

.search-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.search-modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.search-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.search-result-item {
    padding: 16px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.search-result-item:hover {
    background: var(--bg-tertiary);
    border-left-color: var(--accent-color);
    transform: translateX(4px);
}

.search-result-item.active {
    background: var(--bg-tertiary);
    border-left-color: var(--accent-color);
}

.search-result-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-result-title i {
    color: var(--text-secondary);
    font-size: 14px;
}

.search-result-preview {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-result-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
}

.search-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.search-no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.search-no-results p {
    font-size: 16px;
    margin: 0;
}

.sidebar-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
    margin-left: 4px;
}

.sidebar-toggle-btn i {
    transition: transform 0.3s ease;
}

.sidebar-toggle-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar.minimized .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.mobile-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 14px;
}

.session-item:hover {
    background-color: var(--bg-hover);
}

.session-item.active {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.session-icon {
    font-size: 16px;
    opacity: 0.8;
    position: relative;
}

/* Pulsating thinking dot for sessions with pending requests */
.session-thinking-dot {
    position: absolute;
    top: -3px;
    right: -5px;
    width: 10px;
    height: 10px;
    background-color: #2563eb;
    border-radius: 50%;
    animation: thinking-pulse 1.2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(37, 99, 235, 0.9), 0 0 12px rgba(37, 99, 235, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes thinking-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 6px rgba(37, 99, 235, 0.9), 0 0 12px rgba(37, 99, 235, 0.5);
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
        box-shadow: 0 0 10px rgba(37, 99, 235, 1), 0 0 20px rgba(37, 99, 235, 0.7);
    }
}

/* Green checkmark for completed responses */
.session-completed-dot {
    position: absolute;
    top: -4px;
    right: -6px;
    width: 14px;
    height: 14px;
    background-color: #22c55e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.4);
    animation: completed-pop 0.3s ease-out;
}

.session-completed-dot i {
    font-size: 8px;
    color: white;
}

@keyframes completed-pop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.session-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0; /* Important for flex text truncation */
}

.session-title.editing {
    white-space: normal;
    overflow: visible;
}

.session-title input {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-color);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.session-edit-btn,
.session-delete-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 13px;
    opacity: 0.7;
    flex-shrink: 0;
}

.session-item:hover .session-edit-btn,
.session-item:hover .session-delete-btn {
    display: block;
}

.session-edit-btn:hover {
    background-color: var(--accent-color);
    color: white;
    opacity: 1;
}

.session-delete-btn:hover {
    background-color: var(--danger-color);
    color: white;
    opacity: 1;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: var(--bg-hover);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

/* Sidebar Footer Actions Row */
.sidebar-footer-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: space-between;
}

/* Stack vertically when sidebar is minimized */
.sidebar.minimized .sidebar-footer-actions {
    flex-direction: column;
}

.sidebar-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
    position: relative;
}

.sidebar-action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
}

.sidebar-action-btn i {
    font-size: 16px;
}

.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 36px;
    min-width: 0; /* Important for flex text truncation */
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.settings-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    display: none; /* Hidden by default, shown after authentication */
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.settings-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    overflow: hidden;
}

.mobile-header {
    display: none;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.menu-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

.mobile-title {
    flex: 0 1 auto;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.back-to-members-btn {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: #d4af37 !important;
    color: white !important;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: 0.2s;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    min-width: max-content;
}

.back-to-members-btn span {
    display: inline !important;
    color: white !important;
    margin-left: 0;
    visibility: visible !important;
}

.back-to-members-btn:hover {
    background: var(--accent-hover) !important;
    transform: translateY(-1px);
}

.back-to-members-btn i {
    font-size: 14px;
}

.reset-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.reset-btn:hover {
    color: var(--text-primary);
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    position: relative;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Scroll to Bottom Button */
.scroll-to-bottom-btn {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 12px 20px;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-to-bottom-btn.show {
    display: flex;
    animation: slideUp 0.3s ease;
}

.scroll-to-bottom-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.scroll-to-bottom-btn:active {
    transform: translateY(0);
}

.scroll-to-bottom-btn i {
    font-size: 16px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-messages {
    max-width: 1100px;
    margin: 0 auto;
    padding: 80px 16px 24px 16px;
    min-height: 100%;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px 20px;
}

.welcome-icon {
    width: auto;
    height: auto;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

/* Interactive Robot Face */
.robot-face {
    position: relative;
    display: inline-block;
}

/* Robot Icon Image */
.robot-icon {
    width: 120px;
    height: auto;
    display: block;
}

/* Chat bubble - default dark mode with gold text */
.chat-bubble {
    position: absolute;
    top: -35px;
    left: calc(100% + -35px);
    background: var(--bg-secondary);
    color: var(--accent-color);
    padding: 10px 16px;
    border-radius: 18px;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    animation: bubbleBounce 2.5s ease-in-out infinite;
    white-space: nowrap;
    min-width: 90px;
    text-align: left;
    opacity: 0; /* Hidden initially - will fade in after greeting is ready */
}

/* Chat bubble arrow - pointing down-left towards robot head (polished style) */
.chat-bubble::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 20px solid var(--bg-secondary);
    border-right: 10px solid transparent;
    border-top: 10px solid var(--bg-secondary);
    border-bottom: 16px solid transparent;
    left: 20px;
    bottom: -20px;
}

@keyframes bubbleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Light mode - dark bubble with white text */
body.light-mode .chat-bubble {
    background: #3a3a3a !important;
    color: white !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

body.light-mode .chat-bubble::after {
    border-left-color: #3a3a3a !important;
    border-top-color: #3a3a3a !important;
}

.welcome-screen h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.welcome-screen p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Refresh Suggestions Button */
.refresh-suggestions-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    font-size: 16px;
    transition: all 0.2s ease;
    border-radius: 6px;
}

.refresh-suggestions-btn:hover {
    background: var(--bg-secondary);
    color: var(--accent-color);
}

.refresh-suggestions-btn:active {
    opacity: 0.7;
}

.refresh-suggestions-btn i {
    display: inline-block;
    transition: transform 0.5s ease;
}

.suggestion-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 600px;
    margin-top: 0;
}

.suggestion-card {
    position: relative;
    padding: 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    overflow: hidden;
    opacity: 0; /* Hidden initially */
}

.suggestion-card.loading,
.suggestion-card.ready {
    opacity: 1; /* Show when loading skeleton or content is ready */
}

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

.suggestion-card i {
    font-size: 20px;
    color: var(--accent-color);
}

.suggestion-card span {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Suggestion cards loading state */
.suggestion-card.loading {
    pointer-events: none;
}

.suggestion-card.loading i,
.suggestion-card.loading span {
    opacity: 0;
}

.suggestion-card.loading::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    height: 20px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-loading 1.5s infinite;
}

.suggestion-card.loading::after {
    content: '';
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 40px;
    height: 14px;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeleton-loading 1.5s infinite;
    animation-delay: 0.2s;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Suggestion cards fade-in */
.suggestion-cards.loaded .suggestion-card {
    animation: fadeInSuggestion 0.4s ease-out forwards;
}

.suggestion-cards.loaded .suggestion-card:nth-child(1) {
    animation-delay: 0.05s;
}

.suggestion-cards.loaded .suggestion-card:nth-child(2) {
    animation-delay: 0.1s;
}

.suggestion-cards.loaded .suggestion-card:nth-child(3) {
    animation-delay: 0.15s;
}

.suggestion-cards.loaded .suggestion-card:nth-child(4) {
    animation-delay: 0.2s;
}

@keyframes fadeInSuggestion {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Recent Chats Section */
.recent-chats-section {
    width: 100%;
    max-width: 600px;
    margin-top: 48px;
}

.recent-chats-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-align: left;
}

.recent-chats-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recent-chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.recent-chat-item:hover {
    background-color: var(--bg-hover);
    border-color: var(--accent-color);
}

.recent-chat-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.recent-chat-info {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.recent-chat-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-chat-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-chat-time {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    animation: fadeIn 0.3s ease-in;
    margin-bottom: 8px;
    background: transparent;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user-message {
    position: relative;
    flex-direction: row-reverse;
    margin-left: auto;
    max-width: 85%;
}

.message.bot-message {
    position: relative;
    max-width: 100%;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    position: relative;
    z-index: 1;
    background: transparent;
}

.user-message .message-avatar {
    background: #1565c0;
    color: white;
    overflow: visible;
    padding: 0;
}


.user-message .message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.bot-message .message-avatar {
    background: var(--accent-color);
    color: white;
    overflow: visible;
    padding: 0;
}


.bot-message .message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message-content {
    flex: 1;
    line-height: 1.6;
    color: var(--text-primary);
    position: relative;
    padding: 16px;
    border-radius: 12px;
}

.bot-message .message-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding-bottom: 28px; /* Extra padding for process time at bottom-right */
}

.user-message .message-content {
    background-color: var(--message-user-bg);
    border: 1px solid #1565c0;
    color: #ffffff !important; /* Always white text on blue background */
}

/* Speech bubble tail for bot messages */
.bot-message .message-content::after,
.bot-message .message-content::before {
    border: solid transparent;
    content: " ";
    height: 0;
    pointer-events: none;
    position: absolute;
    width: 0;
    right: 100%;
    top: 20px;
}

.bot-message .message-content::after {
    border-right-color: var(--bg-secondary);
    border-width: 10px;
    margin-top: -10px;
}

.bot-message .message-content::before {
    border-right-color: var(--border-color);
    border-width: 11px;
    margin-top: -11px;
}

/* Speech bubble tail for user messages */
.user-message .message-content::after,
.user-message .message-content::before {
    border: solid transparent;
    content: " ";
    height: 0;
    pointer-events: none;
    position: absolute;
    width: 0;
    left: 100%;
    top: 20px;
}

.user-message .message-content::after {
    border-left-color: var(--message-user-bg);
    border-width: 10px;
    margin-top: -10px;
}

.user-message .message-content::before {
    border-left-color: #1565c0;
    border-width: 11px;
    margin-top: -11px;
}

.message-text {
    font-size: 15px;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
    white-space: normal;
    margin: 0;
    max-width: 100%;
}

/* Speechify highlighting */
.message-text[data-speechify-enabled="true"] {
    cursor: text;
    user-select: text;
}

.message-text mark,
.message-text .speechify-highlight {
    background-color: rgba(212, 175, 55, 0.3);
    color: inherit;
    padding: 0;
    border-radius: 2px;
}

.message-text p {
    margin-bottom: 10px;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 12px 0 6px 0;
    color: var(--accent-color);
    line-height: 1.4;
}

.message-text h3:first-child {
    margin-top: 0;
}

.message-text strong {
    font-weight: 600;
    color: var(--accent-hover);
    /* font-size is now dynamically set by applyFontSize() */
}

/* Strong elements inside headings should inherit heading size */
.message-text h2 strong,
.message-text h3 strong,
.message-text h4 strong {
    font-size: inherit !important;
}

.message-text a {
    color: var(--accent-color);
    text-decoration: underline;
}

.message-text a:hover {
    color: var(--accent-hover);
}

/* Markdown Formatting Styles */

/* Table wrapper for horizontal scrolling on mobile */
.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.message-text th {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

.message-text td {
    border: 1px solid var(--border-color);
    padding: 12px;
    color: var(--text-primary);
}

.message-text tr:nth-child(even) {
    background-color: var(--bg-hover);
}

.message-text h2 {
    /* font-size is now dynamically set by applyFontSize() at 1.5x base */
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.3em;
    color: var(--text-primary);
    font-weight: 600;
}

.message-text h3 {
    /* font-size is now dynamically set by applyFontSize() at 1.25x base */
    margin-top: 1.2em;
    margin-bottom: 0.5em;
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: underline;
}

.message-text h4 {
    /* font-size is now dynamically set by applyFontSize() at 1.1x base */
    margin-top: 1em;
    margin-bottom: 0.5em;
    color: var(--text-primary);
    font-weight: 600;
}

.message-text blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1em;
    background-color: var(--bg-secondary);
    padding: 1em;
    margin: 1em 0;
    border-radius: 4px;
    color: var(--text-secondary);
}

.message-text code {
    background-color: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    color: var(--accent-color);
    font-size: 0.9em;
}

.message-text pre {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
    margin: 12px 0;
}

.message-text pre code {
    background-color: transparent;
    padding: 0;
    color: var(--text-primary);
    font-size: 0.9em;
}

.message-text ul,
.message-text ol {
    margin: 12px 0;
    padding-left: 24px;
}

.message-text li {
    margin: 6px 0;
    line-height: 1.6;
}

.message-text hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.message-sources {
    margin-top: 16px;
    padding: 12px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--accent-color);
}

.sources-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
}

.source-item i {
    color: var(--accent-color);
    font-size: 12px;
}

.source-link {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.source-link:hover {
    color: var(--accent-color);
}

.source-date {
    color: var(--text-secondary);
    font-size: 13px;
    margin-left: auto;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px;
}

.typing-dot {
    width: 10px;
    height: 10px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Typing Indicator Variation 2: Pulse Circle */
.typing-pulse {
    width: 16px;
    height: 16px;
    background-color: var(--accent-color);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Typing Indicator Variation 3: Four Dots Wave */
.typing-dot-wave {
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    animation: wave 1.2s infinite ease-in-out;
}

.typing-dot-wave:nth-child(2) {
    animation-delay: 0.1s;
}

.typing-dot-wave:nth-child(3) {
    animation-delay: 0.2s;
}

.typing-dot-wave:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes wave {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-12px);
    }
}

/* Typing Indicator Variation 4: Spinner */
.typing-spinner {
    width: 25px;
    height: 25px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Typing Indicator Variation 5: Ellipsis Dots */
.typing-ellipsis {
    display: flex;
    gap: 4px;
}

.typing-ellipsis div {
    width: 10px;
    height: 10px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: ellipsis 1.4s infinite;
}

.typing-ellipsis div:nth-child(1) {
    animation-delay: 0s;
}

.typing-ellipsis div:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-ellipsis div:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes ellipsis {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Typing Indicator Variation 6: Bars/Equalizer */
.typing-bars {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 20px;
}

.typing-bars div {
    width: 4px;
    background-color: var(--accent-color);
    border-radius: 2px;
    animation: bars 1s infinite ease-in-out;
}

.typing-bars div:nth-child(1) {
    animation-delay: 0s;
}

.typing-bars div:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-bars div:nth-child(3) {
    animation-delay: 0.3s;
}

.typing-bars div:nth-child(4) {
    animation-delay: 0.45s;
}

@keyframes bars {
    0%, 100% {
        height: 6px;
    }
    50% {
        height: 20px;
    }
}

/* Typing Indicator Variation 8: Snake/Sliding Dots */
.typing-snake {
    display: flex;
    gap: 4px;
}

.typing-snake div {
    width: 8px;
    height: 8px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: snake 1.5s infinite;
}

.typing-snake div:nth-child(1) {
    animation-delay: 0s;
}

.typing-snake div:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-snake div:nth-child(3) {
    animation-delay: 0.3s;
}

.typing-snake div:nth-child(4) {
    animation-delay: 0.45s;
}

@keyframes snake {
    0%, 100% {
        background-color: var(--text-secondary);
        transform: scale(1);
    }
    50% {
        background-color: var(--accent-color);
        transform: scale(1.3);
    }
}

/* Typing Indicator Variation 11: Rotating Dots */
.typing-rotate {
    position: relative;
    width: 30px;
    height: 30px;
}

.typing-rotate div {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    margin: -4px 0 0 -4px;
}

.typing-rotate div:nth-child(1) {
    transform: rotate(0deg) translateX(12px);
}

.typing-rotate div:nth-child(2) {
    transform: rotate(90deg) translateX(12px);
}

.typing-rotate div:nth-child(3) {
    transform: rotate(180deg) translateX(12px);
}

.typing-rotate div:nth-child(4) {
    transform: rotate(270deg) translateX(12px);
}

.typing-rotate {
    animation: rotate-container 1.2s linear infinite;
}

@keyframes rotate-container {
    to {
        transform: rotate(360deg);
    }
}

/* Typing Indicator Variation 12: Pendulum */
.typing-pendulum {
    width: 12px;
    height: 12px;
    background-color: var(--accent-color);
    border-radius: 50%;
    animation: pendulum 1s infinite ease-in-out;
}

@keyframes pendulum {
    0%, 100% {
        transform: translateX(-15px);
    }
    50% {
        transform: translateX(15px);
    }
}

/* Loading.io Spinners */

/* Variation 13: Dual Ring (loading.io) */
.lds-dual-ring,
.lds-dual-ring:after {
    box-sizing: border-box;
}
.lds-dual-ring {
    display: inline-block;
    width: 30px;
    height: 30px;
}
.lds-dual-ring:after {
    content: " ";
    display: block;
    width: 24px;
    height: 24px;
    margin: 3px;
    border-radius: 50%;
    border: 3px solid var(--accent-color);
    border-color: var(--accent-color) transparent var(--accent-color) transparent;
    animation: lds-dual-ring 1.2s linear infinite;
}
@keyframes lds-dual-ring {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Variation 14: Roller (loading.io) */
.lds-roller,
.lds-roller div,
.lds-roller div:after {
    box-sizing: border-box;
}
.lds-roller {
    display: inline-block;
    position: relative;
    width: 30px;
    height: 30px;
}
.lds-roller div {
    animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    transform-origin: 15px 15px;
}
.lds-roller div:after {
    content: " ";
    display: block;
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--accent-color);
    margin: -1.5px 0 0 -1.5px;
}
.lds-roller div:nth-child(1) { animation-delay: -0.036s; }
.lds-roller div:nth-child(1):after { top: 23.48px; left: 23.48px; }
.lds-roller div:nth-child(2) { animation-delay: -0.072s; }
.lds-roller div:nth-child(2):after { top: 25.39px; left: 21px; }
.lds-roller div:nth-child(3) { animation-delay: -0.108s; }
.lds-roller div:nth-child(3):after { top: 26.59px; left: 18.11px; }
.lds-roller div:nth-child(4) { animation-delay: -0.144s; }
.lds-roller div:nth-child(4):after { top: 27px; left: 15px; }
.lds-roller div:nth-child(5) { animation-delay: -0.18s; }
.lds-roller div:nth-child(5):after { top: 26.59px; left: 11.89px; }
.lds-roller div:nth-child(6) { animation-delay: -0.216s; }
.lds-roller div:nth-child(6):after { top: 25.39px; left: 9px; }
.lds-roller div:nth-child(7) { animation-delay: -0.252s; }
.lds-roller div:nth-child(7):after { top: 23.48px; left: 6.52px; }
.lds-roller div:nth-child(8) { animation-delay: -0.288s; }
.lds-roller div:nth-child(8):after { top: 21px; left: 4.61px; }
@keyframes lds-roller {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Variation 16: Grid (loading.io) */
.lds-grid,
.lds-grid div {
    box-sizing: border-box;
}
.lds-grid {
    display: inline-block;
    position: relative;
    width: 30px;
    height: 30px;
}
.lds-grid div {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
    animation: lds-grid 1.2s linear infinite;
}
.lds-grid div:nth-child(1) { top: 3px; left: 3px; animation-delay: 0s; }
.lds-grid div:nth-child(2) { top: 3px; left: 12px; animation-delay: -0.4s; }
.lds-grid div:nth-child(3) { top: 3px; left: 21px; animation-delay: -0.8s; }
.lds-grid div:nth-child(4) { top: 12px; left: 3px; animation-delay: -0.4s; }
.lds-grid div:nth-child(5) { top: 12px; left: 12px; animation-delay: -0.8s; }
.lds-grid div:nth-child(6) { top: 12px; left: 21px; animation-delay: -1.2s; }
.lds-grid div:nth-child(7) { top: 21px; left: 3px; animation-delay: -0.8s; }
.lds-grid div:nth-child(8) { top: 21px; left: 12px; animation-delay: -1.2s; }
.lds-grid div:nth-child(9) { top: 21px; left: 21px; animation-delay: -1.6s; }
@keyframes lds-grid {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Speechify Widget Positioning */
#speechify-root {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 9999 !important;
}

/* Desktop: position above chatbox input */
@media (min-width: 769px) {
    #speechify-root {
        bottom: 100px !important; /* Above input area */
    }
}

/* Bottom Action Buttons Container */
.speechify-play-container-bottom {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

/* Desktop: single row */
@media (min-width: 769px) {
    .speechify-play-container-bottom {
        flex-wrap: nowrap;
    }
}

/* Mobile: buttons flow naturally and wrap */
@media (max-width: 768px) {
    .speechify-play-container-bottom {
        gap: 6px;
    }
    
    /* All buttons size naturally based on content */
    .speechify-play-container-bottom button {
        flex: 0 0 auto;
    }
}

/* Shimmer Animation for Progress Messages */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer-text {
    background: linear-gradient(
        to right,
        #999999 0%,
        #ffffff 50%,
        #999999 100%
    );
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 10s infinite linear;
    display: inline-block;
}

/* Light mode shimmer - use gold highlight for visibility on light background */
@keyframes shimmer-light {
    0% {
        background-position: -600px 0;
    }
    100% {
        background-position: 600px 0;
    }
}

body.light-mode .shimmer-text {
    background: linear-gradient(
        to right,
        #444444 0%,
        #444444 35%,
        #C5A572 50%,
        #444444 65%,
        #444444 100%
    );
    background-size: 600px 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer-light 4s infinite linear;
    display: inline-block;
}

/* Dark theme variant (brighter shine) */
.shimmer-text-dark {
    background: linear-gradient(
        to right,
        #888 0%,
        #888 40%,
        #fff 50%,
        #888 60%,
        #888 100%
    );
    background-size: 1000px 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 10s infinite linear;
    display: inline-block;
}

/* Slower animation (more subtle) */
.shimmer-slow {
    animation: shimmer 10s infinite linear;
}

/* Morphing Boxes Loader - from Uiverse.io by alexruix */
.boxes-loader {
    width: 40px;
    height: 40px;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.boxes-loader .box1,
.boxes-loader .box2,
.boxes-loader .box3 {
    border: 5px solid #d4af37;
    box-sizing: border-box;
    position: absolute;
    display: block;
}

.boxes-loader .box1 {
    width: 40px;
    height: 17px;
    margin-top: 23px;
    margin-left: 0px;
    animation: abox1 4s 1s forwards ease-in-out infinite;
}

.boxes-loader .box2 {
    width: 17px;
    height: 17px;
    margin-top: 0px;
    margin-left: 0px;
    animation: abox2 4s 1s forwards ease-in-out infinite;
}

.boxes-loader .box3 {
    width: 17px;
    height: 17px;
    margin-top: 0px;
    margin-left: 23px;
    animation: abox3 4s 1s forwards ease-in-out infinite;
}

@keyframes abox1 {
    0% { width: 40px; height: 17px; margin-top: 23px; margin-left: 0px; }
    12.5% { width: 17px; height: 17px; margin-top: 23px; margin-left: 0px; }
    25%, 50%, 62.5% { width: 17px; height: 17px; margin-top: 23px; margin-left: 0px; }
    75% { width: 17px; height: 40px; margin-top: 0px; margin-left: 0px; }
    87.5%, 100% { width: 17px; height: 17px; margin-top: 0px; margin-left: 0px; }
}

@keyframes abox2 {
    0%, 12.5%, 25%, 37.5% { width: 17px; height: 17px; margin-top: 0px; margin-left: 0px; }
    50% { width: 40px; height: 17px; margin-top: 0px; margin-left: 0px; }
    62.5%, 75%, 87.5%, 100% { width: 17px; height: 17px; margin-top: 0px; margin-left: 23px; }
}

@keyframes abox3 {
    0%, 12.5% { width: 17px; height: 17px; margin-top: 0px; margin-left: 23px; }
    25% { width: 17px; height: 40px; margin-top: 0px; margin-left: 23px; }
    37.5%, 50%, 62.5%, 75%, 87.5% { width: 17px; height: 17px; margin-top: 23px; margin-left: 23px; }
    100% { width: 40px; height: 17px; margin-top: 23px; margin-left: 0px; }
}

/* 5-Square Wave Loader - from Uiverse.io by Nawsome */
.wave-squares {
    --square: 12px;
    --offset: 14px;
    --duration: 2.4s;
    --delay: 0.2s;
    width: calc(3 * var(--offset) + var(--square));
    height: calc(2 * var(--offset) + var(--square));
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.wave-squares div {
    display: inline-block;
    background: #d4af37;
    border: none;
    border-radius: 2px;
    width: var(--square);
    height: var(--square);
    position: absolute;
}

.wave-squares .sq1 { left: calc(0 * var(--offset)); top: calc(0 * var(--offset)); animation: sq1 var(--duration) var(--delay) ease-in-out infinite; }
.wave-squares .sq2 { left: calc(0 * var(--offset)); top: calc(1 * var(--offset)); animation: sq2 var(--duration) var(--delay) ease-in-out infinite; }
.wave-squares .sq3 { left: calc(1 * var(--offset)); top: calc(1 * var(--offset)); animation: sq3 var(--duration) var(--delay) ease-in-out infinite; }
.wave-squares .sq4 { left: calc(2 * var(--offset)); top: calc(1 * var(--offset)); animation: sq4 var(--duration) var(--delay) ease-in-out infinite; }
.wave-squares .sq5 { left: calc(3 * var(--offset)); top: calc(1 * var(--offset)); animation: sq5 var(--duration) var(--delay) ease-in-out infinite; }

@keyframes sq1 { 0% { left: calc(0 * var(--offset)); top: calc(0 * var(--offset)); } 8.333%, 100% { left: calc(0 * var(--offset)); top: calc(1 * var(--offset)); } }
@keyframes sq2 { 0% { left: calc(0 * var(--offset)); top: calc(1 * var(--offset)); } 8.333% { left: calc(0 * var(--offset)); top: calc(2 * var(--offset)); } 16.67% { left: calc(1 * var(--offset)); top: calc(2 * var(--offset)); } 25%, 83.33% { left: calc(1 * var(--offset)); top: calc(1 * var(--offset)); } 91.67% { left: calc(1 * var(--offset)); top: calc(0 * var(--offset)); } 100% { left: calc(0 * var(--offset)); top: calc(0 * var(--offset)); } }
@keyframes sq3 { 0%, 16.67% { left: calc(1 * var(--offset)); top: calc(1 * var(--offset)); } 25% { left: calc(1 * var(--offset)); top: calc(0 * var(--offset)); } 33.33% { left: calc(2 * var(--offset)); top: calc(0 * var(--offset)); } 41.67%, 66.67% { left: calc(2 * var(--offset)); top: calc(1 * var(--offset)); } 75% { left: calc(2 * var(--offset)); top: calc(2 * var(--offset)); } 83.33% { left: calc(1 * var(--offset)); top: calc(2 * var(--offset)); } 91.67%, 100% { left: calc(1 * var(--offset)); top: calc(1 * var(--offset)); } }
@keyframes sq4 { 0%, 33.33% { left: calc(2 * var(--offset)); top: calc(1 * var(--offset)); } 41.67% { left: calc(2 * var(--offset)); top: calc(2 * var(--offset)); } 50% { left: calc(3 * var(--offset)); top: calc(2 * var(--offset)); } 58.33%, 100% { left: calc(3 * var(--offset)); top: calc(1 * var(--offset)); } }
@keyframes sq5 { 0%, 50% { left: calc(3 * var(--offset)); top: calc(1 * var(--offset)); } 58.33% { left: calc(3 * var(--offset)); top: calc(0 * var(--offset)); } 66.67% { left: calc(2 * var(--offset)); top: calc(0 * var(--offset)); } 75%, 100% { left: calc(2 * var(--offset)); top: calc(1 * var(--offset)); } }

/* 3D Isometric Boxes - from Uiverse.io by Nawsome */
.iso-boxes {
    --size: 16px;
    --duration: 800ms;
    height: calc(var(--size) * 2);
    width: calc(var(--size) * 3);
    position: relative;
    transform-style: preserve-3d;
    transform-origin: 50% 50%;
    transform: rotateX(60deg) rotateZ(45deg) rotateY(0deg) translateZ(0px);
    display: inline-block;
    vertical-align: middle;
}

.iso-boxes .ibox {
    width: var(--size);
    height: var(--size);
    top: 0;
    left: 0;
    position: absolute;
    transform-style: preserve-3d;
}

.iso-boxes .ibox:nth-child(1) { transform: translate(100%, 0); animation: ibox1 var(--duration) linear infinite; }
.iso-boxes .ibox:nth-child(2) { transform: translate(0, 100%); animation: ibox2 var(--duration) linear infinite; }
.iso-boxes .ibox:nth-child(3) { transform: translate(100%, 100%); animation: ibox3 var(--duration) linear infinite; }
.iso-boxes .ibox:nth-child(4) { transform: translate(200%, 0); animation: ibox4 var(--duration) linear infinite; }

.iso-boxes .ibox > div {
    --bg: #d4af37;
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--bg);
    transform: rotateY(var(--rotateY, 0deg)) rotateX(var(--rotateX, 0deg)) translateZ(calc(var(--size) / 2));
}

.iso-boxes .ibox > div:nth-child(1) { --bg: #d4af37; }
.iso-boxes .ibox > div:nth-child(2) { --bg: #b8942d; --rotateY: 90deg; right: 0; }
.iso-boxes .ibox > div:nth-child(3) { --bg: #c9a433; --rotateX: -90deg; }
.iso-boxes .ibox > div:nth-child(4) { display: none; /* Remove shadow/back face */ }

@keyframes ibox1 { 0%, 50% { transform: translate(100%, 0); } 100% { transform: translate(200%, 0); } }
@keyframes ibox2 { 0% { transform: translate(0, 100%); } 50% { transform: translate(0, 0); } 100% { transform: translate(100%, 0); } }
@keyframes ibox3 { 0%, 50% { transform: translate(100%, 100%); } 100% { transform: translate(0, 100%); } }
@keyframes ibox4 { 0% { transform: translate(200%, 0); } 50% { transform: translate(200%, 100%); } 100% { transform: translate(100%, 100%); } }

/* 3D Rotating Cubes - from Uiverse.io by _6441 */
.cube-spinner {
    position: relative;
    width: 32px;
    height: 32px;
    display: inline-block;
    vertical-align: middle;
}

.cube-spinner .cube1 {
    width: 12px;
    height: 12px;
    animation: cubespin1 4s forwards infinite ease;
    position: absolute;
    transform-style: preserve-3d;
    left: 50%;
    top: 50%;
    margin-left: -6px;
    margin-top: -6px;
}

.cube-spinner .cube1 > div {
    height: 100%;
    position: absolute;
    width: 100%;
    border: 1px solid #d4af37;
}

.cube-spinner .cube1 div:nth-of-type(1) { transform: translateZ(-6px) rotateY(180deg); }
.cube-spinner .cube1 div:nth-of-type(2) { transform: rotateY(-270deg) translateX(50%); transform-origin: top right; }
.cube-spinner .cube1 div:nth-of-type(3) { transform: rotateY(270deg) translateX(-50%); transform-origin: center left; }
.cube-spinner .cube1 div:nth-of-type(4) { transform: rotateX(90deg) translateY(-50%); transform-origin: top center; }
.cube-spinner .cube1 div:nth-of-type(5) { transform: rotateX(-90deg) translateY(50%); transform-origin: bottom center; }
.cube-spinner .cube1 div:nth-of-type(6) { transform: translateZ(6px); }

.cube-spinner .cube2 {
    width: 20px;
    height: 20px;
    animation: cubespin2 4s forwards infinite ease;
    position: absolute;
    transform-style: preserve-3d;
    left: 50%;
    top: 50%;
    margin-left: -10px;
    margin-top: -10px;
}

.cube-spinner .cube2 > div {
    height: 100%;
    position: absolute;
    width: 100%;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.cube-spinner .cube2 div:nth-of-type(1) { transform: translateZ(-10px) rotateY(180deg); }
.cube-spinner .cube2 div:nth-of-type(2) { transform: rotateY(-270deg) translateX(50%); transform-origin: top right; }
.cube-spinner .cube2 div:nth-of-type(3) { transform: rotateY(270deg) translateX(-50%); transform-origin: center left; }
.cube-spinner .cube2 div:nth-of-type(4) { transform: rotateX(90deg) translateY(-50%); transform-origin: top center; }
.cube-spinner .cube2 div:nth-of-type(5) { transform: rotateX(-90deg) translateY(50%); transform-origin: bottom center; }
.cube-spinner .cube2 div:nth-of-type(6) { transform: translateZ(10px); }

@keyframes cubespin1 {
    0%, 100% { transform: rotate(0deg) rotateX(0deg) rotateY(0deg); }
    50% { transform: rotate(180deg) rotateX(360deg) rotateY(360deg); }
}

@keyframes cubespin2 {
    0%, 100% { transform: rotate(45deg) rotateX(0deg) rotateY(0deg); }
    50% { transform: rotate(-135deg) rotateX(-360deg) rotateY(-360deg); }
}

/* Dot Spinner - from Uiverse.io by Rajan1092 */
.dot-spinner-grid {
    width: 32px;
    height: 32px;
    display: inline-grid;
    vertical-align: middle;
}

.dot-spinner-grid::before,
.dot-spinner-grid::after {
    content: "";
    grid-area: 1/1;
    background: var(--c) 50% 0, var(--c) 50% 100%, var(--c) 100% 50%, var(--c) 0 50%;
    background-size: 8px 8px;
    background-repeat: no-repeat;
    animation: dotspingrid 1s infinite;
}

.dot-spinner-grid::before {
    --c: radial-gradient(farthest-side, #d4af37 92%, #0000);
    margin: 3px;
    background-size: 5px 5px;
    animation-timing-function: linear;
}

.dot-spinner-grid::after {
    --c: radial-gradient(farthest-side, #d4af37 92%, #0000);
}

@keyframes dotspingrid { 100% { transform: rotate(.5turn); } }

/* Spinning Dots - from Uiverse.io by SelfMadeSystem */
.spinning-dots {
    --size: 32px;
    --dot-size: 4px;
    --dot-count: 6;
    --color: #d4af37;
    --speed: 1s;
    --spread: 60deg;
    width: var(--size);
    height: var(--size);
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.spinning-dots .sdot {
    width: var(--size);
    height: var(--size);
    animation: dwl-dot-spin calc(var(--speed) * 5) infinite linear both;
    position: absolute;
}

.spinning-dots .sdot:nth-child(1) { animation-delay: calc(0 * var(--speed) / 8 * -1); rotate: calc(0 * var(--spread) / 5); }
.spinning-dots .sdot:nth-child(2) { animation-delay: calc(1 * var(--speed) / 8 * -1); rotate: calc(1 * var(--spread) / 5); }
.spinning-dots .sdot:nth-child(3) { animation-delay: calc(2 * var(--speed) / 8 * -1); rotate: calc(2 * var(--spread) / 5); }
.spinning-dots .sdot:nth-child(4) { animation-delay: calc(3 * var(--speed) / 8 * -1); rotate: calc(3 * var(--spread) / 5); }
.spinning-dots .sdot:nth-child(5) { animation-delay: calc(4 * var(--speed) / 8 * -1); rotate: calc(4 * var(--spread) / 5); }
.spinning-dots .sdot:nth-child(6) { animation-delay: calc(5 * var(--speed) / 8 * -1); rotate: calc(5 * var(--spread) / 5); }

.spinning-dots .sdot::before {
    content: "";
    display: block;
    width: var(--dot-size);
    height: var(--dot-size);
    background-color: var(--color);
    border-radius: 50%;
    position: absolute;
    transform: translate(-50%, -50%);
    bottom: 0;
    left: 50%;
}

@keyframes dwl-dot-spin {
    0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0.390, 0.575, 0.565, 1.000); opacity: 1; }
    2% { transform: rotate(20deg); animation-timing-function: linear; opacity: 1; }
    30% { transform: rotate(180deg); animation-timing-function: cubic-bezier(0.445, 0.050, 0.550, 0.950); opacity: 1; }
    41% { transform: rotate(380deg); animation-timing-function: linear; opacity: 1; }
    69% { transform: rotate(520deg); animation-timing-function: cubic-bezier(0.445, 0.050, 0.550, 0.950); opacity: 1; }
    76% { opacity: 1; }
    76.1% { opacity: 0; }
    80% { transform: rotate(720deg); }
    100% { opacity: 0; }
}

/* Banter Loader - from Uiverse.io by Nawsome */
.banter-loader {
    position: relative;
    width: 46px;
    height: 46px;
    display: inline-block;
    vertical-align: middle;
}

.banter-loader__box {
    float: left;
    position: relative;
    width: 12px;
    height: 12px;
    margin-right: 4px;
}

.banter-loader__box:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: #d4af37;
}

.banter-loader__box:nth-child(3n) {
    margin-right: 0;
    margin-bottom: 4px;
}

.banter-loader__box:nth-child(1):before,
.banter-loader__box:nth-child(4):before {
    margin-left: 16px;
}

.banter-loader__box:nth-child(3):before {
    margin-top: 32px;
}

.banter-loader__box:last-child {
    margin-bottom: 0;
}

.banter-loader__box:nth-child(1) { animation: banterBox-1 4s infinite; }
.banter-loader__box:nth-child(2) { animation: banterBox-2 4s infinite; }
.banter-loader__box:nth-child(3) { animation: banterBox-3 4s infinite; }
.banter-loader__box:nth-child(4) { animation: banterBox-4 4s infinite; }
.banter-loader__box:nth-child(5) { animation: banterBox-5 4s infinite; }
.banter-loader__box:nth-child(6) { animation: banterBox-6 4s infinite; }
.banter-loader__box:nth-child(7) { animation: banterBox-7 4s infinite; }
.banter-loader__box:nth-child(8) { animation: banterBox-8 4s infinite; }
.banter-loader__box:nth-child(9) { animation: banterBox-9 4s infinite; }

@keyframes banterBox-1 {
    9.09% { transform: translate(-16px, 0); }
    18.18% { transform: translate(0px, 0); }
    27.27% { transform: translate(0px, 0); }
    36.36% { transform: translate(16px, 0); }
    45.45% { transform: translate(16px, 16px); }
    54.55%, 63.64% { transform: translate(16px, 16px); }
    72.73% { transform: translate(16px, 0px); }
    81.82% { transform: translate(0px, 0px); }
    90.91% { transform: translate(-16px, 0px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes banterBox-2 {
    9.09% { transform: translate(0, 0); }
    18.18% { transform: translate(16px, 0); }
    27.27% { transform: translate(0px, 0); }
    36.36% { transform: translate(16px, 0); }
    45.45%, 54.55%, 63.64%, 72.73% { transform: translate(16px, 16px); }
    81.82%, 90.91% { transform: translate(0px, 16px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes banterBox-3 {
    9.09%, 18.18% { transform: translate(-16px, 0); }
    27.27% { transform: translate(0px, 0); }
    36.36%, 45.45%, 54.55%, 63.64%, 72.73% { transform: translate(-16px, 0); }
    81.82% { transform: translate(-16px, -16px); }
    90.91% { transform: translate(0px, -16px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes banterBox-4 {
    9.09%, 18.18% { transform: translate(-16px, 0); }
    27.27% { transform: translate(-16px, -16px); }
    36.36% { transform: translate(0px, -16px); }
    45.45% { transform: translate(0px, 0px); }
    54.55%, 63.64%, 72.73% { transform: translate(0px, -16px); }
    81.82% { transform: translate(-16px, -16px); }
    90.91% { transform: translate(-16px, 0px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes banterBox-5 {
    9.09%, 18.18%, 27.27% { transform: translate(0, 0); }
    36.36%, 45.45%, 54.55%, 63.64%, 72.73% { transform: translate(16px, 0); }
    81.82% { transform: translate(16px, -16px); }
    90.91% { transform: translate(0px, -16px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes banterBox-6 {
    9.09% { transform: translate(0, 0); }
    18.18%, 27.27% { transform: translate(-16px, 0); }
    36.36%, 45.45%, 54.55%, 63.64% { transform: translate(0px, 0); }
    72.73% { transform: translate(0px, 16px); }
    81.82% { transform: translate(-16px, 16px); }
    90.91% { transform: translate(-16px, 0px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes banterBox-7 {
    9.09%, 18.18%, 27.27% { transform: translate(16px, 0); }
    36.36% { transform: translate(0px, 0); }
    45.45% { transform: translate(0px, -16px); }
    54.55% { transform: translate(16px, -16px); }
    63.64%, 72.73% { transform: translate(0px, -16px); }
    81.82% { transform: translate(0px, 0px); }
    90.91% { transform: translate(16px, 0px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes banterBox-8 {
    9.09% { transform: translate(0, 0); }
    18.18% { transform: translate(-16px, 0); }
    27.27% { transform: translate(-16px, -16px); }
    36.36%, 45.45%, 54.55%, 63.64%, 72.73% { transform: translate(0px, -16px); }
    81.82% { transform: translate(16px, -16px); }
    90.91% { transform: translate(16px, 0px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes banterBox-9 {
    9.09%, 18.18% { transform: translate(-16px, 0); }
    27.27% { transform: translate(0px, 0); }
    36.36% { transform: translate(-16px, 0); }
    45.45%, 54.55% { transform: translate(0px, 0); }
    63.64%, 72.73% { transform: translate(-16px, 0); }
    81.82% { transform: translate(-32px, 0); }
    90.91% { transform: translate(-16px, 0); }
    100% { transform: translate(0px, 0); }
}

/* AI Sparkle Star - 4-point rotating star */
.ai-sparkle {
    position: relative;
    width: 32px;
    height: 32px;
    display: inline-block;
    vertical-align: middle;
}

.ai-sparkle::before,
.ai-sparkle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    background: #d4af37;
    border-radius: 2px;
    animation: ai-sparkle-rotate 1.5s ease-in-out infinite;
}

.ai-sparkle::before {
    width: 6px;
    height: 28px;
    margin-left: -3px;
    margin-top: -14px;
}

.ai-sparkle::after {
    width: 28px;
    height: 6px;
    margin-left: -14px;
    margin-top: -3px;
}

/* Inner sparkle for 4-point effect */
.ai-sparkle .sparkle-inner::before,
.ai-sparkle .sparkle-inner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    background: #d4af37;
    border-radius: 2px;
    animation: ai-sparkle-rotate 1.5s ease-in-out infinite;
    animation-delay: -0.75s;
}

.ai-sparkle .sparkle-inner::before {
    width: 5px;
    height: 20px;
    margin-left: -2.5px;
    margin-top: -10px;
    transform: rotate(45deg);
    transform-origin: center;
}

.ai-sparkle .sparkle-inner::after {
    width: 20px;
    height: 5px;
    margin-left: -10px;
    margin-top: -2.5px;
    transform: rotate(45deg);
    transform-origin: center;
}

@keyframes ai-sparkle-rotate {
    0% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: rotate(90deg) scale(0.85);
        opacity: 0.8;
    }
    50% {
        transform: rotate(180deg) scale(1);
        opacity: 1;
    }
    75% {
        transform: rotate(270deg) scale(0.85);
        opacity: 0.8;
    }
    100% {
        transform: rotate(360deg) scale(1);
        opacity: 1;
    }
}

/* Input Area */
.input-container {
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.input-wrapper {
    max-width: 875px;
    margin: 0 auto;
    display: flex;
    gap: 12px;
    align-items: center;
}

.reset-session-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.reset-session-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-color);
}

.chat-form {
    flex: 1;
    display: flex;
    gap: 4px;
    align-items: center;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 12px;
    min-height: 44px;
    transition: border-color 0.2s;
    position: relative;
}

.chat-form:focus-within {
    border-color: var(--accent-color);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
    padding: 0;
}

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

.char-counter {
    position: absolute;
    bottom: 100%;
    right: 12px;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--danger-color);
    color: white;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.char-counter.warning {
    background: #f59e0b;
}

.mic-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mic-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.mic-btn.listening {
    color: #ef4444;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Web Search Toggle Button */
.web-search-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    opacity: 0.6;
}

.web-search-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    opacity: 1;
}

.web-search-btn.active {
    color: #3b82f6;
    opacity: 1;
}

.web-search-btn.active:hover {
    color: #2563eb;
    background-color: rgba(59, 130, 246, 0.1);
}

.web-search-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Deep Research Toggle Button */
.deep-research-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    opacity: 0.6;
}

.deep-research-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    opacity: 1;
}

.deep-research-btn.active {
    color: #a855f7;
    opacity: 1;
}

.deep-research-btn.active:hover {
    color: #9333ea;
    background-color: rgba(168, 85, 247, 0.1);
}

.deep-research-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Search Options Dropdown */
.search-options-container {
    position: relative;
    flex-shrink: 0;
}

.search-options-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.6;
}

.search-options-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    opacity: 1;
}

.search-options-btn.has-active {
    color: var(--accent-color);
    opacity: 1;
}

.search-options-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.search-options-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    min-width: 200px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 100;
}

.search-options-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

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

.search-option-item .option-check {
    width: 14px;
    font-size: 12px;
    color: var(--accent-color);
    opacity: 0;
    transition: opacity 0.15s;
}

.search-option-item.active .option-check {
    opacity: 1;
}

.search-option-item .option-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.search-option-item.active {
    color: var(--text-primary);
}

.search-option-item .option-info {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.search-option-item .option-info:hover {
    opacity: 1;
}

/* Blue color for web search when active */
#webSearchOption.active .option-icon {
    color: #3b82f6;
}

/* Purple color for deep research when active */
#deepResearchOption.active .option-icon {
    color: #a855f7;
}

/* Knowledgebase submenu styles */
.search-option-item.has-submenu {
    position: relative;
}

.search-option-item.has-submenu .submenu-arrow {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-secondary);
}

.search-option-item.has-submenu .kb-option-text {
    flex: 1;
}

.search-option-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

.kb-submenu {
    position: absolute;
    bottom: calc(100% + 4px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    min-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    z-index: 101;
}

.search-option-item.has-submenu:hover .kb-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.kb-submenu-header {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 8px 12px 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}

.kb-submenu-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s;
}

.kb-submenu-item:hover {
    background-color: var(--bg-hover);
}

.kb-submenu-item.active {
    background-color: var(--bg-hover);
}

.kb-submenu-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--accent-color);
}

.kb-submenu-content {
    flex: 1;
    min-width: 0;
}

.kb-submenu-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.kb-submenu-item.active .kb-submenu-title {
    color: var(--accent-color);
}

.kb-submenu-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.search-option-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.search-option-item.disabled:hover {
    background-color: transparent;
}

/* Knowledgebase menu (hover dropdown) */
.kb-menu-container {
    position: relative;
    display: none; /* Hidden by default, shown by JS for authenticated users */
}

.kb-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 500;
    padding: 4px 10px;
}

.kb-menu-btn i {
    font-size: 10px;
    transition: transform 0.2s;
}

.kb-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.kb-menu-btn:hover i,
.kb-menu-container:hover .kb-menu-btn i {
    transform: rotate(180deg);
}

/* Tooltip for Suggestions button */
.kb-menu-btn[data-tooltip] {
    position: relative;
}

.kb-menu-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.kb-menu-btn[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border-top: 6px solid rgba(20, 20, 20, 0.95);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10001;
}

.kb-menu-btn[data-tooltip]:hover::after,
.kb-menu-btn[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

body.dark-theme .kb-menu-btn[data-tooltip]::after {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-theme .kb-menu-btn[data-tooltip]::before {
    border-top-color: rgba(30, 30, 30, 0.95);
}

/* Hide tooltip when dropdown is open */
.kb-menu-container:has(.kb-menu-dropdown.show) .kb-menu-btn[data-tooltip]::after,
.kb-menu-container:has(.kb-menu-dropdown.show) .kb-menu-btn[data-tooltip]::before {
    opacity: 0 !important;
    visibility: hidden !important;
}

.kb-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    z-index: 1000;
    overflow: hidden;
    padding-top: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
}

body.dark-theme .kb-menu-dropdown {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.kb-menu-dropdown::before {
    /* Invisible bridge to connect button to dropdown */
    content: '';
    position: absolute;
    top: -4px;
    left: 0;
    right: 0;
    height: 8px;
}

.kb-menu-container:hover .kb-menu-dropdown,
.kb-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
}

.kb-menu-options {
    padding: 6px 0;
}

.kb-menu-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}

.kb-menu-option:hover {
    background: var(--bg-hover);
}

.kb-menu-option.active {
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent-color);
}

body.dark-theme .kb-menu-option.active {
    background: rgba(212, 175, 55, 0.15);
}

.kb-menu-option i {
    width: 16px;
    text-align: center;
    font-size: 14px;
    opacity: 0.7;
}

.kb-menu-option.active i {
    color: var(--accent-color);
    opacity: 1;
}

/* Tooltip for KB menu options */
.kb-menu-option[data-tooltip] {
    position: relative;
}

.kb-menu-option[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20, 20, 20, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.kb-menu-option[data-tooltip]::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    transform: translateY(-50%);
    border-right: 6px solid rgba(20, 20, 20, 0.95);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 10001;
}

.kb-menu-option[data-tooltip]:hover::after,
.kb-menu-option[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

body.dark-theme .kb-menu-option[data-tooltip]::after {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-theme .kb-menu-option[data-tooltip]::before {
    border-right-color: rgba(30, 30, 30, 0.95);
}

/* Mobile adjustments for suggestions dropdown */
@media (max-width: 768px) {
    .kb-menu-dropdown {
        /* Adjust positioning and width on mobile */
        left: 5%;
        right: 5%;
        transform: none;
        width: auto;
        border-radius: 8px;
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* Custom tooltips for chat input buttons */
.chat-form button[data-tooltip] {
    position: relative;
}

.chat-form button[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-form button[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1a1a1a;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 1000;
}

.chat-form button[data-tooltip]:hover::after,
.chat-form button[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

    /* Dark theme variant (brighter shine) */
    .shimmer-text-dark {
        background: linear-gradient(
            to right,
            #888 0%,
            #888 40%,
            #fff 50%,
            #888 60%,
            #888 100%
        );
        background-size: 1000px 100%;
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        animation: shimmer 10s infinite linear;
        display: inline-block;
    }

    /* Slower animation (more subtle) */
    .shimmer-slow {
        animation: shimmer 10s infinite linear;
    }

/* Follow-up Questions */
.followup-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 48px;
    margin-top: 12px;
    margin-bottom: 16px;
}

/* Collapsed state */
.followup-questions.collapsed {
    flex-direction: column;
    gap: 0;
}

.followup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.followup-header:hover {
    background: var(--bg-hover);
    border-color: var(--accent-color);
}

.followup-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.followup-title i {
    color: var(--accent-color);
}

.followup-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

/* Chips container */
.followup-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.followup-questions.collapsed .followup-chips-container {
    display: none;
}

.followup-questions.collapsed.expanded .followup-chips-container {
    display: flex;
}

.followup-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.followup-chip:hover {
    background: var(--bg-hover);
    border-color: var(--accent-color);
}

/* Input Area */
.input-container {
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.send-btn {
    background-color: var(--accent-color);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: scale(1.05);
}

.send-btn:disabled {
    background-color: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.5;
}

.send-btn.stop-mode {
    background-color: #e74c3c;
    opacity: 1;
    cursor: pointer;
    animation: stop-pulse 1.5s ease-in-out infinite;
}

.send-btn.stop-mode:hover {
    background-color: #c0392b;
    transform: scale(1.05);
}

@keyframes stop-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
}

.input-footer {
    max-width: 875px;
    margin: 8px auto 0;
    text-align: center;
}

.input-footer p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-secondary);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* Quick Settings (Always Visible at Top) */
.quick-settings {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.quick-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.quick-row:first-child {
    padding-top: 0;
}

.quick-label {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-label i {
    color: var(--text-secondary);
    font-size: 12px;
    cursor: help;
}

/* Compact KB selector for settings */
.settings-kb-selector.compact {
    min-width: 160px;
}

.settings-kb-selector.compact .settings-kb-btn {
    padding: 8px 12px;
    font-size: 13px;
}

.quick-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    min-width: 140px;
    cursor: pointer;
}

.quick-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Collapsible Sections */
.collapsible-section {
    margin-bottom: 8px;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.collapsible-header:hover {
    background: var(--bg-tertiary);
}

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

.collapsible-header-left .section-icon {
    color: var(--accent-color);
    font-size: 14px;
    width: 16px;
}

.collapsible-header-left span {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-primary);
}

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

.collapsible-header .chevron {
    color: var(--text-secondary);
    font-size: 12px;
    transition: transform 0.3s;
}

.collapsible-header.open .chevron {
    transform: rotate(180deg);
}

.collapsible-body {
    display: none;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: 0 0 8px 8px;
    margin-top: -8px;
    padding-top: 16px;
}

.collapsible-body.show {
    display: block;
}

/* Members Badge (compact) */
.members-badge {
    font-size: 9px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #d4af37 0%, #c9a136 100%);
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Toggle Row */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.toggle-row:first-child {
    padding-top: 0;
}

.toggle-row:last-child {
    padding-bottom: 0;
}

.toggle-label-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.toggle-label-inline i {
    color: var(--text-secondary);
    font-size: 12px;
    cursor: help;
}

/* Settings Toggle Switch */
.setting-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.setting-toggle-switch input {
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
    z-index: 2;
    margin: 0;
}

.setting-toggle-switch .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    border-radius: 24px;
    transition: 0.3s;
    z-index: 1;
}

.setting-toggle-switch .toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

.setting-toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-color);
}

.setting-toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Compact font size control */
.font-size-control.compact {
    display: flex;
    align-items: center;
    gap: 6px;
}

.font-size-control.compact .font-size-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.font-size-control.compact .font-size-input {
    width: 45px;
    padding: 6px 8px;
    font-size: 13px;
}

/* Legacy styles kept for compatibility */
.settings-section-header {
    margin-bottom: 16px;
    margin-top: 8px;
}

.settings-section-header span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.settings-section-header hr {
    margin: 8px 0 0 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.setting-item {
    margin-bottom: 24px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.setting-select {
    width: 100%;
    padding: 10px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.setting-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Font Size Control */
.font-size-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.font-size-btn {
    background: var(--accent-color);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.font-size-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.font-size-btn:active {
    transform: scale(0.95);
}

.font-size-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.font-size-input {
    width: 70px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

.font-size-input::-webkit-inner-spin-button,
.font-size-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Clear Sessions Button */
.clear-sessions-btn {
    width: 100%;
    padding: 12px 16px;
    margin-top: 8px;
    background: var(--danger-color);
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.clear-sessions-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.clear-sessions-btn:active {
    transform: translateY(0);
}

/* Cancel Session Clear Button */
#cancelSessionClearBtn:hover {
    background: var(--bg-hover) !important;
    border-color: var(--accent-color) !important;
}

#cancelSessionClearBtn:active {
    transform: scale(0.98);
}

/* Session Data Toggle */
#sessionDataToggle:hover {
    background: var(--bg-hover) !important;
}

/* UI Locked State - Show not-allowed cursor on all interactive elements */
body.ui-locked button:not(:disabled),
body.ui-locked .session-item,
body.ui-locked .logo-btn,
body.ui-locked .menu-btn,
body.ui-locked .saved-messages-btn,
body.ui-locked .theme-toggle-btn,
body.ui-locked a {
    cursor: not-allowed !important;
    /* Allow pointer events for tooltip but clicks are still disabled via JS */
}

/* Keep sidebar toggle functional during UI lock */
body.ui-locked .sidebar-toggle-btn {
    cursor: pointer !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Keep bot message action buttons functional during UI lock */
body.ui-locked .message-action-btn,
body.ui-locked .tts-btn,
body.ui-locked .speechify-play-btn-top,
body.ui-locked .speechify-play-btn-bottom,
body.ui-locked .sources-btn,
body.ui-locked .listen-btn,
body.ui-locked .copy-btn,
body.ui-locked .email-btn,
body.ui-locked .save-btn,
body.ui-locked #settingsBtn {
    cursor: pointer !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* Keep sources modal/popup links functional during UI lock */
body.ui-locked .sources-modal a,
body.ui-locked .sources-popup a,
body.ui-locked .source-item a,
body.ui-locked .modal a,
body.ui-locked .modal-content a,
body.ui-locked .sources-modal-overlay a,
body.ui-locked .sources-modal-content a,
body.ui-locked #sourcesModal a {
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Keep message action bar buttons (Sources, Listen, Copy, Email, Save) functional */
body.ui-locked .message-actions-bar button,
body.ui-locked .bot-actions button,
body.ui-locked [class*="action-btn"],
body.ui-locked .speechify-play-container-bottom button,
body.ui-locked .speechify-play-container-bottom a,
body.ui-locked .message-action-buttons button,
body.ui-locked .message-action-buttons a {
    cursor: pointer !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* But keep the input area responsive for visual feedback */
body.ui-locked #chatInput,
body.ui-locked #sendBtn {
    cursor: not-allowed !important;
}

/* Locked element tooltip - only shows on buttons, not session items */
body.ui-locked [data-locked-tooltip]:not(.session-item) {
    position: relative;
}

body.ui-locked [data-locked-tooltip]:not(.session-item):hover::after {
    content: attr(data-locked-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 10001;
    margin-bottom: 8px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.2s ease;
}

body.ui-locked [data-locked-tooltip]:not(.session-item):hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1a1a1a;
    margin-bottom: 2px;
    z-index: 10001;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* jQuery Confirm Custom Styling */
.jconfirm.jconfirm-modern .jconfirm-box {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    max-width: 500px !important;
}

.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-title-c {
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-content-pane {
    color: var(--text-primary) !important;
}

.jconfirm.jconfirm-modern .jconfirm-box button {
    border-radius: 8px !important;
    font-weight: 500 !important;
    padding: 12px 24px !important;
    text-transform: none !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    border: none !important;
}

.jconfirm.jconfirm-modern .jconfirm-box button.btn-blue,
.jconfirm-type-orange .jconfirm-box button.btn-blue {
    background: var(--accent-color) !important;
    color: white !important;
}

.jconfirm.jconfirm-modern .jconfirm-box button.btn-blue:hover,
.jconfirm-type-orange .jconfirm-box button.btn-blue:hover {
    background: var(--accent-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3) !important;
}

.jconfirm.jconfirm-modern .jconfirm-box button.btn-orange,
.jconfirm-type-orange .jconfirm-box button.btn-orange {
    background: #f97316 !important;
    color: white !important;
    width: 100% !important;
    margin-bottom: 8px !important;
}

.jconfirm.jconfirm-modern .jconfirm-box button.btn-orange:hover,
.jconfirm-type-orange .jconfirm-box button.btn-orange:hover {
    background: #ea580c !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4) !important;
}

.jconfirm.jconfirm-modern .jconfirm-box button.btn-default {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    flex: 1 !important;
    min-width: auto !important;
}

.jconfirm.jconfirm-modern .jconfirm-box button.btn-default:hover {
    background: var(--bg-hover) !important;
    border-color: var(--accent-color) !important;
}

/* Make button container wrap properly */
.jconfirm.jconfirm-modern .jconfirm-buttons {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

.jconfirm-bg {
    background: rgba(0, 0, 0, 0.7) !important;
    backdrop-filter: blur(5px) !important;
}

/* Ensure jconfirm modals are above Speechify widget (9999) */
.jconfirm-scrollpane {
    z-index: 10000 !important;
}

/* Delete confirmation button (ChatGPT style) */
.jconfirm.jconfirm-modern .jconfirm-box button.btn-red,
.jconfirm-type-red .jconfirm-box button.btn-red {
    background: #ef4444 !important;
    color: white !important;
    border: none !important;
    font-weight: 600 !important;
}

.jconfirm.jconfirm-modern .jconfirm-box button.btn-red:hover,
.jconfirm-type-red .jconfirm-box button.btn-red:hover {
    background: #dc2626 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
}

/* Dark theme styling for delete dialog */
.jconfirm.jconfirm-dark .jconfirm-box {
    background: #2c2c2c !important;
    border: 1px solid #3f3f3f !important;
}

.jconfirm.jconfirm-dark .jconfirm-box div.jconfirm-title-c {
    color: #ffffff !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    border-bottom: none !important;
    padding: 20px 20px 12px 20px !important;
}

.jconfirm.jconfirm-dark .jconfirm-box div.jconfirm-content-pane {
    color: #b3b3b3 !important;
    padding: 0 20px 20px 20px !important;
}

.jconfirm.jconfirm-dark .jconfirm-buttons {
    padding: 0 20px 20px 20px !important;
    gap: 12px !important;
    justify-content: flex-end !important;
}

/* Range Slider Styling */
.setting-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 5px;
    outline: none;
    margin: 8px 0;
}

.setting-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.setting-slider::-webkit-slider-thumb:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.setting-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.setting-slider::-moz-range-thumb:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.setting-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 5px;
}

.setting-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 5px;
}

.setting-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.setting-toggle input[type="checkbox"] {
    flex-shrink: 0;
    position: relative;
    width: 44px;
    height: 24px;
    appearance: none;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
    border: 1px solid var(--border-color);
}

.setting-toggle input[type="checkbox"]:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.setting-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.setting-toggle input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

/* Disabled toggle state for non-members */
.setting-toggle input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

.setting-toggle input[type="checkbox"]:disabled::before {
    background-color: #999;
}

.setting-toggle:has(input[type="checkbox"]:disabled) {
    cursor: not-allowed;
    opacity: 0.7;
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 20px;
    position: relative;
    top: -6px;
    left: 5px;
}

/* Members only badge */
.members-only-badge {
    display: inline-block;
    vertical-align: middle;
    position: relative;
    top: -1px;
}

/* Overlay */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.overlay.active {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        transform: translateX(-100%);
        z-index: 100;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle-btn {
        display: none;
    }

    .mobile-close-btn {
        display: block;
    }

    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
    }

    .main-content {
        padding-top: 60px; /* Height of mobile header */
    }

    .chat-container {
        height: calc(calc(var(--vh, 1vh) * 100) - 60px - 80px); /* Total height - header - input */
        max-height: calc(calc(var(--vh, 1vh) * 100) - 60px - 80px);
    }

    .input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
    }

    /* Adjust scroll-to-bottom button for mobile */
    .scroll-to-bottom-btn {
        bottom: 90px; /* Position above fixed input */
        right: 16px;
        padding: 10px 16px;
        font-size: 13px;
    }

    .chat-messages {
        padding: 16px 12px;
    }

    .message {
        padding: 16px 4px; /* Reduced from 12px to 4px */
    }

    .message.user-message,
    .message.bot-message {
        max-width: 100%; /* Full width */
    }
    
    /* Mobile: Move bot avatar inside bubble for wider content */
    .message.bot-message {
        gap: 0;
        max-width: 100%;
        padding-left: 8px; /* Minimal left padding */
        padding-right: 8px; /* Minimal right padding */
    }
    
    .bot-message .message-avatar {
        position: absolute;
        width: 30px;
        height: 30px;
        top: 10px;
        left: 10px;
        z-index: 2;
    }
    
    .bot-message .message-content {
        padding: 25px 12px 12px 10px;
        margin-left: 0;
    }
    
    /* Remove speech bubble tail on mobile */
    .bot-message .message-content::after,
    .bot-message .message-content::before {
        display: none;
    }
    
    /* Mobile: Move user avatar inside bubble too */
    .message.user-message {
        gap: 0;
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .user-message .message-avatar {
        position: absolute;
        width: 30px;
        height: 30px;
        top: 10px;
        right: 10px;
        z-index: 2;
    }
    
    .user-message .message-content {
        padding: 25px 12px 12px 10px;
        margin-right: 0;
    }
    
    /* Remove speech bubble tail on mobile for user messages */
    .user-message .message-content::after,
    .user-message .message-content::before {
        display: none;
    }
    
    /* Disable tooltips on mobile */
    .custom-tooltip {
        display: none !important;
    }
    
    /* Always show rename and delete buttons on mobile */
    .session-edit-btn,
    .session-delete-btn {
        display: block !important;
        opacity: 0.8;
    }
    
    /* jQuery Confirm modals - fit properly on mobile */
    .jconfirm.jconfirm-modern .jconfirm-box,
    .jconfirm.jconfirm-dark .jconfirm-box,
    .jconfirm-type-orange .jconfirm-box,
    .jconfirm-type-red .jconfirm-box {
        max-width: calc(100vw - 40px) !important;
        width: 90% !important;
        margin: 20px !important;
        padding: 0 !important;
    }
    
    .jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-title-c,
    .jconfirm.jconfirm-dark .jconfirm-box div.jconfirm-title-c,
    .jconfirm-type-red .jconfirm-box div.jconfirm-title-c {
        font-size: 16px !important;
        padding: 16px !important;
        border-bottom: 1px solid var(--border-color) !important;
    }
    
    .jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-content-pane,
    .jconfirm.jconfirm-dark .jconfirm-box div.jconfirm-content-pane {
        padding: 0 16px 16px 16px !important;
        font-size: 14px !important;
        word-wrap: break-word !important;
        white-space: normal !important;
        overflow-wrap: break-word !important;
    }
    
    .jconfirm.jconfirm-modern .jconfirm-box div.jconfirm-content-pane .jconfirm-content,
    .jconfirm.jconfirm-dark .jconfirm-box div.jconfirm-content-pane .jconfirm-content {
        max-height: none !important;
        overflow: visible !important;
    }
    
    .jconfirm.jconfirm-modern .jconfirm-buttons,
    .jconfirm.jconfirm-dark .jconfirm-buttons,
    .jconfirm-type-red .jconfirm-buttons {
        padding: 0 16px 16px 16px !important;
        flex-direction: row !important;
        gap: 8px !important;
    }
    
    .jconfirm.jconfirm-modern .jconfirm-box button,
    .jconfirm.jconfirm-dark .jconfirm-box button,
    .jconfirm-type-red .jconfirm-box button {
        flex: 1 !important;
        width: auto !important;
        margin: 0 !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
    }
    
    /* Knowledgebase mismatch modal - better mobile layout */
    .jconfirm-type-orange .jconfirm-box {
        max-width: calc(100vw - 30px) !important;
        width: 95% !important;
    }
    
    .jconfirm-type-orange .jconfirm-box div.jconfirm-title-c {
        padding: 20px !important;
        border-bottom: 1px solid var(--border-color) !important;
    }
    
    .jconfirm-type-orange .jconfirm-box div.jconfirm-content-pane {
        padding: 16px !important;
        font-size: 15px !important;
    }
    
    .jconfirm-type-orange .jconfirm-box div.jconfirm-content-pane p {
        font-size: 15px !important;
        line-height: 1.6 !important;
        margin-bottom: 12px !important;
    }
    
    .jconfirm-type-orange .jconfirm-box div.jconfirm-content-pane strong {
        font-size: 16px !important;
    }
    
    .jconfirm-type-orange .jconfirm-buttons {
        padding: 0 16px 16px 16px !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .jconfirm-type-orange .jconfirm-box button {
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        padding: 14px 16px !important;
        font-size: 15px !important;
        min-height: 48px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    .jconfirm-type-orange .jconfirm-box button.btn-orange {
        width: 100% !important;
        margin-bottom: 0 !important;
    }
    
    .jconfirm-type-orange .jconfirm-box button i {
        font-size: 15px !important;
        margin: 0 !important;
    }
    
    /* Make action buttons smaller on mobile to fit single row */
    .message-action-buttons {
        gap: 4px !important;
        flex-wrap: nowrap !important;
        opacity: 1 !important; /* Always visible on mobile - no hover needed */
    }
    
    .message-action-buttons button {
        padding: 10px 12px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
        min-height: 36px !important;
    }
    
    .message-action-buttons button i {
        font-size: 13px !important;
        margin-right: 4px !important;
    }
    
    .message-action-btn.tts-btn {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
        padding: 0 !important;
    }

    .robot-icon {
        width: 80px;
    }
    
    .chat-bubble {
        font-size: 13px;
        padding: 8px 12px;
        top: -22px;
        left: calc(100% - 3px);
    }
    
    .chat-bubble::after {
        left: 16px;
        border-left: 16px solid var(--bg-secondary);
        border-right: 8px solid transparent;
        border-top: 8px solid var(--bg-secondary);
        border-bottom: 12px solid transparent;
        bottom: -16px;
    }
    
    body.light-mode .chat-bubble::after {
        border-left-color: #3a3a3a;
        border-top-color: #3a3a3a;
    }
    
    .welcome-screen h1 {
        font-size: 24px;
        margin-top: 16px;
    }
    
    .welcome-screen p {
        font-size: 15px;
    }

    .suggestion-cards {
        grid-template-columns: 1fr;
    }

    .input-wrapper {
        gap: 8px;
    }

    .reset-session-btn {
        display: none;
    }
    
    .input-footer {
        display: none;
    }
    
    .input-container {
        padding: 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 480px) {
    .robot-icon {
        width: 60px;
    }
    
    .chat-bubble {
        font-size: 12px;
        padding: 6px 10px;
        top: -20px;
        left: calc(100% - 2px);
    }
    
    .chat-bubble::after {
        left: 12px;
        border-left: 14px solid var(--bg-secondary);
        border-right: 6px solid transparent;
        border-top: 6px solid var(--bg-secondary);
        border-bottom: 10px solid transparent;
        bottom: -14px;
    }
    
    body.light-mode .chat-bubble::after {
        border-left-color: #3a3a3a;
        border-top-color: #3a3a3a;
    }
    
    .welcome-icon {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }

    .welcome-screen h1 {
        font-size: 20px;
        margin-top: 12px;
        line-height: 1.3;
    }

    .welcome-screen p {
        font-size: 14px;
        padding: 0 8px;
    }
    
    /* Extra small screens - keep buttons reasonably sized */
    .message-action-buttons button {
        padding: 9px 11px !important;
        font-size: 12px !important;
        min-height: 34px !important;
    }
    
    .message-action-buttons button i {
        font-size: 12px !important;
        margin-right: 3px !important;
    }
    
    .message-action-btn.tts-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 13px !important;
        padding: 0 !important;
    }
    
    /* Follow-up Questions - Mobile Styling */
    .followup-questions {
        padding-left: 0 !important;
        margin-top: 16px !important;
        margin-bottom: 20px !important;
        gap: 10px !important;
    }
    
    .followup-chip {
        padding: 10px 16px !important;
        font-size: 14px !important;
        border-radius: 24px !important;
        max-width: 100% !important;
        white-space: normal !important;
        text-align: left !important;
        line-height: 1.4 !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    }
    
    .followup-chip:active {
        transform: scale(0.98);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Mobile-specific text overflow handling */
    .message-text h2,
    .message-text h3,
    .message-text h4 {
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Mobile table improvements */
    .message-text table {
        font-size: 13px;
        min-width: 100%;
    }
    
    .message-text th,
    .message-text td {
        padding: 8px;
        white-space: nowrap;
        min-width: 80px;
    }
    
    /* Mobile code blocks */
    .message-text pre {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    
    .message-text code {
        word-break: break-all;
    }

    /* Slower shimmer animation on mobile */
    .shimmer-text {
        animation: shimmer 10s infinite linear;
    }
}

/* Broader mobile breakpoint for tablets and smaller devices */
@media (max-width: 900px) {
    /* Follow-up Questions - Mobile/Tablet Styling */
    .followup-questions {
        padding-left: 0 !important;
        margin-top: 16px !important;
        margin-bottom: 20px !important;
        gap: 12px !important;
    }
    
    .followup-chip {
        padding: 12px 18px !important;
        font-size: 14px !important;
        border-radius: 24px !important;
        max-width: 100% !important;
        width: 100% !important;
        white-space: normal !important;
        text-align: left !important;
        line-height: 1.5 !important;
        min-height: 48px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
        font-weight: 400 !important;
    }
    
    .followup-chip:active {
        transform: scale(0.98) !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Search Modal - Full-screen on mobile */
    .search-modal {
        padding: 0;
        align-items: stretch;
        justify-content: stretch;
    }
    
    .search-modal-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }
}

/* New Response Button - Shows when new message arrives */
.new-response-btn {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
}

.new-response-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.new-response-btn:hover {
    background: var(--accent-hover);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.new-response-btn i {
    font-size: 12px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(3px); }
}

/* Q&A Navigation Buttons */
.qa-nav-buttons {
    position: fixed;
    bottom: 100px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: all 0.3s ease;
    z-index: 100;
}

.qa-nav-buttons.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.qa-nav-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.qa-nav-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.qa-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .new-response-btn {
        bottom: 90px;
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .qa-nav-buttons {
        bottom: 90px;
        right: 16px;
    }
    
    .qa-nav-btn {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
}

/* Q&A Index Panel Styles */
.qa-index-panel {
    font-family: inherit;
}

/* Light mode adjustments for Q&A Index */
body.light-mode .qa-index-item {
    background: rgba(0, 0, 0, 0.05) !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .qa-index-item:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12) !important;
}

body.light-mode .qa-index-item.current {
    background: rgba(212, 175, 55, 0.15) !important;
    border: 2px solid #d4af37 !important;
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.25) !important;
}

body.light-mode .qa-index-item .qa-question-text {
    color: #1a1a1a !important;
}

body.light-mode .qa-index-item .qa-answer-text {
    color: rgba(0, 0, 0, 0.65) !important;
}

.qa-index-body {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
}

.qa-index-body::-webkit-scrollbar {
    width: 6px;
}

.qa-index-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.qa-index-body::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

.qa-index-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

.qa-index-item:last-child {
    margin-bottom: 0;
}

/* Mobile Q&A Index */
@media (max-width: 768px) {
    .qa-index-panel {
        width: 95% !important;
        max-height: 85vh !important;
        border-radius: 12px !important;
    }
    
    .qa-index-header {
        padding: 16px !important;
    }
    
    .qa-index-header h3 {
        font-size: 16px !important;
    }
    
    .qa-index-body {
        padding: 12px !important;
    }
    
    .qa-index-item {
        padding: 12px !important;
        margin-bottom: 10px !important;
    }
}
