/* Deep Search AI - Professional Design */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Dark Theme (Default) */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --bg-dark: #09090b;
    --bg-panel: #18181b;
    --bg-card: #27272a;
    --bg-hover: #3f3f46;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;
    --border: #27272a;
    --success: #22c55e;
    --warning: #f59e0b;
    --accent: #8b5cf6;
}

/* Light Theme */
[data-theme="light"] {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg-dark: #f8fafc;
    --bg-panel: #ffffff;
    --bg-card: #f1f5f9;
    --bg-hover: #e2e8f0;
    --text: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --warning: #d97706;
    --accent: #7c3aed;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* Navbar */
.navbar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.nav-logo svg {
    color: var(--primary);
}

/* Theme Toggle */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .icon-sun,
[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

.lang-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-selector:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.lang-selector select {
    background: transparent;
    border: none;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.lang-selector select option {
    background: var(--bg-panel);
    color: var(--text);
}

/* Main */
.main-content {
    padding-top: 57px;
    height: 100vh;
}

/* Chat Layout */
.chat-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    height: calc(100vh - 57px);
    flex: 1;
    min-width: 0;
}

/* Chat Panel */
.chat-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    border-right: 1px solid var(--border);
    min-height: 0;
    overflow: hidden;
}

.chat-messages {
    flex: 1 1 0;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
}

/* Messages */
.message {
    display: flex;
    gap: 0.875rem;
    max-width: 80%;
    animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar svg {
    width: 18px;
    height: 18px;
    color: white;
}

.message.user .message-avatar {
    background: var(--bg-card);
}

.message-content {
    background: var(--bg-panel);
    padding: 0.875rem 1rem;
    border-radius: 12px;
    border-top-left-radius: 4px;
    border: 1px solid var(--border);
}

.message.user .message-content {
    background: var(--primary);
    border-color: var(--primary);
    border-radius: 12px;
    border-top-right-radius: 4px;
    color: white;
}

.message.user .message-content p {
    color: white;
}

/* Light mode - user message */
[data-theme="light"] .message.user .message-content {
    background: var(--primary);
    color: white;
}

[data-theme="light"] .message.user .message-avatar {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

[data-theme="light"] .message.user .message-avatar svg {
    color: var(--text);
}

.message-content p {
    margin: 0;
    font-size: 0.9375rem;
}

.message-content h2, .message-content h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.message-content li {
    margin-left: 1.25rem;
    margin-bottom: 0.25rem;
}

/* Thinking */
.thinking-message .message-content {
    background: var(--bg-panel);
}

.thinking-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--warning);
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
}

.thinking-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.thinking-steps {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.thinking-step {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

.thinking-step svg {
    color: var(--success);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Answer */
.answer-text {
    font-size: 0.9375rem;
    line-height: 1.7;
}

.answer-text p {
    margin-bottom: 0.75rem;
}

.sources-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.sources-title {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.sources-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sources-list li {
    margin: 0;
}

.sources-list a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
}

.sources-list a:hover {
    text-decoration: underline;
}

/* Chat Input */
.chat-input-area {
    flex-shrink: 0;
    padding: 1rem 2rem 1.5rem;
    background: var(--bg-dark);
}

.chat-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 0.5rem 0.75rem 0.5rem 1rem;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.chat-form:focus-within {
    border-color: var(--primary);
}

.chat-form textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.9375rem;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 0.5rem 0;
}

.chat-form textarea::placeholder {
    color: var(--text-dim);
}

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

/* Browser Panel - Monitor Style */
.browser-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    padding: 1.5rem 1rem;
    gap: 0;
}

/* Monitor Frame - iMac Style */
.monitor-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 355px;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
}

/* Dark Mode Monitor (Default) */
.monitor-screen {
    background: linear-gradient(145deg, #1a1a1a 0%, #0a0a0a 100%);
    border-radius: 16px 16px 0 0;
    border: 2px solid #2a2a2a;
    border-bottom: none;
    padding: 10px 10px 8px 10px;
    position: relative;
    width: 100%;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 -1px 0 rgba(0,0,0,0.3);
}

.monitor-screen::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #1f1f1f 40%, #0a0a0a 100%);
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

.monitor-screen::after {
    content: '';
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 3px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 4px #22c55e;
    animation: cameraBlink 3s infinite;
}

@keyframes cameraBlink {
    0%, 90%, 100% { opacity: 1; }
    95% { opacity: 0.3; }
}

.monitor-chin {
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 50%, #0f0f0f 100%);
    height: 28px;
    border-radius: 0 0 16px 16px;
    border: 2px solid #2a2a2a;
    border-top: none;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.monitor-chin::before {
    content: 'Deep Search';
    font-size: 0.5rem;
    font-weight: 600;
    color: #3f3f3f;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.monitor-stand {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.monitor-stand-neck {
    width: 60px;
    height: 50px;
    background: linear-gradient(90deg,
        #1a1a1a 0%,
        #3a3a3a 20%,
        #4a4a4a 50%,
        #3a3a3a 80%,
        #1a1a1a 100%
    );
    clip-path: polygon(15% 0%, 85% 0%, 100% 100%, 0% 100%);
    position: relative;
}

.monitor-stand-neck::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
}

.monitor-stand-base {
    width: 120px;
    height: 12px;
    background: linear-gradient(180deg, #3a3a3a 0%, #1a1a1a 100%);
    border-radius: 2px 2px 6px 6px;
    box-shadow:
        0 2px 4px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.05);
}

/* Light Mode Monitor */
[data-theme="light"] .monitor-frame {
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.15));
}

