/* ==========================================================
   💎 PULSE APEX RENAISSANCE (WEALTH TRACKER DNA INFUSED)
   ========================================================== */

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

:root {
    /* 🎨 THE WEALTH CORE PALETTE */
    --bg-main: #090B10; /* Absolute Deep Navy Black */
    --bg-surface: rgba(25, 30, 45, 0.6);
    --bg-accent: rgba(255, 255, 255, 0.03);
    
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    
    --primary: #38BDF8; /* Signature Wealth Cyan */
    --primary-glow: rgba(56, 189, 248, 0.4);
    
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #F43F5E;
    
    /* 🌌 SIGNATURE GRADIENTS */
    --gradient-glow: linear-gradient(135deg, #38BDF8 0%, #818CF8 100%);
    --gradient-card: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.8));
    
    /* 🔮 GLASS EFFECTS */
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-inset: inset 0 1px 1px 0 rgba(255, 255, 255, 0.05);
    --box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --border-radius: 20px;
    
    --font-sans: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   GLOBAL RESET & AMBIANCE
   ========================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(56, 189, 248, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(129, 140, 248, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
}

/* ==========================================
   GLASS COMPONENTRY (THE CARDS)
   ========================================== */
.glass-card, .glass {
    background: var(--gradient-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--box-shadow), var(--glass-inset);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.5), var(--glass-inset);
}

/* ==========================================
   LAYOUT & SIDEBAR
   ========================================== */
.sidebar {
    width: 280px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-right: var(--glass-border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 1000;
    overflow-y: auto; /* 🌊 ACTIVATE SCROLL CAPABILITY */
}

/* 💎 ULTRA-SLIM SIDEBAR SCROLLBAR */
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(56, 189, 248, 0.3); }

.main-content {
    margin-left: 280px;
    padding: 2.5rem 3rem;
    min-height: 100vh;
    animation: fadeIn 0.5s ease-out;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.5rem;
    margin-bottom: 3rem;
    font-weight: 800;
    font-size: 1.5rem;
    background: -webkit-linear-gradient(white, #CBD5E1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand span {
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
    background: rgba(56, 189, 248, 0.1);
    color: var(--primary);
}

.nav-item.active {
    border-left: 3px solid var(--primary);
    border-radius: 0 14px 14px 0;
}

/* ==========================================
   DATA VISUALS & BADGES
   ========================================== */
.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 5px 0;
    background: linear-gradient(180deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(255,255,255,0.05);
}

/* ==========================================
   FORM & INPUT ENGINEERING
   ========================================== */
input, select, textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.4) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    padding: 14px 16px !important;
    border-radius: 12px !important;
    color: #fff !important;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    background: rgba(15, 23, 42, 0.6) !important;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15) !important;
}

label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

button[type="submit"], .pulse-btn, .launch-btn, .btn-action {
    background: var(--gradient-glow);
    color: #fff !important;
    border: none;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.2);
}

button[type="submit"]:hover, .pulse-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(56, 189, 248, 0.4);
}

/* ==========================================
   THE WEALTH TABLES DNA
   ========================================== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: 1rem;
}

th {
    text-align: left;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

td {
    padding: 16px 20px;
    background: rgba(255,255,255,0.02);
    border-top: 1px solid rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-primary);
    font-size: 0.95rem;
    vertical-align: middle;
}

td:first-child {
    border-left: 1px solid rgba(255,255,255,0.03);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

td:last-child {
    border-right: 1px solid rgba(255,255,255,0.03);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

tr:hover td {
    background: rgba(56, 189, 248, 0.05);
    border-color: rgba(56, 189, 248, 0.2);
}

/* ============================================================
   👑 THE SUPREME RESPONSIVENESS (TABLE-TO-CARD CONVERSION)
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 20px 0 60px rgba(0,0,0,0.8);
    }
    .sidebar.menu-open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1.5rem; }
    
    /* Grid Crash Protection: Stack All Modules */
    .dashboard-body, .intake-console, .board-layout, .grid-master, .view-splitter, .admin-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    /* OBLITERATE HORIZONTAL SCROLL FOR TABLES */
    table, thead, tbody, th, td, tr {
        display: block !important;
    }
    
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    tr {
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(255,255,255,0.08) !important;
        border-radius: 16px;
        margin-bottom: 1.5rem;
        padding: 1.25rem;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    }
    
    td {
        border: none !important;
        border-bottom: 1px solid rgba(255,255,255,0.05) !important;
        position: relative;
        padding: 12px 0 !important;
        padding-left: 0% !important;
        text-align: left;
        background: transparent !important;
    }
    
    td:last-child {
        border-bottom: none !important;
    }
    
    /* Title Row in Mobile Cards */
    td:first-child {
        font-weight: 800;
        font-size: 1.1rem;
        color: var(--primary);
        border-bottom: 1px dashed rgba(255,255,255,0.2) !important;
        padding-bottom: 15px !important;
        margin-bottom: 10px !important;
    }
}

