/* ==========================================
   ArbiMax Design Tokens v2.0 - Single Source of Truth
   Based on Master Design Document Reference
   ========================================== */

:root {
  /* ==========================================
     SURFACES & BACKGROUNDS
     ========================================== */
  --am-bg: #0B0C10;
  --am-bg-grad-from: #0B0C10;
  --am-bg-grad-via: #13111C;  
  --am-bg-grad-to: #0A0510;
  
  /* Glassmorphism System */
  --am-surface-1: rgba(21, 18, 33, 0.6); /* Primary glass surface */
  --am-surface-2: rgba(21, 18, 33, 0.8); /* Higher opacity variant */
  --am-surface-3: #1E1B2E; /* Solid floating elements */
  
  /* ==========================================
     TYPOGRAPHY & TEXT HIERARCHY
     ========================================== */
  --am-text: #FFFFFF;
  --am-text-muted: rgba(255, 255, 255, 0.7);
  --am-text-dim: rgba(255, 255, 255, 0.5);
  --am-text-faint: rgba(255, 255, 255, 0.3);
  
  /* Font Families */
  --am-font-ui: 'Tajawal', sans-serif;
  --am-font-mono: 'Monaco', 'Consolas', monospace;
  
  /* ==========================================
     BORDERS & DIVIDERS (Reference-based)
     ========================================== */
  --am-border-subtle: rgba(255, 255, 255, 0.05);  /* Most cards */
  --am-border: rgba(255, 255, 255, 0.1);          /* Medium emphasis */
  --am-border-strong: rgba(255, 255, 255, 0.2);   /* High emphasis */
  --am-border-accent: rgba(106, 174, 255, 0.25);  /* Soft blue brand borders */
  
  /* ==========================================
     SEMANTIC COLORS (Strict Functional Usage)
     ========================================== */
  --am-cta: #FFFFFF;           /* Primary action buttons ONLY */
  --am-cta-text: #0B0C10;      /* Text on white buttons */
  --am-profit: #10B981;        /* Buy/Profit/Success states */
  --am-loss: #EF4444;          /* Sell/Loss/Error states */
  --am-accent: #6AAEFF;        /* Soft blue brand accent */
  
  /* Semantic Surface Variants */
  --am-profit-bg: rgba(16, 185, 129, 0.1);
  --am-profit-border: rgba(16, 185, 129, 0.2);
  --am-loss-bg: rgba(239, 68, 68, 0.1); 
  --am-loss-border: rgba(239, 68, 68, 0.2);
  --am-accent-bg: rgba(106, 174, 255, 0.1);
  --am-accent-border: rgba(106, 174, 255, 0.2);
  
  /* ==========================================
     SPACING SCALE (8-step authoritative system)
     ========================================== */
  --am-space-0: 0;
  --am-space-1: 0.25rem;     /* 4px */
  --am-space-2: 0.5rem;      /* 8px */
  --am-space-3: 0.75rem;     /* 12px */
  --am-space-4: 1rem;        /* 16px */
  --am-space-5: 1.25rem;     /* 20px */
  --am-space-6: 1.5rem;      /* 24px */
  --am-space-7: 2rem;        /* 32px */
  --am-space-8: 2.5rem;      /* 40px */
  
  /* Legacy aliases for backward compatibility */
  --am-space-xs: var(--am-space-1);
  --am-space-sm: var(--am-space-2);
  --am-space-md: var(--am-space-4);
  --am-space-lg: var(--am-space-6);
  --am-space-xl: var(--am-space-7);
  --am-space-2xl: 3rem;      /* 48px */
  --am-space-3xl: 4rem;      /* 64px */
  --am-space-4xl: 6rem;      /* 96px */
  
  /* Canonical layout tokens */
  --am-page-pad: var(--am-space-7);          /* 32px - Page wrapper padding */
  --am-section-gap: var(--am-space-6);       /* 24px - Spacing between sections */
  --am-card-pad: var(--am-space-6);          /* 24px - Card internal padding */
  --am-list-gap: var(--am-space-3);          /* 12px - Gap between list items */
  --am-control-gap: var(--am-space-2);       /* 8px - Gap between controls/buttons */
  
  /* ==========================================
     BORDER RADIUS SCALE
     ========================================== */
  --am-radius-xs: 0.25rem;   /* 4px */
  --am-radius-sm: 0.5rem;    /* 8px */
  --am-radius-md: 0.75rem;   /* 12px - Nav items */
  --am-radius-lg: 1rem;      /* 16px */
  --am-radius-xl: 1.5rem;    /* 24px - Cards */
  --am-radius-2xl: 2rem;     /* 32px - Large cards */
  --am-radius-full: 9999px;  /* Pills/buttons */
  
  /* ==========================================
     SHADOWS & ELEVATION (Reference Glows)
     ========================================== */
  --am-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
  --am-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --am-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  --am-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  
  /* Glow Effects (Reference-inspired) */
  --am-glow-white: 0 0 20px rgba(255, 255, 255, 0.15);
  --am-glow-white-strong: 0 0 30px rgba(255, 255, 255, 0.4);
  --am-glow-accent: 0 0 20px rgba(106, 174, 255, 0.25);
  --am-glow-profit: 0 0 15px rgba(16, 185, 129, 0.3);
  --am-glow-loss: 0 0 15px rgba(239, 68, 68, 0.3);
  
  /* ==========================================
     SIDEBAR DIMENSIONS
     ========================================== */
  --am-sidebar-width-expanded: 16rem;    /* 256px */
  --am-sidebar-width-collapsed: 4rem;    /* 64px */
  
  /* ==========================================
     Z-INDEX SCALE
     ========================================== */
  --am-z-background: -1;      /* Starfield */
  --am-z-base: 0;
  --am-z-raised: 10;
  --am-z-dropdown: 50;
  --am-z-overlay: 100;
  --am-z-modal: 1000;
  --am-z-toast: 1100;
  --am-z-tooltip: 1200;
  
  /* ==========================================
     MOTION & ANIMATION (Reference Timing)
     ========================================== */
  --am-duration-fast: 150ms;
  --am-duration-normal: 300ms;   /* Reference standard */
  --am-duration-slow: 500ms;
  
  --am-ease: ease-in-out;
  --am-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --am-ease-back: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* ==========================================
     TYPOGRAPHY SCALES (Reference Hierarchy)
     ========================================== */
  --am-text-xs: 0.75rem;     /* 12px - Small details */
  --am-text-sm: 0.875rem;    /* 14px - Secondary text */
  --am-text-base: 1rem;      /* 16px - Body text */
  --am-text-lg: 1.125rem;    /* 18px - Emphasized body */
  --am-text-xl: 1.25rem;     /* 20px - Small headings */
  --am-text-2xl: 1.5rem;     /* 24px - Card titles */
  --am-text-3xl: 1.875rem;   /* 30px - Section headers */
  --am-text-4xl: 2.25rem;    /* 36px - Page titles */
  --am-text-6xl: 3.75rem;    /* 60px - Hero titles */
  
  --am-line-tight: 1.25;
  --am-line-normal: 1.5;
  --am-line-relaxed: 1.75;
  
  --am-font-weight-normal: 400;
  --am-font-weight-medium: 500;
  --am-font-weight-semibold: 600;
  --am-font-weight-bold: 700;
  --am-font-weight-black: 900;
  
  /* ==========================================
     INTERACTIVE STATES
     ========================================== */
  --am-hover-bg: rgba(255, 255, 255, 0.05);
  --am-active-bg: rgba(255, 255, 255, 0.1);
  --am-focus-ring: 0 0 0 2px var(--am-accent);
  
  /* ==========================================
     DATA TABLE SPECIFICS
     ========================================== */
  --am-table-border: var(--am-border-subtle);
  --am-table-hover: rgba(255, 255, 255, 0.05);
  --am-table-header-bg: rgba(255, 255, 255, 0.05);
}
  --am-space-md: 1rem;       /* 16px */
  --am-space-lg: 1.5rem;     /* 24px */
  --am-space-xl: 2rem;       /* 32px */
  --am-space-2xl: 3rem;      /* 48px */
  --am-space-3xl: 4rem;      /* 64px */
  
  /* ==========================================
     BORDER RADIUS
     ========================================== */
  --am-radius-sm: 0.25rem;   /* 4px */
  --am-radius-md: 0.5rem;    /* 8px */
  --am-radius-lg: 0.75rem;   /* 12px */
  --am-radius-xl: 1rem;      /* 16px */
  --am-radius-full: 9999px;
  
  /* ==========================================
     SHADOWS & ELEVATION
     ========================================== */
  --am-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --am-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --am-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --am-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --am-shadow-glow: 0 0 20px rgba(106, 174, 255, 0.25);
  
  /* ==========================================
     Z-INDEX SCALE
     ========================================== */
  --am-z-base: 0;
  --am-z-raised: 10;
  --am-z-overlay: 100;
  --am-z-modal: 1000;
  --am-z-toast: 1100;
  --am-z-tooltip: 1200;
  
  /* ==========================================
     MOTION & ANIMATION
     ========================================== */
  --am-duration-fast: 150ms;
  --am-duration-normal: 200ms;
  --am-duration-slow: 300ms;
  --am-duration-slower: 500ms;
  
  --am-ease: ease;
  --am-ease-in: ease-in;
  --am-ease-out: ease-out;
  --am-ease-in-out: ease-in-out;
  
  /* ==========================================
     TYPOGRAPHY SCALES
     ========================================== */
  --am-text-xs: 0.75rem;     /* 12px */
  --am-text-sm: 0.875rem;    /* 14px */
  --am-text-base: 1rem;      /* 16px */
  --am-text-lg: 1.125rem;    /* 18px */
  --am-text-xl: 1.25rem;     /* 20px */
  --am-text-2xl: 1.5rem;     /* 24px */
  --am-text-3xl: 1.875rem;   /* 30px */
  --am-text-4xl: 2.25rem;    /* 36px */
  
  --am-line-tight: 1.25;
  --am-line-normal: 1.5;
  --am-line-relaxed: 1.75;
  
  --am-font-weight-normal: 400;
  --am-font-weight-medium: 500;
  --am-font-weight-semibold: 600;
  --am-font-weight-bold: 700;
}

/* ==========================================
   DARK THEME (Explicit, future-ready)
   ========================================== */
[data-theme="dark"] {
  /* Inherit all root values - dark is default */
}

/* ==========================================
   GLASSMORPHISM BACKDROP BLUR SUPPORT
   ========================================== */
@supports (backdrop-filter: blur(12px)) {
  .am-glass {
    backdrop-filter: blur(12px);
  }
}

@supports not (backdrop-filter: blur(12px)) {
  .am-glass {
    background-color: var(--am-surface-2); /* Fallback to solid */
  }
}

/* ==========================================
   SCROLLBAR THEMING (Global)
   ========================================== */
::-webkit-scrollbar { 
  width: 6px; 
}
::-webkit-scrollbar-track { 
  background: var(--am-bg); 
}
::-webkit-scrollbar-thumb { 
  background: #2d2a3d; 
  border-radius: 10px; 
}
::-webkit-scrollbar-thumb:hover { 
  background: var(--am-accent); 
}

/* ==========================================
   UTILITY CLASSES FOR DIRECTION
   ========================================== */
.ltr { 
  direction: ltr; 
}
.rtl { 
  direction: rtl; 
}