/* =============================================================================
   AdminKit — variables.css
   All design tokens for the kit. Editing this file re-themes everything.
   Quick recipes:
     - Re-brand: change --brand-primary and --brand-accent below.
     - Resize sidebar: change --app-sidebar-width.
     - Change density: tweak --space-* scale and --app-header-height.
============================================================================= */

/* -----------------------------------------------------------------------------
   1. Raw palette (rarely consumed directly — feed the semantic layer below)
----------------------------------------------------------------------------- */
:root {
  /* Brand — navy (primary) */
  --navy-900: #0e1a2b;
  --navy-800: #142339;
  --navy-700: #1d3050;
  --navy-600: #2a4368;
  --navy-500: #3d5a82;
  --navy-400: #5a78a0;

  /* Brand — gold (accent) */
  --gold-700: #a98843;
  --gold-600: #b89651;
  --gold-500: #c9a961;
  --gold-400: #d4b975;
  --gold-300: #e0c98b;
  --gold-200: #ecdcb0;

  /* Neutral greys (light mode) */
  --gray-50:  #f8f9fb;
  --gray-100: #f1f3f7;
  --gray-200: #e5e7ee;
  --gray-300: #d1d5dd;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Status colors */
  --status-success: #16a34a;
  --status-success-soft: #dcfce7;
  --status-danger:  #dc2626;
  --status-danger-soft: #fee2e2;
  --status-warning: #d97706;
  --status-warning-soft: #fef3c7;
  --status-info:    #0284c7;
  --status-info-soft: #dbeafe;
}

/* -----------------------------------------------------------------------------
   2. Brand pointers — change these two lines to re-skin the whole kit
----------------------------------------------------------------------------- */
:root {
  --brand-primary:        var(--navy-900);
  --brand-primary-hover:  var(--navy-800);
  --brand-primary-soft:   rgba(14, 26, 43, 0.08);

  --brand-accent:         var(--gold-500);
  --brand-accent-hover:   var(--gold-600);
  --brand-accent-soft:    rgba(201, 169, 97, 0.15);
}

/* -----------------------------------------------------------------------------
   3. Semantic tokens — LIGHT MODE (default)
----------------------------------------------------------------------------- */
:root {
  /* Surfaces */
  --color-bg:           #f4f6fa;
  --color-surface:      #ffffff;
  --color-surface-2:    #f9fafb;
  --color-surface-hover:#f3f4f8;
  --color-border:       #e5e7ee;
  --color-border-strong:#d1d5dd;

  /* Text */
  --color-text:         var(--gray-800);
  /* Was gray-500 and gray-400: the faint one measured 2.6:1 on white, under half the
     contrast a body of text needs. Secondary text is still quieter than the main text,
     just no longer a guess. */
  --color-text-muted:   var(--gray-600);
  --color-text-faint:   var(--gray-500);
  --color-text-inverse: #ffffff;

  /* Links */
  --color-link:         var(--navy-700);
  --color-link-hover:   var(--brand-accent);

  /* Sidebar (always dark — admin convention; overridden in dark mode for consistency) */
  --sidebar-bg:               var(--navy-900);
  --sidebar-bg-elevated:      var(--navy-800);
  --sidebar-text:             #cbd5e1;
  --sidebar-text-muted:       #94a3b8;
  --sidebar-text-active:      #ffffff;
  --sidebar-item-hover:       rgba(255, 255, 255, 0.06);
  --sidebar-item-active:      rgba(201, 169, 97, 0.14);
  --sidebar-strip:            var(--brand-accent);
  --sidebar-border:           rgba(255, 255, 255, 0.06);
  --sidebar-brand-bg:         var(--navy-800);
  --sidebar-org-bg:           linear-gradient(135deg, rgba(201,169,97,0.18), rgba(201,169,97,0.04));
  --sidebar-org-border:       rgba(201, 169, 97, 0.25);

  /* Header */
  --header-bg:          var(--color-surface);
  --header-border:      var(--color-border);
  --header-text:        var(--color-text);

  /* Shadows */
  --shadow-xs:  0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:  0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg:  0 12px 24px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-xl:  0 24px 48px rgba(15, 23, 42, 0.16);

  /* Focus ring */
  --focus-ring: 0 0 0 3px rgba(201, 169, 97, 0.35);

  /* Overlay (sidebar / modal backdrop) */
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --color-scheme: light;
}

