/* ============================================================
   VBPL-AI — Global Design System
   ============================================================ */

/* ── Dark mode (default) ─────────────────────────────────── */
:root {
    --bg-dark:        #080d1a;
    --bg-surface:     #0f1629;
    --bg-card:        #151e33;
    --bg-card-hover:  #1c2740;
    --bg-input:       #111827;
    --border:         rgba(255,255,255,0.07);
    --border-light:   rgba(255,255,255,0.12);

    --primary:        #3b82f6;
    --primary-dark:   #2563eb;
    --primary-light:  #60a5fa;
    --accent:         #8b5cf6;
    --accent-light:   #a78bfa;
    --gold:           #f59e0b;
    --success:        #10b981;
    --danger:         #ef4444;

    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #475569;

    --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --gradient-gold:    linear-gradient(135deg, #f59e0b, #ef4444);

    --radius-sm:  6px;
    --radius:     12px;
    --radius-lg:  20px;
    --radius-xl:  28px;

    --shadow-sm:  0 2px 8px rgba(0,0,0,0.4);
    --shadow:     0 8px 32px rgba(0,0,0,0.5);
    --shadow-lg:  0 24px 64px rgba(0,0,0,0.6);

    --topbar-h:   64px;
    --sidebar-w:  280px;
    --transition: 0.2s ease;
}

/* ── Light mode override ─────────────────────────────────── */
html.light {
    --bg-dark:        #f8fafc;
    --bg-surface:     #f1f5f9;
    --bg-card:        #ffffff;
    --bg-card-hover:  #f8fafc;
    --bg-input:       #ffffff;
    --border:         rgba(0,0,0,0.08);
    --border-light:   rgba(0,0,0,0.14);
    --text-primary:   #0f172a;
    --text-secondary: #334155;
    --text-muted:     #64748b;
    --shadow-sm:      0 2px 8px rgba(0,0,0,0.08);
    --shadow:         0 8px 32px rgba(0,0,0,0.12);
    --shadow-lg:      0 24px 64px rgba(0,0,0,0.16);
}
/* Light-mode adjustments for hardcoded colors */
html.light .topbar {
    background: rgba(248,250,252,0.94);
}
html.light .topbar-link:hover,
html.light .topbar-link.active {
    background: rgba(0,0,0,0.05);
}
html.light .hero-bg-glow {
    background: radial-gradient(ellipse at center, rgba(59,130,246,0.08) 0%, rgba(139,92,246,0.04) 40%, transparent 70%);
}
html.light .badge-type { background: rgba(59,130,246,0.08); }
html.light .badge-number { background: rgba(139,92,246,0.07); }
html.light .stat-card { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }

/* ── Theme toggle ────────────────────────────────────────── */
.theme-toggle {
    width: 38px; height: 38px;
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text-primary); border-color: var(--primary); background: rgba(59,130,246,0.06); }
.theme-toggle svg { width: 18px; height: 18px; }
/* Hide moon in light mode, hide sun in dark mode */
html.light .icon-moon { display: none; }
.icon-sun { display: none; }
html.light .icon-sun { display: block; }

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Be Vietnam Pro', 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: rgba(8,13,26,0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    padding: 0 20px;
    gap: 12px;
    z-index: 100;
    transition: background var(--transition);
    overflow: hidden;
}

.topbar-brand { display: flex; align-items: center; gap: 10px; }

.topbar-logo {
    width: 36px; height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: white;
}
.topbar-logo svg { width: 20px; height: 20px; }

.topbar-title {
    font-size: clamp(0.82rem, 1.2vw, 1.1rem);
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
    white-space: nowrap;
    flex-shrink: 0;
}
.topbar-title span { color: var(--primary-light); }

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

.topbar-link {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color var(--transition), background var(--transition);
}
.topbar-link:hover, .topbar-link.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}
.topbar-link.active { color: var(--primary-light); }

.topbar-actions { margin-left: 8px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
}
.btn-primary-sm:hover { opacity: 0.88; transform: translateY(-1px); }

