/* ==========================================================================
   FoundersPath AI — Billion-Dollar Design System v3.0
   Author: Venu Karnati · Powered By: Vebnox · Sponsored By: IETX.ORG
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@400;600;700;800;900&display=swap');

/* ==========================================================================
   CSS Custom Properties — Design Tokens
   ========================================================================== */
:root {
    /* === Brand Colors === */
    --accent: #019cd4;
    --accent-light: rgba(1, 156, 212, 0.12);
    --accent-mid: rgba(1, 156, 212, 0.25);
    --accent-border: rgba(1, 156, 212, 0.2);
    --accent-glow: 0 0 32px rgba(1, 156, 212, 0.25);
    --accent-glow-sm: 0 0 12px rgba(1, 156, 212, 0.15);

    /* === Gradients === */
    --gradient-brand: linear-gradient(135deg, #019cd4 0%, #017ca9 100%);
    --gradient-brand-soft: linear-gradient(135deg, rgba(1, 156, 212, 0.15) 0%, rgba(1, 94, 127, 0.08) 100%);

    /* === Background === */
    --bg-base: #000000;
    --bg-surface: #0a0a0a;
    --bg-card: #111111;
    --bg-card-hover: #171717;
    --bg-elevated: #1a1a1a;
    --bg-input: #0f0f0f;
    --bg-hover: rgba(255, 255, 255, 0.04);
    --bg-active: rgba(1, 156, 212, 0.1);

    /* === Glass === */
    --glass: rgba(10, 10, 10, 0.85);
    --glass-blur: blur(20px) saturate(180%);
    --glass-blur-sm: blur(10px);

    /* === Text === */
    --text-1: #ffffff;
    --text-2: #d4d4d4;
    --text-3: #888888;
    --text-4: #444444;
    --text-accent: var(--accent);

    /* === Borders === */
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);
    --border-accent: rgba(1, 156, 212, 0.25);
    --border-focus: var(--accent);

    /* === Semantic Colors === */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #019cd4;
    --info-bg: rgba(1, 156, 212, 0.1);

    /* === Typography === */
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', 'Inter', sans-serif;
    --text-2xs: 10px;
    --text-xs: 11px;
    --text-sm: 12px;
    --text-base: 13px;
    --text-md: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 22px;
    --text-3xl: 28px;
    --text-4xl: 36px;

    /* === Spacing (8px grid) === */
    --s1: 4px;   --s2: 8px;   --s3: 12px;
    --s4: 16px;  --s5: 20px;  --s6: 24px;
    --s7: 28px;  --s8: 32px;  --s10: 40px;
    --s12: 48px; --s16: 64px;

    /* === Radius === */
    --r-xs: 4px; --r-sm: 6px; --r-md: 10px;
    --r-lg: 14px; --r-xl: 18px; --r-2xl: 24px; --r-full: 9999px;

    /* === Shadows === */
    --shadow-xs: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.55);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.65);
    --shadow-xl: 0 16px 60px rgba(0,0,0,0.75);
    --shadow-card: 0 1px 0 rgba(255,255,255,0.04), 0 4px 24px rgba(0,0,0,0.4);

    /* === Transitions === */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --t-fast: 140ms;
    --t: 220ms;
    --t-slow: 380ms;

    /* === Layout === */
    --sidebar-w: 248px;
    --topbar-h: 60px;
    --mobile-nav-h: 64px;
}

/* === Light Theme === */
[data-theme="light"] {
    --bg-base: #f7f7f8;
    --bg-surface: #efefef;
    --bg-card: #ffffff;
    --bg-card-hover: #f9f9f9;
    --bg-elevated: #ffffff;
    --bg-input: #f5f5f5;
    --bg-hover: rgba(0, 0, 0, 0.03);
    --bg-active: rgba(1, 156, 212, 0.08);
    --glass: rgba(255, 255, 255, 0.9);
    --text-1: #0a0a0a;
    --text-2: #3d3d3d;
    --text-3: #6b6b6b;
    --text-4: #aaaaaa;
    --border: rgba(0, 0, 0, 0.07);
    --border-strong: rgba(0, 0, 0, 0.13);
    --shadow-card: 0 1px 0 rgba(0,0,0,0.04), 0 4px 24px rgba(0,0,0,0.08);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--text-1);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    transition: background var(--t) var(--ease), color var(--t) var(--ease);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--t-fast) var(--ease);
}
a:hover { color: #4db9dc; }

ul, ol { list-style: none; }

/* ==========================================================================
   Scrollbars
   ========================================================================== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-1);
    margin-bottom: var(--s2);
    letter-spacing: -0.02em;
}
h1 { font-size: var(--text-2xl); font-weight: 800; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p {
    margin-bottom: var(--s3);
    color: var(--text-3);
    font-size: var(--text-sm);
    line-height: 1.6;
}
p:last-child { margin-bottom: 0; }

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

/* ==========================================================================
   App Shell Layout
   ========================================================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 40;
    background: var(--glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: transform var(--t) var(--ease-out);
}

/* === Main Content === */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* === Topbar === */
.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--s5);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 30;
    gap: var(--s3);
    background: var(--glass);
    backdrop-filter: var(--glass-blur-sm);
    -webkit-backdrop-filter: var(--glass-blur-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--s2);
    min-width: 0;
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--s2);
    flex-shrink: 0;
}