/* -----------------------------------------------------------------------------
   4. Semantic tokens — DARK MODE
----------------------------------------------------------------------------- */
[data-theme="dark"] {
  --color-bg:           #0b121d;
  --color-surface:      #131e2e;
  --color-surface-2:    #182438;
  --color-surface-hover:#1d2c44;
  --color-border:       #243349;
  --color-border-strong:#2f4262;

  --color-text:         #e2e8f0;
  --color-text-muted:   #aab8c8;
  --color-text-faint:   #8d9cae;
  --color-text-inverse: var(--navy-900);

  --color-link:         var(--gold-300);
  --color-link-hover:   var(--brand-accent);

  /* Sidebar in dark mode: even deeper navy to differentiate from main bg */
  --sidebar-bg:               #07101c;
  --sidebar-bg-elevated:      #0e1a2b;
  --sidebar-item-hover:       rgba(255, 255, 255, 0.045);
  --sidebar-item-active:      rgba(201, 169, 97, 0.18);

  /* In dark mode, the raw brand-primary (deep navy) blends into the page
     background. Re-point primary to a lighter surface so primary buttons
     and other primary-coloured chrome stay visible. The brand identity
     comes through the accent (gold) anyway. */
  --brand-primary:        #2a4368;
  --brand-primary-hover:  #345080;
  --brand-primary-soft:   rgba(201, 169, 97, 0.10);

  --header-bg:          var(--color-surface);
  --header-border:      var(--color-border);

  --brand-primary-soft: rgba(201, 169, 97, 0.10);

  --status-success-soft: rgba(22, 163, 74, 0.18);
  --status-danger-soft:  rgba(220, 38, 38, 0.18);
  --status-warning-soft: rgba(217, 119, 6, 0.20);
  --status-info-soft:    rgba(2, 132, 199, 0.20);

  --shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 12px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl:  0 24px 48px rgba(0, 0, 0, 0.6);

  --overlay-bg: rgba(0, 0, 0, 0.65);
  --color-scheme: dark;
}

/* -----------------------------------------------------------------------------
   5. Sizing / layout
----------------------------------------------------------------------------- */
:root {
  --app-sidebar-width:        260px;
  --app-sidebar-width-mobile: 280px;
  --app-header-height:        64px;
  --app-mobile-breakpoint:    992px;

  /* Spacing scale (4px base) */
  --space-0:  0;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  32px;
  --space-8:  40px;
  --space-9:  48px;
  --space-10: 64px;

  /* Radii */
  --radius-xs:   3px;
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-pill: 999px;

  /* Type */
  --font-sans: 'Tajawal', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  /* Sized for the people who use this all day: partners and clerks reading case files
     and figures on a desk screen, many of them over fifty. The old scale started at 14px
     and dropped to 12px in the tables, which is where the numbers live — small enough to
     lean in for. Every step moved up, and nothing here is below 15px. */
  --fs-xs:   15px;
  --fs-sm:   16px;
  --fs-base: 17px;
  --fs-md:   18px;
  --fs-lg:   20px;
  --fs-xl:   23px;
  --fs-2xl:  28px;
  --fs-3xl:  35px;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-bold:    700;
  --fw-heavy:   800;

  /* Arabic sits taller than Latin, and loose lines are what tired eyes track best. */
  --lh-tight:   1.3;
  --lh-normal:  1.65;
  --lh-loose:   1.9;

  /* Motion */
  --duration-fast:  120ms;
  --duration:       200ms;
  --duration-slow:  320ms;
  --easing:         cubic-bezier(0.4, 0, 0.2, 1);

  /* Z-index scale */
  --z-base:     1;
  --z-sticky:   50;
  --z-header:   100;
  --z-sidebar:  200;
  --z-overlay:  900;
  --z-modal:    1000;
  --z-toast:    1100;
  --z-tooltip:  1200;
}