.btn-secondary-sm {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-secondary-sm:hover { color: var(--text-primary); border-color: var(--primary); }

.btn-copy-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-copy-link:hover { color: var(--text-primary); border-color: var(--primary); background: rgba(59,130,246,0.06); }

/* ── Badge ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-type { background: rgba(59,130,246,0.15); color: var(--primary-light); border: 1px solid rgba(59,130,246,0.3); }
.badge-number { background: rgba(139,92,246,0.12); color: var(--accent-light); border: 1px solid rgba(139,92,246,0.25); }

/* ── Layout ──────────────────────────────────────────────── */
.app-layout {
    display: flex;
    margin-top: var(--topbar-h);
    min-height: calc(100vh - var(--topbar-h));
    flex: 1;
}

.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 32px 24px;
    margin-top: auto;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 48px;
    flex-wrap: wrap;
    align-items: flex-start;
}
.footer-brand .footer-logo { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.footer-logo span { color: var(--primary-light); }
.footer-brand p { font-size: 0.82rem; color: var(--text-muted); margin-top: 6px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: 0.85rem; color: var(--text-secondary); transition: color var(--transition); }
.footer-links a:hover { color: var(--primary-light); }
.footer-note p { font-size: 0.78rem; color: var(--text-muted); line-height: 1.6; }
.footer-note a { color: var(--text-secondary); }
.footer-note a:hover { color: var(--primary-light); }

/* ── Hero Section ────────────────────────────────────────── */
.hero-section {
    position: relative;
    min-height: 82vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 80px 24px 48px;
}

.hero-bg-glow {
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(ellipse at center, rgba(59,130,246,0.12) 0%, rgba(139,92,246,0.06) 40%, transparent 70%);
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-block;
    padding: 6px 18px;
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: 100px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-light);
    letter-spacing: 0.5px;
    margin-bottom: 24px;
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -1px;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 36px;
}

.hero-search-bar {
    display: flex;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 48px;
    box-shadow: 0 0 0 4px rgba(59,130,246,0.06);
}
.hero-search-bar input {
    flex: 1;
    padding: 16px 24px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}
.hero-search-bar input::placeholder { color: var(--text-muted); }
.hero-search-bar button {
    padding: 14px 28px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
    font-family: inherit;
}
.hero-search-bar button:hover { opacity: 0.88; }

/* ── Hero search wrapper + autocomplete dropdown ─────── */
.hero-search-wrapper {
    position: relative;
    margin-bottom: 48px;
}

.hero-search-wrapper .hero-search-bar {
    margin-bottom: 0;
}

.hero-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 500;
    overflow: hidden;
    animation: dropdownIn 0.15s ease;
    text-align: left; /* override hero-content center */
}

.hero-autocomplete-dropdown:empty { display: none; }

.hero-ac-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.hero-ac-item:last-child { border-bottom: none; }

.hero-ac-item:hover,
.hero-ac-item.focused {
    background: rgba(59,130,246,0.07);
}

.hero-ac-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.hero-ac-text { flex: 1; min-width: 0; }

.hero-ac-title {
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.hero-ac-title mark {
    background: transparent;
    color: var(--primary-light);
    font-weight: 700;
}

.hero-ac-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.hero-ac-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(59,130,246,0.12);
    color: var(--primary-light);
    white-space: nowrap;
}

html.light .hero-autocomplete-dropdown {
    background: rgba(255,255,255,0.97);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.hero-action-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: left;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.hero-action-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition);
}
.hero-action-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.hero-action-card:hover::before { opacity: 0.04; }

#action-chat .action-icon { background: rgba(139,92,246,0.15); color: var(--accent-light); }
#action-chat:hover { border-color: var(--accent); }

.action-icon {
    width: 48px; height: 48px;
    background: rgba(59,130,246,0.12);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--primary-light);
    flex-shrink: 0;
}
.action-icon svg { width: 22px; height: 22px; }
.action-info { flex: 1; }
.action-info h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.action-info p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }
.action-arrow { color: var(--text-muted); font-size: 1.2rem; transition: transform var(--transition); }
.hero-action-card:hover .action-arrow { transform: translateX(4px); color: var(--primary-light); }

/* ── Stats section ───────────────────────────────────────── */
.stats-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 0 24px 64px;
    max-width: 960px;
    margin: 0 auto;
    width: 100%;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}
.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}
.stat-label { font-size: 0.82rem; color: var(--text-secondary); }

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* doc styles → static/css/document.css */

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .hero-actions { grid-template-columns: 1fr; }
    .stats-section { grid-template-columns: repeat(2, 1fr); }
    .topbar-nav { display: none; }
}
