/* =====================================================================
   TOURISM OS - Design tokens (2.0 interface).

   Everything the interface draws reads these values. Change a token here and
   the whole product follows; the company primary colour overrides --primary
   at runtime from the tenant settings, and every tint of it (hover, soft
   backgrounds, focus ring) is DERIVED from --primary with color-mix, so a
   company colour carries through the whole interface rather than only the
   buttons.

   The direction is a native application, not an admin template: quiet
   neutral surfaces, hairline separators, one accent used sparingly, depth
   from light shadows rather than heavy borders.

   Dark mode is a dedicated set of surfaces, not an inversion. assets/js/
   boot.js resolves the user's choice (light, dark or system) into
   data-theme on <html> before the first paint.
   ===================================================================== */

/* Inter, latin subset only (48 KB, cached for a year). Arabic and any other
   script fall through to the system stack glyph by glyph. */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-wght.woff2") format("woff2-variations"),
       url("../fonts/inter-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  /* ---- Brand ---- */
  --primary: #1d6f5f;
  --primary-contrast: #ffffff;
  --accent: #c2703a;          /* terracotta, used sparingly for emphasis */
  --accent-50: #fbf1ea;

  /* ---- Surfaces ---- */
  --bg: #f6f7f6;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-3: #f1f2f1;
  --surface-hover: rgba(15, 23, 20, 0.045);
  --surface-press: rgba(15, 23, 20, 0.075);
  --overlay: rgba(12, 16, 15, 0.32);

  --sidebar-bg: #eff1f0;
  --sidebar-text: #474e4c;
  --sidebar-text-active: #151918;
  --sidebar-active-bg: #ffffff;
  --sidebar-hover-bg: rgba(15, 23, 20, 0.05);
  --sidebar-border: rgba(15, 23, 20, 0.07);

  /* ---- Text ---- */
  --text: #161a19;
  --text-2: #3d4442;
  --text-3: #676f6d;
  --text-muted: #969d9b;
  --text-on-primary: #ffffff;

  /* ---- Borders: hairlines, translucent so they read on any surface ---- */
  --border: rgba(15, 23, 20, 0.085);
  --border-2: rgba(15, 23, 20, 0.15);
  --border-strong: rgba(15, 23, 20, 0.22);

  /* ---- Semantic ---- */
  --success: #2a8554; --success-text: #1b5a38;
  --warning: #b36f0b; --warning-text: #7a4a07;
  --danger:  #c23f2b; --danger-text:  #8e2b1c;
  --info:    #2b6a8b; --info-text:    #1a4657;

  /* ---- Status palette. Mirrors the colour names of config/statuses.php,
         so a badge colour is decided in PHP and drawn here. The soft
         backgrounds are derived below, from the colour and the surface. ---- */
  --c-gray:   #717a78; --c-gray-text:   #414a47;
  --c-slate:  #54625e; --c-slate-text:  #2b3633;
  --c-blue:   #2b6a8b; --c-blue-text:   #1b4a60;
  --c-indigo: #4c56a8; --c-indigo-text: #313a7c;
  --c-purple: #7a4f9e; --c-purple-text: #52306d;
  --c-pink:   #b34a72; --c-pink-text:   #7c2d4b;
  --c-red:    #c23f2b; --c-red-text:    #8e2b1c;
  --c-amber:  #b36f0b; --c-amber-text:  #7a4a07;
  --c-green:  #2a8554; --c-green-text:  #1b5a38;
  --c-teal:   #1d6f5f; --c-teal-text:   #134c41;

  /* ---- Layout ---- */
  --sidebar-width: 248px;
  --sidebar-collapsed: 60px;
  --topbar-height: 56px;
  --bottomnav-height: 64px;
  --content-max: 1360px;
  --gutter: 16px;

  /* ---- Shape ---- */
  --radius-xs: 5px;
  --radius-sm: 7px;
  --radius: 9px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 999px;

  /* ---- Elevation: light, layered, never a grey halo ---- */
  --shadow-xs: 0 1px 1px rgba(15, 23, 20, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 20, 0.06), 0 1px 1px rgba(15, 23, 20, 0.03);
  --shadow: 0 4px 12px -2px rgba(15, 23, 20, 0.08), 0 1px 3px rgba(15, 23, 20, 0.05);
  --shadow-lg: 0 18px 44px -12px rgba(15, 23, 20, 0.22), 0 6px 14px -8px rgba(15, 23, 20, 0.12);
  --shadow-pop: 0 12px 32px -8px rgba(15, 23, 20, 0.2), 0 0 0 1px rgba(15, 23, 20, 0.07);
  --shadow-card: 0 1px 2px rgba(15, 23, 20, 0.035);

  /* ---- Typography ----
     Inter where it is available (bundled, latin), then the platform's own
     interface face: SF Pro on Apple devices, Segoe UI on Windows, Roboto on
     Android, with the Arabic system faces behind them. */
  --font: "Inter Variable", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text",
          "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Noto Sans Arabic", "Geeza Pro",
          Tahoma, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --fs-xs: 0.75rem;     /* 12   metadata */
  --fs-sm: 0.8125rem;   /* 13   secondary, table meta, labels */
  --fs: 0.875rem;       /* 14   body, table content */
  --fs-md: 0.9375rem;   /* 15   emphasised body, card titles */
  --fs-lg: 1.0625rem;   /* 17   section titles */
  --fs-xl: 1.25rem;     /* 20 */
  --fs-2xl: 1.5rem;     /* 24   page title */
  --fs-3xl: 1.875rem;   /* 30   hero figures */

  --lh-tight: 1.25;
  --lh: 1.55;

  /* ---- Motion: short, eased out, never decorative ---- */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --fast: 120ms;
  --normal: 180ms;
  --slow: 240ms;
}