[data-theme="light"] .monitor-screen {
    background: linear-gradient(145deg, #e8e8e8 0%, #d4d4d4 100%);
    border-color: #c0c0c0;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.8),
        0 -1px 0 rgba(0,0,0,0.1);
}

[data-theme="light"] .monitor-screen::before {
    background: radial-gradient(circle, #c0c0c0 40%, #a0a0a0 100%);
}

[data-theme="light"] .monitor-chin {
    background: linear-gradient(180deg, #d4d4d4 0%, #c0c0c0 50%, #b0b0b0 100%);
    border-color: #c0c0c0;
}

[data-theme="light"] .monitor-chin::before {
    color: #888;
}

[data-theme="light"] .monitor-stand-neck {
    background: linear-gradient(90deg,
        #c0c0c0 0%,
        #d8d8d8 20%,
        #e8e8e8 50%,
        #d8d8d8 80%,
        #c0c0c0 100%
    );
}

[data-theme="light"] .monitor-stand-neck::after {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
}

[data-theme="light"] .monitor-stand-base {
    background: linear-gradient(180deg, #d8d8d8 0%, #c0c0c0 100%);
    box-shadow:
        0 2px 4px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

/* Screen Content - Dark Mode (Default) */
.screen-content {
    background: #0f0f0f;
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        inset 0 0 30px rgba(0,0,0,0.5),
        0 0 1px rgba(255,255,255,0.1);
}

.browser-header {
    padding: 0.5rem 0.625rem;
    background: linear-gradient(180deg, #1e1e1e 0%, #161616 100%);
    border-bottom: 1px solid #2a2a2a;
}

.browser-title {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.625rem;
    font-weight: 500;
    color: #888;
    margin-bottom: 0.375rem;
}

.browser-title svg {
    color: var(--primary);
    width: 10px;
    height: 10px;
}

.browser-url {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: #0a0a0a;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    font-size: 0.5625rem;
    color: #666;
    border: 1px solid #222;
}

.browser-url svg {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    opacity: 0.6;
}

.url-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browser-content {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #0a0a0a 0%, #050505 100%);
    overflow: hidden;
    position: relative;
}

.browser-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.03) 2px,
            rgba(0,0,0,0.03) 4px
        );
    pointer-events: none;
}

.browser-placeholder {
    text-align: center;
    color: #444;
}

.browser-placeholder svg {
    opacity: 0.2;
    margin-bottom: 0.5rem;
    width: 28px;
    height: 28px;
}

.browser-placeholder p {
    font-size: 0.625rem;
}

.browser-screenshot {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.browser-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.625rem;
    background: linear-gradient(180deg, #161616 0%, #1e1e1e 100%);
    border-top: 1px solid #2a2a2a;
    font-size: 0.5625rem;
    color: #666;
}

.browser-status svg {
    color: var(--primary);
    width: 10px;
    height: 10px;
}

/* Screen Content - Light Mode */
[data-theme="light"] .screen-content {
    background: #ffffff;
    box-shadow:
        inset 0 0 20px rgba(0,0,0,0.05),
        0 0 1px rgba(0,0,0,0.2);
}

[data-theme="light"] .browser-header {
    background: linear-gradient(180deg, #f8f8f8 0%, #f0f0f0 100%);
    border-bottom: 1px solid #e0e0e0;
}

[data-theme="light"] .browser-title {
    color: #666;
}

[data-theme="light"] .browser-url {
    background: #ffffff;
    color: #888;
    border-color: #e0e0e0;
}

[data-theme="light"] .browser-content {
    background: linear-gradient(180deg, #fafafa 0%, #f5f5f5 100%);
}

[data-theme="light"] .browser-content::before {
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0,0,0,0.01) 2px,
            rgba(0,0,0,0.01) 4px
        );
}

[data-theme="light"] .browser-placeholder {
    color: #aaa;
}

[data-theme="light"] .browser-placeholder svg {
    opacity: 0.3;
}

[data-theme="light"] .browser-status {
    background: linear-gradient(180deg, #f0f0f0 0%, #f8f8f8 100%);
    border-top: 1px solid #e0e0e0;
    color: #888;
}

/* Keyboard - Dark Mode (Default) */
.keyboard-frame {
    position: relative;
    width: 100%;
    max-width: 355px;
    margin-top: 1rem;
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 10px;
    padding: 10px 12px 12px 12px;
    box-shadow:
        0 4px 12px rgba(0,0,0,0.4),
        0 1px 3px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1),
        inset 0 -1px 0 rgba(0,0,0,0.3);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
}

.keyboard-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 3px;
}

/* Dark Mode Keys */
.key {
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    border-radius: 4px;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    font-weight: 500;
    color: #ccc;
    box-shadow:
        0 1px 0 #1a1a1a,
        0 2px 3px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all 0.1s ease;
    cursor: pointer;
    user-select: none;
}

.key:hover {
    background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
}

.key:active {
    transform: translateY(1px);
    box-shadow:
        0 0 0 #1a1a1a,
        0 1px 2px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.key.wide {
    min-width: 34px;
    font-size: 0.4375rem;
}

.key.extra-wide {
    min-width: 44px;
    font-size: 0.4375rem;
}

.key.space {
    min-width: 110px;
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
}

.key.fn {
    background: linear-gradient(180deg, #1f1f1f 0%, #0f0f0f 100%);
    color: #888;
    box-shadow:
        0 1px 0 #0a0a0a,
        0 2px 3px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.05);
}

.key.active {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow:
        0 0 8px var(--primary),
        0 1px 0 var(--primary-dark),
        inset 0 1px 0 rgba(255,255,255,0.2);
    animation: keyGlow 0.3s ease;
}

@keyframes keyGlow {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* Power indicator on keyboard */
.keyboard-frame::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 12px;
    width: 4px;
    height: 4px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 4px #22c55e;
}

/* Keyboard - Light Mode */
[data-theme="light"] .keyboard-frame {
    background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%);
    box-shadow:
        0 4px 12px rgba(0,0,0,0.15),
        0 1px 3px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.9),
        inset 0 -1px 0 rgba(0,0,0,0.05);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

[data-theme="light"] .key {
    background: linear-gradient(180deg, #fafafa 0%, #f0f0f0 100%);
    color: #333;
    box-shadow:
        0 1px 0 #c0c0c0,
        0 2px 3px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.9);
}

[data-theme="light"] .key:hover {
    background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
}

[data-theme="light"] .key:active {
    box-shadow:
        0 0 0 #c0c0c0,
        0 1px 2px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.9);
}

[data-theme="light"] .key.space {
    background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%);
}

[data-theme="light"] .key.fn {
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    color: #ccc;
    box-shadow:
        0 1px 0 #1a1a1a,
        0 2px 3px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Responsive */
@media (max-width: 1280px) {
    .history-sidebar {
        width: 220px;
    }
    .chat-layout {
        grid-template-columns: 1fr 340px;
    }
}

@media (max-width: 1100px) {
    .history-sidebar {
        width: 200px;
    }
    .chat-layout {
        grid-template-columns: 1fr 300px;
    }
    .monitor-frame {
        max-width: 280px;
    }
    .keyboard-frame {
        max-width: 280px;
    }
}

@media (max-width: 900px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
    .browser-panel {
        display: none;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

/* ==================== App Layout with Sidebar ==================== */

.app-layout {
    display: flex;
    height: calc(100vh - 57px);
    width: 100%;
}

/* History Sidebar */
.history-sidebar {
    width: 260px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: width 0.3s ease, margin-left 0.3s ease;
}

.history-sidebar.collapsed {
    width: 0;
    border-right: none;
}

.history-sidebar.collapsed .sidebar-header,
.history-sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: var(--primary-dark);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
    position: relative;
}

.history-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.history-item.active {
    background: var(--bg-card);
    color: var(--text);
}

.history-item svg {
    flex-shrink: 0;
}

.history-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
}

.history-delete {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.history-item:hover .history-delete {
    opacity: 1;
}

.history-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.history-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8125rem;
}

.history-guest {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-dim);
}

.history-guest svg {
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.history-guest p {
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.history-guest span {
    font-size: 0.75rem;
}

.history-loading {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-dim);
}

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    z-index: 10;
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.history-sidebar.collapsed .sidebar-toggle {
    right: -32px;
    width: 32px;
    height: 48px;
    border-radius: 0 8px 8px 0;
    background: var(--primary);
    color: white;
    border: none;
}

.history-sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* ==================== Nav Auth Buttons ==================== */

.nav-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.login-btn {
    background: var(--primary);
    color: white;
}

.login-btn:hover {
    background: var(--primary-dark);
}

.logout-btn {
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.logout-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ==================== Auth Pages ==================== */

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 57px);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    color: var(--primary);
    margin-bottom: 1rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input {
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9375rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.auth-submit {
    margin-top: 0.5rem;
    padding: 0.875rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-submit:hover {
    background: var(--primary-dark);
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    margin-left: 0.25rem;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ==================== Thinking Steps Completed State ==================== */

.message.completed .thinking-header {
    color: var(--success);
}

.message.completed .thinking-header.completed {
    cursor: pointer;
}

.message.completed .thinking-steps {
    max-height: 100px;
    overflow-y: auto;
    opacity: 0.7;
    transition: all 0.3s;
}

.message.completed:hover .thinking-steps {
    opacity: 1;
}

/* ==================== Streaming Answer ==================== */

.streaming-answer .answer-text::after {
    content: '|';
    animation: blink 0.7s infinite;
    color: var(--primary);
    font-weight: 400;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ==================== Detected Topics ==================== */

.detected-topics {
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.topics-header {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.topics-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.topic-tag {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: var(--bg-hover);
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==================== Follow-up Questions ==================== */

.followup-questions {
    margin: 1rem 0;
    padding: 1rem;
    background: var(--bg-panel);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.followup-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.followup-header svg {
    color: var(--accent);
}

.followup-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.followup-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.followup-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

/* ==================== Responsive Updates ==================== */

@media (max-width: 900px) {
    .history-sidebar {
        position: fixed;
        left: 0;
        top: 57px;
        height: calc(100vh - 57px);
        z-index: 50;
        transform: translateX(-100%);
    }

    .history-sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .sidebar-toggle {
        right: -36px;
    }
}

@media (max-width: 768px) {
    .nav-actions {
        gap: 0.5rem;
    }

    .user-name {
        display: none;
    }
}