/* ==========================================
   DYNAMIC THEME HARMONIZER
   ========================================== */

/* LIGHT THEME SYSTEM (WEALTH POLISH) */
body.theme-light {
    --bg-main: #F1F5F9;
    --bg-surface: #FFFFFF;
    --bg-accent: rgba(0, 0, 0, 0.03);
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --primary: #0284C7;
    --gradient-card: linear-gradient(145deg, #FFFFFF, #F8FAFC);
    --glass-border: 1px solid #E2E8F0;
    --box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    background-image: none;
}

body.theme-light .sidebar { background: #FFFFFF; box-shadow: 2px 0 20px rgba(0,0,0,0.03); }
body.theme-light .brand { background: linear-gradient(to right, #0F172A, #64748B); -webkit-background-clip: text; }
body.theme-light .stat-value { background: #0F172A; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
body.theme-light td { background: #F8FAFC; border-color: #E2E8F0; color: #0F172A; }
body.theme-light td strong, body.theme-light h1, body.theme-light h2, body.theme-light h3 { color: #0F172A !important; }
body.theme-light input, body.theme-light select { background: #fff !important; color: #0f172a !important; border: 1px solid #CBD5E1 !important; }

/* NEBULA PURPLE SYSTEM (WEALTH POLISH) */
body.theme-nebula {
    --bg-main: #0F061A;
    --primary: #A855F7;
    --gradient-glow: linear-gradient(135deg, #A855F7 0%, #EC4899 100%);
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(168, 85, 247, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
}
body.theme-nebula .nav-item:hover, body.theme-nebula .nav-item.active {
    background: rgba(168, 85, 247, 0.1);
    color: var(--primary);
}
body.theme-nebula .nav-item.active { border-color: var(--primary); }

/* ==========================================
   MOBILE BAR & ACCESSORIES
   ========================================== */
.mobile-bar {
    display: none;
    background: rgba(15, 23, 42, 0.98);
    padding: 1rem;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0; z-index: 9999;
    border-bottom: var(--glass-border);
    backdrop-filter: blur(10px);
}

@media (max-width: 1024px) { .mobile-bar { display: flex; } }

.ham-trigger { background:none; border:none; color:#fff; font-size:1.5rem; cursor:pointer; }

/* Modal Popups */
.modal-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center; z-index: 2000;
}
.modal-box {
    background: rgba(30, 41, 59, 0.95); border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    border-radius: 24px; padding: 2.5rem; width: 500px;
}

/* Timeline Upgrades */
.history-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.3s;
}
.history-item:hover { background: rgba(255,255,255,0.04); border-color: var(--primary); }

/* High-Visibility Datepicker */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1); opacity: 0.6; cursor: pointer;
}
body.theme-light input[type="date"]::-webkit-calendar-picker-indicator { filter: none; }

/* ==========================================
   ??? DESKTOP GRID ANCHORS
   ========================================== */
@media (min-width: 1025px) {
    .dashboard-body { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
    .intake-console { display: grid; grid-template-columns: 1fr 400px; gap: 2rem; }
    .board-layout { display: grid; grid-template-columns: 2.5fr 1fr; gap: 2rem; }
    .view-splitter { display: grid; grid-template-columns: 1fr 350px; gap: 2rem; }
    .grid-master { display: grid; grid-template-columns: 360px 1fr; gap: 2rem; }
    .admin-layout { display: grid; grid-template-columns: 1fr 1.8fr; gap: 2.5rem; }
}

/* Custom Dashboard Container Alignment */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ==========================================
   ?? THEME SELECTOR UI POLISH
   ========================================== */
.theme-switcher {
    display: flex;
    gap: 10px;
    background: rgba(0,0,0,0.3);
    padding: 8px;
    border-radius: 25px;
    border: 1px solid rgba(255,255,255,0.08);
    width: fit-content;
    margin-top: auto; /* Push to bottom of sidebar */
}
.theme-dot {
    width: 22px; height: 22px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}
.theme-dot:hover { transform: scale(1.2); }
.theme-dot.active { border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,0.3); }
