/* ==========================================================================
   Alp’inn Bilişim QR SaaS — Design Tokens
   Tek kaynaktan yönetilen tasarım değişkenleri. Tema geçişi <html data-theme>
   üzerinden yapılır; JS devre dışıysa işletim sistemi tercihi kullanılır.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Typography */
  --font-sans: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.3125rem;
  --text-2xl: 1.625rem;
  --text-3xl: 2rem;
  --text-4xl: 2.625rem;
  --text-5xl: 3.5rem;

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --tracking-tight: -0.022em;
  --tracking-tighter: -0.035em;
  --tracking-wide: 0.06em;

  /* Surfaces & ink — light */
  --bg: #fafafa;
  --bg-subtle: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f8f8f9;
  --surface-3: #f1f1f3;
  --surface-inverse: #0a0a0a;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --overlay: rgba(10, 10, 12, 0.42);

  --border: #e7e7ea;
  --border-subtle: #efeff1;
  --border-strong: #d6d6db;
  --hairline: rgba(10, 10, 12, 0.08);

  --fg: #0a0a0b;
  --fg-muted: #52525b;
  --fg-subtle: #71717a;
  --fg-faint: #a1a1aa;
  --fg-inverse: #fafafa;

  --primary: #0a0a0b;
  --primary-hover: #27272a;
  --primary-fg: #fafafa;

  --accent: #3355ff;
  --accent-soft: rgba(51, 85, 255, 0.1);
  --accent-fg: #ffffff;
  --ring: rgba(51, 85, 255, 0.38);
  --link: #2f4fe8;

  /* Semantic */
  --success: #15803d;
  --success-strong: #16a34a;
  --success-soft: #ecfdf3;
  --success-border: #bbf7d0;

  --warning: #b45309;
  --warning-strong: #f59e0b;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;

  --danger: #dc2626;
  --danger-strong: #ef4444;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;

  --info: #1d4ed8;
  --info-strong: #3b82f6;
  --info-soft: #eff6ff;
  --info-border: #bfdbfe;

  /* Table states (garson paneli) */
  --st-empty: #a1a1aa;
  --st-empty-bg: #f4f4f5;
  --st-occupied: #2563eb;
  --st-occupied-bg: #eff4ff;
  --st-bill: #dc2626;
  --st-bill-bg: #fef2f2;
  --st-call: #eab308;
  --st-call-bg: #fefce8;
  --st-ready: #16a34a;

  /* Kitchen states */
  --kds-pending: #f59e0b;
  --kds-preparing: #3b82f6;
  --kds-ready: #16a34a;

  /* Data visualisation (validated categorical order) */
  --viz-surface: var(--surface);
  --viz-grid: #ececef;
  --viz-axis: #d4d4d8;
  --viz-ink: #0b0b0b;
  --viz-ink-2: #52514e;
  --viz-muted: #898781;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --delta-up: #006300;
  --delta-down: #d03b3b;

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 28px;
  --r-full: 999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(10, 10, 12, 0.05);
  --shadow-sm: 0 1px 2px rgba(10, 10, 12, 0.04), 0 2px 6px rgba(10, 10, 12, 0.04);
  --shadow-md: 0 1px 2px rgba(10, 10, 12, 0.04), 0 6px 18px -4px rgba(10, 10, 12, 0.08);
  --shadow-lg: 0 2px 4px rgba(10, 10, 12, 0.04), 0 18px 40px -12px rgba(10, 10, 12, 0.18);
  --shadow-xl: 0 4px 10px rgba(10, 10, 12, 0.05), 0 32px 72px -20px rgba(10, 10, 12, 0.28);
  --shadow-ring: 0 0 0 1px var(--hairline);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 140ms;
  --dur: 220ms;
  --dur-slow: 420ms;

  /* Layout */
  --header-h: 60px;
  --sidebar-w: 256px;
  --container: 1240px;
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Z-index scale */
  --z-base: 1;
  --z-sticky: 20;
  --z-header: 40;
  --z-dock: 50;
  --z-dropdown: 70;
  --z-overlay: 80;
  --z-modal: 90;
  --z-toast: 120;
  --z-alert: 130;

  /* Decorative */
  --grid-line: rgba(10, 10, 12, 0.055);
  --aurora-1: rgba(51, 85, 255, 0.16);
  --aurora-2: rgba(20, 184, 166, 0.12);
  --aurora-3: rgba(236, 72, 153, 0.1);
  --spotlight: rgba(10, 10, 12, 0.045);
  --skeleton: #efeff1;
  --skeleton-shine: #f7f7f8;
}