/* === View Container === */
.view-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding: var(--s6);
    padding-bottom: var(--s10);
    scroll-padding-top: var(--s4);
}

/* === Views === */
.view { display: none !important; }
.view.active {
    display: block !important;
    visibility: visible !important;
    animation: viewIn 200ms var(--ease-out) forwards;
}

/* Modals / overlays */
.hidden { display: none !important; }
.modal-overlay { display: flex; }
.modal-overlay.hidden { display: none !important; }
.daily-popup-overlay { display: flex; }
.daily-popup-overlay.hidden { display: none !important; }

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

/* === View Headers === */
.view-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--s6);
    gap: var(--s4);
    flex-wrap: wrap;
    padding-bottom: var(--s5);
    border-bottom: 1px solid var(--border);
}

.view-header h1 {
    margin-bottom: 3px;
    font-size: var(--text-2xl);
    font-weight: 800;
}
.view-header p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-3);
    max-width: 480px;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.loading-overlay {
    position: fixed; inset: 0;
    background: var(--bg-base);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    flex-direction: column; gap: var(--s4);
    transition: opacity 0.5s var(--ease);
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-content { display: flex; flex-direction: column; align-items: center; gap: var(--s3); }
.loading-bar {
    width: 120px; height: 2px; background: var(--border);
    border-radius: var(--r-full); overflow: hidden; margin-top: var(--s2);
}
.loading-bar-inner {
    height: 100%; width: 40%;
    background: var(--gradient-brand);
    border-radius: var(--r-full);
    animation: loadingSlide 1.2s ease-in-out infinite;
}
@keyframes loadingSlide {
    0% { transform: translateX(-200%); }
    100% { transform: translateX(400%); }
}

/* ==========================================================================
   Responsive — Mobile
   ========================================================================== */
.hamburger { display: none; }
.sidebar-close { display: none; }
.sidebar-overlay { display: none; }
.mobile-bottom-nav { display: none; }

@media (max-width: 767px) {
    body { overflow: hidden; }
    .hamburger { display: flex; }
    .sidebar-close { display: flex; }

    .sidebar-overlay {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(6px);
        z-index: 39;
    }
    .sidebar-overlay.hidden { display: none; }

    .sidebar {
        position: fixed; top: 0; left: 0; height: 100%;
        transform: translateX(-100%);
        z-index: 50;
        width: min(300px, 85vw);
        box-shadow: var(--shadow-xl);
    }
    .sidebar.open { transform: translateX(0); }

    .view-container {
        padding: var(--s4);
        padding-bottom: calc(var(--mobile-nav-h) + var(--s4));
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed; bottom: 0; left: 0; right: 0;
        height: var(--mobile-nav-h);
        background: var(--glass);
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
        border-top: 1px solid var(--border);
        z-index: 35;
        align-items: stretch;
    }

    .mobile-nav-item {
        display: flex; flex-direction: column;
        align-items: center; justify-content: center;
        flex: 1; gap: 3px;
        color: var(--text-3);
        font-size: 9px; font-weight: 500;
        padding: 8px 4px;
        transition: color var(--t-fast);
        text-decoration: none;
    }
    .mobile-nav-item.active { color: var(--accent); }
    .mobile-nav-item svg { stroke: currentColor; }

    .main-content {
        height: 100vh;
        padding-bottom: var(--mobile-nav-h);
    }

    .view-header { flex-direction: column; align-items: flex-start; }
    .topbar-actions .btn span { display: none; }
    .topbar-actions .btn svg { margin: 0; }
}

@media (min-width: 768px) and (max-width: 1023px) {
    :root { --sidebar-w: 210px; }
    .view-container { padding: var(--s4) var(--s5); }
}

/* ==========================================================================
   Spinner animation
   ========================================================================== */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }
