/* 
  Gravity Premium UI Styles
  Theme: Dark Mode, Glassmorphism, Modern
*/

/* Utility: hide any element */
.hidden {
    display: none !important;
}

:root {
    /* Colors */
    --bg-base: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --bg-surface-hover: rgba(51, 65, 85, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.5);
    
    --secondary: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Metrics */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --blur: blur(12px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Background Orbs */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.4;
}
.orb-1 {
    top: -10%;
    right: -5%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
}
.orb-2 {
    bottom: -10%;
    left: -10%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
}

/* Layout */
.layout {
    display: flex;
    height: 100vh;
}

/* ─── Sidebar ──────────────────────────── */
.sidebar {
    width: 280px;
    background: var(--bg-surface);
    backdrop-filter: var(--blur);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 48px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-icon svg {
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(30, 42, 74, 0.6);
}

.brand h1 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand p {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.nav-btn i {
    font-size: 1.2rem;
}

.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.05);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.api-key-container label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 600;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}

.input-with-icon input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.input-with-icon input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}
/* ─── Engine Badges ───────────────────────── */
.engine-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.engine-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.01em;
    transition: var(--transition);
}

.engine-badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: var(--transition);
}

.engine-badge.badge-rust .badge-dot {
    background: #f97316;
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.5);
}
.engine-badge.badge-rust {
    color: #fb923c;
    border-color: rgba(249, 115, 22, 0.15);
}

.engine-badge.badge-python .badge-dot {
    background: #3b82f6;
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}
.engine-badge.badge-python {
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.15);
}

.engine-badge.badge-ok .badge-dot {
    background: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}
.engine-badge.badge-ok {
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.15);
}

.engine-badge.badge-warn .badge-dot {
    background: var(--warning);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}
.engine-badge.badge-warn {
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.15);
}

.engine-badge.badge-error .badge-dot {
    background: var(--error);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}
.engine-badge.badge-error {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.15);
}

/* ─── Main Content ────────────────────────── */
.content-area {
    flex-grow: 1;
    padding: 48px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease forwards;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

#aina-tab {
    max-width: 100%;
}

#aina-tab.active {
    flex: 1;
    min-height: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-header {
    margin-bottom: 32px;
}

.tab-header h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.tab-header p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* ─── Search Bar ──────────────────────────── */
.search-bar-container {
    background: var(--bg-surface);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.search-icon {
    position: absolute;
    left: 16px;
    font-size: 1.5rem;
    color: var(--text-muted);
}

#search-query {
    width: 100%;
    padding: 16px 160px 16px 52px;
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

#search-query:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.3);
}

.primary-btn {
    position: absolute;
    right: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.primary-btn:active {
    transform: translateY(1px);
}

.search-options {
    display: flex;
    gap: 24px;
    align-items: center;
}

.search-options label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.search-options input[type="number"],
.search-options select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    outline: none;
    font-family: inherit;
}

/* ─── Loading State ────────────────────────── */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--primary);
    font-weight: 500;
}

.loading-spinner.hidden {
    display: none;
}

.loading-icon {
    font-size: 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* ─── Search Results ──────────────────────── */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--border-color);
}

.result-card {
    background: var(--bg-surface);
    backdrop-filter: var(--blur);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition);
    animation: fadeIn 0.4s ease forwards;
}

.result-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.result-score {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.result-score.score-med {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.result-score.score-low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.2);
}

.result-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.8rem;
}

.meta-badge {
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-muted);
}

.result-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e2e8f0;
    white-space: pre-wrap;
    margin-bottom: 16px;
}

.result-image-preview {
    margin-top: 16px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    max-height: 200px;
    display: flex;
    justify-content: center;
    background: rgba(0,0,0,0.5);
}

.result-image-preview img {
    max-height: 200px;
    max-width: 100%;
    object-fit: contain;
}

/* ─── Upload Zone ─────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    backdrop-filter: var(--blur);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.upload-zone h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.upload-hint {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-card {
    background: var(--bg-surface);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 24px;
}

.status-card.hidden {
    display: none;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary);
}

.code-block {
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow-x: auto;
    white-space: pre-wrap;
}

/* ─── Aïna Chat ──────────────────────────── */

.aina-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    scroll-behavior: smooth;
}

/* Welcome Screen */
.aina-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 40px;
    animation: fadeIn 0.6s ease;
}

.aina-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary), #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    margin-bottom: 24px;
    box-shadow: 0 8px 32px var(--primary-glow);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 8px 32px var(--primary-glow); }
    50% { box-shadow: 0 8px 48px rgba(139, 92, 246, 0.5); }
}

.aina-welcome h2 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary), #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.aina-welcome p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 500px;
}

.aina-suggestions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    flex-wrap: wrap;
    justify-content: center;
}

.suggestion-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-btn:hover {
    border-color: var(--primary);
    color: var(--text-main);
    background: rgba(59, 130, 246, 0.08);
    transform: translateY(-2px);
}

/* Chat Bubbles */
.chat-message {
    display: flex;
    gap: 12px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 4px;
}

.chat-message.assistant .chat-avatar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.chat-message.user .chat-avatar {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.chat-bubble {
    max-width: 80%;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    line-height: 1.6;
    font-size: 0.95rem;
}

.chat-message.user .chat-bubble {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--text-main);
}