/* Dark tokens — explicit selection via toggle */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0b;
  --bg-subtle: #0f0f11;
  --surface: #111113;
  --surface-2: #161618;
  --surface-3: #1c1c1f;
  --surface-inverse: #fafafa;
  --glass: rgba(17, 17, 19, 0.7);
  --glass-strong: rgba(17, 17, 19, 0.88);
  --overlay: rgba(0, 0, 0, 0.62);

  --border: #26262a;
  --border-subtle: #1e1e22;
  --border-strong: #34343a;
  --hairline: rgba(255, 255, 255, 0.08);

  --fg: #f4f4f5;
  --fg-muted: #a1a1aa;
  --fg-subtle: #8b8b94;
  --fg-faint: #5c5c66;
  --fg-inverse: #0a0a0b;

  --primary: #f4f4f5;
  --primary-hover: #d4d4d8;
  --primary-fg: #0a0a0b;

  --accent: #6b85ff;
  --accent-soft: rgba(107, 133, 255, 0.14);
  --accent-fg: #0a0a0b;
  --ring: rgba(107, 133, 255, 0.45);
  --link: #8ea2ff;

  --success: #4ade80;
  --success-strong: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.1);
  --success-border: rgba(34, 197, 94, 0.28);

  --warning: #fbbf24;
  --warning-strong: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.3);

  --danger: #f87171;
  --danger-strong: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.32);

  --info: #60a5fa;
  --info-strong: #3b82f6;
  --info-soft: rgba(59, 130, 246, 0.1);
  --info-border: rgba(59, 130, 246, 0.3);

  --st-empty: #71717a;
  --st-empty-bg: #18181b;
  --st-occupied: #3b82f6;
  --st-occupied-bg: rgba(59, 130, 246, 0.1);
  --st-bill: #ef4444;
  --st-bill-bg: rgba(239, 68, 68, 0.12);
  --st-call: #facc15;
  --st-call-bg: rgba(250, 204, 21, 0.1);
  --st-ready: #22c55e;

  --viz-grid: #232326;
  --viz-axis: #38383d;
  --viz-ink: #ffffff;
  --viz-ink-2: #c3c2b7;
  --viz-muted: #898781;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --delta-up: #0ca30c;
  --delta-down: #e66767;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 20px -6px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 20px 44px -12px rgba(0, 0, 0, 0.65);
  --shadow-xl: 0 4px 12px rgba(0, 0, 0, 0.45), 0 36px 80px -20px rgba(0, 0, 0, 0.75);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  --grid-line: rgba(255, 255, 255, 0.05);
  --aurora-1: rgba(90, 120, 255, 0.2);
  --aurora-2: rgba(20, 184, 166, 0.12);
  --aurora-3: rgba(236, 72, 153, 0.1);
  --spotlight: rgba(255, 255, 255, 0.06);
  --skeleton: #1a1a1d;
  --skeleton-shine: #232327;
}

/* No-JS fallback: follow OS preference when no explicit theme is stamped */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0a0a0b;
    --bg-subtle: #0f0f11;
    --surface: #111113;
    --surface-2: #161618;
    --surface-3: #1c1c1f;
    --glass: rgba(17, 17, 19, 0.7);
    --glass-strong: rgba(17, 17, 19, 0.88);
    --overlay: rgba(0, 0, 0, 0.62);
    --border: #26262a;
    --border-subtle: #1e1e22;
    --border-strong: #34343a;
    --hairline: rgba(255, 255, 255, 0.08);
    --fg: #f4f4f5;
    --fg-muted: #a1a1aa;
    --fg-subtle: #8b8b94;
    --fg-faint: #5c5c66;
    --fg-inverse: #0a0a0b;
    --primary: #f4f4f5;
    --primary-hover: #d4d4d8;
    --primary-fg: #0a0a0b;
    --accent: #6b85ff;
    --ring: rgba(107, 133, 255, 0.45);
    --grid-line: rgba(255, 255, 255, 0.05);
    --skeleton: #1a1a1d;
    --skeleton-shine: #232327;
  }
}

@media (min-width: 768px) {
  :root {
    --gutter: 24px;
    --header-h: 64px;
  }
}

@media (min-width: 1280px) {
  :root {
    --gutter: 32px;
  }
}