/* Tints DERIVED from the primary colour and the surface. Declared on :root
   AND body: body.platform replaces --primary, and a custom property that
   reads another one resolves where it is declared, so the tints must be
   recomputed there too. */
:root, body {
  --primary-600: color-mix(in srgb, var(--primary) 88%, #000);
  --primary-700: color-mix(in srgb, var(--primary) 72%, #000);
  --primary-50:  color-mix(in srgb, var(--primary) 7%, var(--surface));
  --primary-100: color-mix(in srgb, var(--primary) 14%, var(--surface));
  --primary-200: color-mix(in srgb, var(--primary) 32%, var(--surface));
  --primary-text: color-mix(in srgb, var(--primary) 86%, var(--text));
  --ring: color-mix(in srgb, var(--primary) 26%, transparent);
  --focus: color-mix(in srgb, var(--primary) 70%, var(--surface));

  --success-bg: color-mix(in srgb, var(--success) 10%, var(--surface));
  --warning-bg: color-mix(in srgb, var(--warning) 11%, var(--surface));
  --danger-bg:  color-mix(in srgb, var(--danger) 9%, var(--surface));
  --info-bg:    color-mix(in srgb, var(--info) 9%, var(--surface));

  --c-gray-bg:   color-mix(in srgb, var(--c-gray) 11%, var(--surface));
  --c-slate-bg:  color-mix(in srgb, var(--c-slate) 13%, var(--surface));
  --c-blue-bg:   color-mix(in srgb, var(--c-blue) 10%, var(--surface));
  --c-indigo-bg: color-mix(in srgb, var(--c-indigo) 10%, var(--surface));
  --c-purple-bg: color-mix(in srgb, var(--c-purple) 10%, var(--surface));
  --c-pink-bg:   color-mix(in srgb, var(--c-pink) 10%, var(--surface));
  --c-red-bg:    color-mix(in srgb, var(--c-red) 9%, var(--surface));
  --c-amber-bg:  color-mix(in srgb, var(--c-amber) 11%, var(--surface));
  --c-green-bg:  color-mix(in srgb, var(--c-green) 10%, var(--surface));
  --c-teal-bg:   color-mix(in srgb, var(--c-teal) 10%, var(--surface));
}

/* =====================================================================
   Dark: its own surfaces. Depth goes UP in lightness (a raised surface is
   lighter than the canvas), shadows are replaced by hairlines, and the
   status colours are lifted so they keep their contrast.
   ===================================================================== */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e100f;
  --surface: #161918;
  --surface-2: #1a1d1c;
  --surface-3: #212524;
  --surface-hover: rgba(255, 255, 255, 0.05);
  --surface-press: rgba(255, 255, 255, 0.08);
  --overlay: rgba(0, 0, 0, 0.55);

  --sidebar-bg: #121413;
  --sidebar-text: #aab2b0;
  --sidebar-text-active: #f1f4f3;
  --sidebar-active-bg: rgba(255, 255, 255, 0.075);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.045);
  --sidebar-border: rgba(255, 255, 255, 0.06);

  --text: #eceeed;
  --text-2: #bcc3c1;
  --text-3: #8d9593;
  --text-muted: #646c6a;

  --border: rgba(255, 255, 255, 0.075);
  --border-2: rgba(255, 255, 255, 0.13);
  --border-strong: rgba(255, 255, 255, 0.2);

  --success: #3fb07a; --success-text: #8fdcb2;
  --warning: #d69a3a; --warning-text: #f0c886;
  --danger:  #e5654f; --danger-text:  #f3aa9c;
  --info:    #4f9ac2; --info-text:    #9ccbe3;

  --c-gray:   #8b9492; --c-gray-text:   #c6cecc;
  --c-slate:  #7d8c88; --c-slate-text:  #c3cfcc;
  --c-blue:   #4f9ac2; --c-blue-text:   #9ccbe3;
  --c-indigo: #7c86d6; --c-indigo-text: #b4baf0;
  --c-purple: #a67ccc; --c-purple-text: #d2b5ea;
  --c-pink:   #d4739a; --c-pink-text:   #f0b0c8;
  --c-red:    #e5654f; --c-red-text:    #f3aa9c;
  --c-amber:  #d69a3a; --c-amber-text:  #f0c886;
  --c-green:  #3fb07a; --c-green-text:  #8fdcb2;
  --c-teal:   #3ea58f; --c-teal-text:   #8fd8c6;

  --shadow-xs: 0 0 0 transparent;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 22px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-card: 0 0 0 transparent;

  --ink: #0a0c0b;
  --ink-2: #111413;
}
:root[data-theme="dark"], :root[data-theme="dark"] body {
  --primary-50:  color-mix(in srgb, var(--primary) 16%, var(--surface));
  --primary-100: color-mix(in srgb, var(--primary) 26%, var(--surface));
  --primary-200: color-mix(in srgb, var(--primary) 42%, var(--surface));
  --primary-text: color-mix(in srgb, var(--primary) 55%, #fff);
  --ring: color-mix(in srgb, var(--primary) 45%, transparent);
  --focus: color-mix(in srgb, var(--primary) 60%, #fff);

  --success-bg: color-mix(in srgb, var(--success) 15%, var(--surface));
  --warning-bg: color-mix(in srgb, var(--warning) 15%, var(--surface));
  --danger-bg:  color-mix(in srgb, var(--danger) 15%, var(--surface));
  --info-bg:    color-mix(in srgb, var(--info) 15%, var(--surface));

  --c-gray-bg:   color-mix(in srgb, var(--c-gray) 16%, var(--surface));
  --c-slate-bg:  color-mix(in srgb, var(--c-slate) 18%, var(--surface));
  --c-blue-bg:   color-mix(in srgb, var(--c-blue) 17%, var(--surface));
  --c-indigo-bg: color-mix(in srgb, var(--c-indigo) 17%, var(--surface));
  --c-purple-bg: color-mix(in srgb, var(--c-purple) 17%, var(--surface));
  --c-pink-bg:   color-mix(in srgb, var(--c-pink) 17%, var(--surface));
  --c-red-bg:    color-mix(in srgb, var(--c-red) 17%, var(--surface));
  --c-amber-bg:  color-mix(in srgb, var(--c-amber) 17%, var(--surface));
  --c-green-bg:  color-mix(in srgb, var(--c-green) 16%, var(--surface));
  --c-teal-bg:   color-mix(in srgb, var(--c-teal) 17%, var(--surface));
}

/* Respect a reduced motion preference rather than animating regardless. */
@media (prefers-reduced-motion: reduce) {
  :root { --fast: 0ms; --normal: 0ms; --slow: 0ms; }
}
