/* =====================================================
   BASE.CSS — Variables, Reset, Scrollbars, Typography
   ===================================================== */

/* =====================================================
   1. CSS VARIABLES & THEME
   ===================================================== */
:root {
    /* Colors */
    --bg-color: #F0F2F5;
    --sidebar-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --text-primary: #1A1A1A;
    --text-secondary: #65676B;
    --accent-blue: #1877F2;
    --accent-blue-light: #EBF5FF;
    --accent-dark: #1d4ed8;

    /* Status Colors */
    --status-green-bg: #F0FDF4;
    --status-green-text: #15803D;
    --status-red-bg: #FEF2F2;
    --status-red-text: #B91C1C;

    /* UI */
    --border-color: #E4E6EB;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.04), 0 12px 30px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.25);

    /* Layout */
    --header-height: 64px;
    --sidebar-width: 300px;
    --max-content-width: 1400px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
}

/* =====================================================
   2. RESET & BASE
   ===================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: auto;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(180deg, #f4f7fb 0%, #ecf3ff 100%);
    color: var(--text-primary);
}

body {
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(24, 119, 242, 0.09), transparent 18%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.06), transparent 20%);
    pointer-events: none;
    z-index: -1;
}

/* =====================================================
   3. SCROLLBARS
   ===================================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* =====================================================
   4. UTILITY CLASSES
   ===================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ── Mobile overflow fix ── */
@media (max-width: 768px) {
    html, body { overflow-x: hidden; }
    .main-content { overflow-x: hidden; }
}

/* =====================================================
   5. DARK MODE — body.dark overrides
   Applied via JS (profile toggle) + localStorage
   ===================================================== */
body.dark {
    /* Colors */
    --bg-color:           #0F172A;
    --sidebar-bg:         #1E293B;
    --card-bg:            #1E293B;
    --text-primary:       #F1F5F9;
    --text-secondary:     #94A3B8;
    --accent-blue:        #3B82F6;
    --accent-blue-light:  #1E3A5F;
    --accent-dark:        #2563EB;

    /* Status Colors */
    --status-green-bg:    #052e16;
    --status-green-text:  #4ADE80;
    --status-red-bg:      #2D0A0A;
    --status-red-text:    #F87171;

    /* UI */
    --border-color:       #334155;
    --shadow-sm:          0 2px 4px rgba(0,0,0,0.3);
    --shadow-md:          0 4px 6px rgba(0,0,0,0.3), 0 12px 30px rgba(0,0,0,0.4);
    --shadow-lg:          0 20px 60px rgba(0,0,0,0.6);
}

/* Dark scrollbar */
body.dark ::-webkit-scrollbar-thumb       { background: #475569; }
body.dark ::-webkit-scrollbar-thumb:hover { background: #64748B; }

/* =====================================================
   6. SKELETON / SHIMMER — used on loading states
   ===================================================== */
@keyframes shimmer {
    0%   { background-position: -800px 0; }
    100% { background-position:  800px 0; }
}
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}
body.dark .skeleton {
    background: linear-gradient(90deg, #1E293B 25%, #273549 50%, #1E293B 75%);
    background-size: 800px 100%;
}

/* =====================================================
   7. PRICE FLASH ANIMATIONS
   ===================================================== */
@keyframes flashUp {
    0%   { background-color: #dcfce7; }
    100% { background-color: transparent; }
}
@keyframes flashDown {
    0%   { background-color: #fee2e2; }
    100% { background-color: transparent; }
}
.flash-up   { animation: flashUp   0.6s ease-out; }
.flash-down { animation: flashDown 0.6s ease-out; }

body.dark .flash-up   { animation: none; color: #4ADE80; }
body.dark .flash-down { animation: none; color: #F87171; }