.chat-message.assistant .chat-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: #e2e8f0;
}

/* Markdown content in chat */
.chat-bubble h1, .chat-bubble h2, .chat-bubble h3 {
    margin: 16px 0 8px 0;
    color: var(--text-main);
}
.chat-bubble h2 { font-size: 1.2rem; }
.chat-bubble h3 { font-size: 1.05rem; }

.chat-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.85rem;
}

.chat-bubble th, .chat-bubble td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.chat-bubble th {
    background: rgba(59, 130, 246, 0.1);
    font-weight: 600;
    color: var(--primary);
}

.chat-bubble tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.chat-bubble code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: #f472b6;
}

.chat-bubble pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
}

.chat-bubble pre code {
    background: none;
    padding: 0;
    color: #e2e8f0;
}

.chat-bubble ul, .chat-bubble ol {
    margin: 8px 0;
    padding-left: 24px;
}

.chat-bubble li {
    margin: 4px 0;
}

.chat-bubble strong {
    color: var(--text-main);
}

.chat-bubble blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 12px;
    margin: 12px 0;
    color: var(--text-muted);
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* Sources */
.sources-container {
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.sources-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    transition: var(--transition);
}

.sources-toggle:hover { color: var(--primary); }

.sources-list {
    display: none;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sources-list.expanded { display: flex; }

.source-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.05);
}

.source-index {
    background: rgba(59, 130, 246, 0.2);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
}

.source-score {
    margin-left: auto;
    color: var(--success);
    font-weight: 500;
}

/* Chart container */
.chart-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 12px 0;
    max-height: 300px;
}

.chart-container canvas {
    max-height: 260px;
}

/* Chat Input */
.chat-input-area {
    padding: 16px 0 8px 0;
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 8px 8px 16px;
    transition: var(--transition);
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

#aina-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 8px 0;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.chat-input-footer {
    display: flex;
    justify-content: space-between;
    padding: 8px 4px 0 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.provider-indicator, .mode-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Sidebar extras */
.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

.nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
    opacity: 0.5;
}

.sidebar-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    margin-top: 12px;
}

.sidebar-select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.mode-toggle {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.mode-btn {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.mode-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.new-chat-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
}

.new-chat-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.bg-orb.orb-3 {
    top: 40%;
    left: 30%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #ec4899 0%, transparent 70%);
    opacity: 0.15;
}

/* ─── Sources Module ─────────────────────────── */

/* Source Mode Tabs */
.source-modes {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.source-mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.source-mode-btn:hover:not(.disabled) {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.source-mode-btn.active {
    color: var(--text-main);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.1);
}

.source-mode-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.coming-soon-badge {
    font-size: 0.65rem;
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.source-mode-btn i {
    font-size: 1.1rem;
}

/* Source Panels */
.source-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.source-panel.active {
    display: block;
}

/* Folder Picker */
.folder-picker {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
}

.folder-input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.folder-path-field {
    flex: 1;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.folder-path-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.folder-input-row .primary-btn {
    position: static;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.folder-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.folder-browse-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.folder-browse-label:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

/* Scan Results */
.scan-results {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 20px;
}

.scan-results.hidden {
    display: none;
}

.scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 12px;
}

.scan-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.btn-ghost:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.scan-file-list {
    max-height: 400px;
    overflow-y: auto;
}

.scan-file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

.scan-file-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.scan-file-check {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.scan-file-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.scan-file-name {
    flex: 1;
    color: var(--text-main);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-file-size {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
    min-width: 70px;
    text-align: right;
}

.scan-file-type {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
}

/* Progress Bar */
.ingest-progress {
    margin: 12px 0;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 3px;
    transition: width 0.5s ease;
    width: 0%;
    box-shadow: 0 0 8px var(--primary-glow);
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Batch Results */
.batch-results {
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.batch-result-item {
    padding: 6px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Indexed Documents */
.indexed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

.indexed-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.indexed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.indexed-item:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.03);
}

.indexed-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.indexed-name {
    flex: 1;
    color: var(--text-main);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.indexed-chunks {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.1);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.indexed-type {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 50px;
}

.indexed-delete {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    flex-shrink: 0;
}

.indexed-delete:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

/* File Queue (multi-file) */
.file-queue {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.file-queue.hidden {
    display: none;
}

/* ─── Sensitivity Badge ─────────────────────────── */
.sensitivity-badge {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 8px;
    transition: all 0.3s ease;
}

.sensitivity-badge i {
    font-size: 14px;
}

.sensitivity-badge.level-public {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.sensitivity-badge.level-internal {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.sensitivity-badge.level-confidential {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.sensitivity-badge.level-sovereign {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ─── Cloud Status Badge ────────────────────────── */
.cloud-status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
}

/* ─── Pipeline Status Message ───────────────────── */
.pipeline-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Conversation History List ───────────── */
.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    margin-top: 8px;
}

.conversation-list::-webkit-scrollbar {
    width: 4px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.conv-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    min-height: 0;
}

.conv-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.conv-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}

.conv-item-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.conv-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-preview {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.conv-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 0.85rem;
    opacity: 0;
    transition: var(--transition);
    flex-shrink: 0;
}

.conv-item:hover .conv-delete {
    opacity: 1;
}

.conv-delete:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.conv-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 0;
    opacity: 0.6;
}
