/* ============================================================
   DAS tokens.css — CSS Custom Property Foundation
   DAS-003 · extended by REDESIGN Phase 1 (see UI_REDESIGN_PLAN.md)

   THEMING STRATEGY
   ────────────────
   :root defines the light baseline AND the internal --dark-*
   value set (single source of truth for every dark value in
   the app — theme_system.css, components.css and base.html
   reference these, never literal hex).

   Scope mapping (.das-dark / .das-theme-* / html.dark) lives
   in theme_system.css.

   Full token reference: static/css/TOKENS.md
   ============================================================ */


/* ── Light baseline + shared constants ─────────────────────────────────── */
:root {

  /* Backgrounds — surface elevation ladder (0 = page, 3 = popover) */
  --bg:              #F6F7FB;
  --surface-0:       #F6F7FB;
  --surface-1:       #ffffff;
  --surface-2:       #f4f4f8;
  --surface-3:       #e8e8ef;
  --surface-overlay: #ffffff;
  --scrim:           rgba(9, 11, 20, 0.45);

  /* Borders */
  --border:        #e2e2ea;
  --border-strong: #c8c8d8;

  /* Brand primary */
  --primary:       #6D5BFF;
  --primary-soft:  #4F44B8;
  --primary-glow:  #7C6BF2;
  --primary-tint:  rgba(109, 91, 255, 0.10);

  /* Subject palette */
  --turkce:   #3B82F6;
  --mat:      #A78BFA;
  --sosyal:   #D97706;
  --fen:      #059669;
  --yabanci:  #0891B2;

  /* Semantic status — text-safe on their tints (≥4.5:1) */
  --up:           #15803D;
  --up-tint:      rgba(34, 197, 94, 0.12);
  --down:         #B91C1C;
  --down-tint:    rgba(239, 68, 68, 0.12);
  --warn:         #B45309;
  --warn-tint:    rgba(251, 191, 36, 0.14);
  --info:         #2563EB;
  --info-tint:    rgba(96, 165, 250, 0.14);

  /* Aliases — success/danger read better in some contexts */
  --success:      var(--up);
  --success-tint: var(--up-tint);
  --danger:       var(--down);
  --danger-tint:  var(--down-tint);

  /* Typography */
  --heading:  #111118;
  --body:     #2d2d3a;
  --muted:    #62627a;
  --muted-2:  #9898ad;

  /* Border radius */
  --r-card:  14px;
  --r-chip:  8px;
  --r-pill:  9999px;

  /* Spacing (4px grid) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 64px;

  /* Z-index scale */
  --z-sticky:   20;
  --z-nav:      30;
  --z-dropdown: 40;
  --z-modal:    50;
  --z-toast:    60;

  /* Focus ring */
  --focus-ring: 0 0 0 2px var(--surface-1), 0 0 0 4px var(--primary);

  /* Shadows */
  --shadow-card:    0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-card-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-fab:     0 6px 20px rgba(109, 91, 255, 0.45);

  /* Transitions */
  --t-fast:   120ms;
  --t-base:   200ms;
  --t-slow:   300ms;
  --ease-out: cubic-bezier(0.3, 0.7, 0.4, 1);

  /* ── Internal dark value set (single source — mapped by theme scopes) ── */
  --dark-bg:              #0B0E16;
  --dark-surface-0:       #0B0E16;
  --dark-surface-1:       #121623;
  --dark-surface-2:       #1A1F2F;
  --dark-surface-3:       #232A3D;
  --dark-surface-overlay: #2B3348;
  --dark-scrim:           rgba(4, 6, 12, 0.6);

  --dark-border:        #252C40;
  --dark-border-strong: #39415C;

  --dark-primary:      #8B7CFF;
  --dark-primary-glow: #A99DFF;
  --dark-primary-tint: rgba(139, 124, 255, 0.14);

  --dark-turkce:   #60A5FA;
  --dark-mat:      #C4B5FD;
  --dark-sosyal:   #FBBF24;
  --dark-fen:      #34D399;
  --dark-yabanci:  #22D3EE;

  --dark-up:        #4ADE80;
  --dark-down:      #F87171;
  --dark-warn:      #FBBF24;
  --dark-info:      #60A5FA;

  --dark-heading:  #F1F3FA;
  --dark-body:     #C3C9DA;
  --dark-muted:    #8B93AB;
  --dark-muted-2:  #6B7390;

  --dark-shadow-card:    0 1px 3px rgba(0, 0, 0, 0.4);
  --dark-shadow-card-md: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* ── Sidebar layout + collapse ─────────────────────────────────────────── */
.das-sidebar { width: 240px; transition: width 250ms var(--ease-out, ease); }
#das-main    { transition: margin-left 250ms var(--ease-out, ease); }

@media (min-width: 768px) {
  #das-main { margin-left: 240px; }
  .das-fixed-sidebar-offset { left: 240px; }
}

/* Text elements that shrink and fade on collapse */
.das-nav-label, .das-brand-text {
  overflow: hidden; white-space: nowrap; max-width: 160px;
  transition: opacity 150ms ease, max-width 200ms var(--ease-out, ease);
}
.das-nav-group, .das-hesap-label {
  max-height: 24px; overflow: hidden;
  transition: opacity 150ms ease, max-height 200ms var(--ease-out, ease), margin-bottom 200ms;
}
.das-user-chip {
  overflow: hidden; max-height: 64px;
  transition: opacity 150ms ease, max-height 200ms var(--ease-out, ease), margin-top 200ms;
}
.das-sidebar-toggle svg { transition: transform 250ms var(--ease-out, ease); }
.das-bell-collapsed-nav { display: none; }

@media (min-width: 768px) {
  html.sidebar-collapsed .das-sidebar { width: 64px; }
  html.sidebar-collapsed #das-main    { margin-left: 64px; }

  html.sidebar-collapsed .das-nav-label   { opacity: 0; max-width: 0; }
  html.sidebar-collapsed .das-brand-text  { opacity: 0; max-width: 0; }
  html.sidebar-collapsed .das-nav-group   { opacity: 0; max-height: 0; margin-bottom: 0; }
  html.sidebar-collapsed .das-hesap-label { opacity: 0; max-height: 0; margin-bottom: 0; }
  html.sidebar-collapsed .das-user-chip   { opacity: 0; max-height: 0; margin-top: 0; }
  html.sidebar-collapsed .das-bell-wrap          { display: none; }
  html.sidebar-collapsed .das-bell-collapsed-nav { display: block; }

  html.sidebar-collapsed .das-nav-link { justify-content: center; padding-left: 0.5rem; padding-right: 0.5rem; gap: 0; }

  /* Collapsed: chevron hidden — logo becomes the expand trigger */
  html.sidebar-collapsed .das-sidebar-toggle { display: none; }
  html.sidebar-collapsed .das-brand-header { justify-content: center; }
  html.sidebar-collapsed .das-brand-logo-link {
    flex: none;
    padding: 0.375rem;
    border-radius: 8px;
  }
  html.sidebar-collapsed .das-brand-logo-link:hover { background: var(--primary-tint); }

  /* Fixed-position elements that must shift with the sidebar */
  html.sidebar-collapsed .das-fixed-sidebar-offset { left: 64px; }
}
