/* ============================================================================
   Albayan2 Design Tokens (Concept B — Steel Blue, Navy Ink & Teal/Mint)
   ============================================================================
   Every visual property in static/css/app.css reads from these CSS variables.
   Changing a colour, font, or corner radius is a single-line edit here.

   HOW TO ADD A NEW THEME (2 steps):
   1. Add a `[data-theme="your-theme"] { ... }` block below overriding the
      `--color-*`, `--topbar-*`, `--navbar-*`, and `--shadow-*` tokens
      (verify WCAG AA >= 4.5:1 text contrast, >= 3:1 large text/UI borders).
   2. Register the theme in `apps/core/themes.py` (one entry in `THEMES`),
      and add its label key (`theme.your_theme`) to `locales/ar.json` and
      `locales/en.json`.
   ============================================================================ */

/* IBM Plex Sans Arabic: one family for Arabic, Latin and digits (SIL OFL 1.1, see static/fonts/OFL-IBM-Plex.txt) */
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/IBMPlexSansArabic-400-arabic.4fa3d81d41ab.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/IBMPlexSansArabic-400-latin.4767e1197706.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  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;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/IBMPlexSansArabic-500-arabic.106892212ea7.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/IBMPlexSansArabic-500-latin.80ebc672c915.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  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;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/IBMPlexSansArabic-600-arabic.64891a810259.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/IBMPlexSansArabic-600-latin.f417eeb0d15e.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  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;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/IBMPlexSansArabic-700-arabic.a4390abc98c2.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("../fonts/IBMPlexSansArabic-700-latin.8d04403cf599.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  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;
}

/* Local IBM Plex Sans font faces for Latin & digits (SIL OFL 1.1 — see static/fonts/OFL-IBM-Plex.txt) */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/IBMPlexSans-Regular.d1df0983a130.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2013-2014, U+2018-201E, U+2022, U+2026, U+20AC, U+2122;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/IBMPlexSans-Medium.9dd32caf62b8.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2013-2014, U+2018-201E, U+2022, U+2026, U+20AC, U+2122;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("../fonts/IBMPlexSans-Bold.6d4f44b804e2.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2013-2014, U+2018-201E, U+2022, U+2026, U+20AC, U+2122;
}

/* Local Tajawal font faces for Arabic (SIL OFL 1.1 — see static/fonts/OFL.txt) */
@font-face {
  font-family: "Tajawal";
  src: url("../fonts/tajawal_regular.d11e9f3094b8.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Tajawal";
  src: url("../fonts/tajawal_medium.3876865bd2f3.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Tajawal";
  src: url("../fonts/tajawal_bold.ef7c3dc2a2b8.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Tajawal";
  src: url("../fonts/tajawal_extrabold.6ae16db8693a.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* Shared non-colour tokens & Concept B brand constants */
:root {
  /* Concept B Brand Constants */
  --brand-blue: #1B75A8;
  --brand-navy: #13303D;
  --brand-teal: #14B8A6;
  --brand-mint: #5EEAD4;
  --brand-white: #FFFFFF;

  /* Typography (IBM Plex Sans Arabic for Arabic, Latin and digits; IBM Plex Sans for extra Latin) */
  --font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;

  /* Type scale (5-rung ramp + KPI/Hero figures) */
  --text-xs: 0.75rem;      /* 12px — secondary notes, fine print */
  --text-sm: 0.875rem;     /* 14px — list items, table cells, form labels */
  --text-base: 1rem;       /* 16px — body copy, inputs */
  --text-md: 1.0625rem;    /* 17px — section & card titles */
  --text-lg: 1.25rem;      /* 20px — page titles */
  --text-xl: 1.625rem;     /* 26px — screen titles */
  --text-kpi: 1.875rem;    /* 30px — KPI stat figures */
  --text-hero: 2.75rem;    /* 44px — dominant hero number */

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 700;

  --leading-tight: 1.25;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;

  /* Spacing scale */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */

  /* Corner radius */
  --radius-sm: 0.5rem;     /* 8px — inner elements */
  --radius-md: 0.875rem;   /* 14px — inputs, icon wells, nav bar */
  --radius-btn: 1rem;      /* 16px — buttons */
  --radius-card: 1.125rem; /* 18px — cards */
  --radius-hero: 1.375rem; /* 22px — hero cards */
  --radius-pill: 9999px;   /* pills & chips */

  /* POS-friendly touch/click control heights (minimum 44px) */
  --control-height-sm: 2.75rem; /* 44px */
  --control-height-md: 3rem;    /* 48px */
  --control-height-lg: 3.25rem; /* 52px */

  /* Shell layout dimensions */
  --sidebar-width: 17rem;
  --sidebar-rail-width: 4.5rem;
  --topbar-height: 4.25rem;
  --content-max: 84rem;
  --auth-max: 27rem;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-normal: 200ms ease;

  /* Fixed preview tokens (used in Preferences theme cards — Concept B) */
  --preview-light-bg: #EEF3F7;
  --preview-light-border: #D4E1EA;
  --preview-light-primary: #1B75A8;
  --preview-light-accent: #14B8A6;
  --preview-dark-bg: #0B1C24;
  --preview-dark-border: #25485A;
  --preview-dark-primary: #5BB4E5;
  --preview-dark-accent: #5EEAD4;

  /* Print-safe palette tokens */
  --print-bg: #FFFFFF;
  --print-surface-2: #F4F6F8;
  --print-row-alt: #F2F2F2;
  --print-text: #000000;
  --print-text-muted: #333333;
  --print-page-num: #555555;
  --print-border: #CCCCCC;
}

/* ============================================================================
   Theme: Light (default — Concept B steel blue & cool light ground, WCAG AA)
   ============================================================================ */
:root,
[data-theme="light"] {
  color-scheme: light;

  --color-bg: #EEF3F7;               /* Concept B cool light canvas */
  --color-surface: #FFFFFF;          /* Card & panel fill */
  --color-surface-2: #E4EDF3;        /* Subtle tinted surface / zebra / well */
  --color-row-alt: #EAF3F9;          /* zebra: even table rows, light tint of the primary steel blue (text 12.3:1) */
  --color-row-hover: #D6E8F3;        /* table row hover, stronger tint (text 10.9:1) */
  --color-text: #13303D;             /* Concept B navy ink (13.84:1 on surface, 12.39:1 on bg) */
  --color-text-muted: #486373;       /* Muted navy slate (6.35:1 on surface, 5.68:1 on bg, 5.35:1 on surface-2) */
  --color-border: #D4E1EA;           /* Subtle divider hairline */
  --color-border-strong: #7595A8;    /* UI input/control border (3.17:1 on surface) */

  --color-primary: #1B75A8;          /* Concept B steel blue (5.05:1 with white) */
  --color-primary-hover: #155D87;    /* Deeper steel blue hover (7.12:1 with white) */
  --color-primary-contrast: #FFFFFF;
  --color-primary-soft: #E5F2F9;     /* Soft steel-blue tint */
  --color-primary-soft-text: #145880;/* Text on primary-soft (6.72:1) */
  --color-accent: #14B8A6;           /* Concept B teal (decoration, borders, accents only) */
  --color-accent-text: #0D756A;      /* Darker teal for any teal text (5.57:1 on surface) */

  /* Shell tokens (top bar & navigation bar) */
  --topbar-bg: #FFFFFF;              /* Crisp white top bar */
  --navbar-bg: #1B75A8;              /* Concept B steel-blue nav bar */
  --navbar-text: #FFFFFF;            /* Nav items on blue (5.05:1 on navbar-bg) */
  --navbar-text-muted: #EFF8FD;      /* Secondary nav labels/group titles (4.70:1 on navbar-bg) */
  --navbar-pill-bg: #FFFFFF;         /* Active pill fill (5.05:1 against navbar-bg) */
  --navbar-pill-text: #155D87;       /* Active pill text (7.12:1 on navbar-pill-bg) */
  --navbar-hover-bg: rgba(19, 48, 61, 0.22); /* Darkened blue hover (~#196690; white text 6.28:1) */
  --navbar-border: rgba(255, 255, 255, 0.18);
  --brand-accent-text: #1B75A8;      /* «البيان» accent in «يعمل بنظام البيان» (5.05:1 on topbar-bg) */

  --color-success: #137347;          /* 5.88:1 with white */
  --color-success-contrast: #FFFFFF;
  --color-success-soft: #E3F5EC;
  --color-success-soft-text: #0F5132;/* 8.26:1 on soft */

  --color-warning: #945705;          /* 5.79:1 with white */
  --color-warning-contrast: #FFFFFF;
  --color-warning-soft: #FDF3E1;
  --color-warning-soft-text: #7A4704;/* 6.99:1 on soft */

  --color-danger: #C63636;           /* 5.27:1 with white */
  --color-danger-hover: #A82828;
  --color-danger-contrast: #FFFFFF;
  --color-danger-soft: #FDECEC;
  --color-danger-soft-text: #9B2222; /* 6.95:1 on soft */

  --color-info: #1B75A8;             /* 5.05:1 with white */
  --color-info-contrast: #FFFFFF;
  --color-info-soft: #E5F2F9;
  --color-info-soft-text: #145880;   /* 6.72:1 on soft */

  --color-focus: #1B75A8;
  --color-overlay: rgba(19, 48, 61, 0.45);

  --shadow-none: none;
  --shadow-sm: 0 1px 2px rgba(19, 48, 61, 0.06);
  --shadow-md: 0 8px 24px rgba(19, 48, 61, 0.12);
  --shadow-focus: 0 0 0 3px rgba(27, 117, 168, 0.28);
}

/* ============================================================================
   Theme: Dark (Concept B deep navy grounds & mint accents, WCAG AA verified)
   ============================================================================ */
[data-theme="dark"] {
  color-scheme: dark;

  --color-bg: #0B1C24;               /* Deep navy ground (darker than #13303D) */
  --color-surface: #13303D;          /* Concept B navy surface */
  --color-surface-2: #1A3D4D;        /* Elevated navy surface */
  --color-row-alt: #183A4A;          /* zebra: even rows, subtle steel-blue tint on navy (text 10.8:1) */
  --color-row-hover: #224C61;        /* row hover (text 8.6:1) */
  --color-text: #EEF4F8;             /* Light ink (12.47:1 on surface, 15.70:1 on bg) */
  --color-text-muted: #A3BDCB;       /* Muted ink (7.05:1 on surface, 8.87:1 on bg, 5.88:1 on surface-2) */
  --color-border: #25485A;           /* Subtle dark divider */
  --color-border-strong: #538096;    /* UI input/control border (3.23:1 on surface) */

  --color-primary: #5BB4E5;          /* Light steel blue (7.84:1 with dark contrast, 6.00:1 on surface) */
  --color-primary-hover: #79C5EE;    /* Lighter hover (9.50:1 with dark contrast) */
  --color-primary-contrast: #081820;
  --color-primary-soft: #193E52;     /* Soft steel-blue tint on dark */
  --color-primary-soft-text: #B3E0F7;/* Text on primary-soft (8.06:1) */
  --color-accent: #5EEAD4;           /* Concept B mint (9.35:1 on surface) */
  --color-accent-text: #5EEAD4;      /* Mint text on dark surface (9.35:1) */

  /* Shell tokens (top bar & navigation bar) */
  --topbar-bg: #13303D;              /* Navy surface top bar */
  --navbar-bg: #0E2430;              /* Deeper navy nav bar (darker than surface) */
  --navbar-text: #EEF4F8;            /* Nav items on dark navy (14.41:1 on navbar-bg) */
  --navbar-text-muted: #A3BDCB;      /* Secondary nav labels/group titles (8.14:1 on navbar-bg) */
  --navbar-pill-bg: #5BB4E5;         /* Light steel-blue active pill (6.93:1 against navbar-bg) */
  --navbar-pill-text: #081820;       /* Dark navy ink on active pill (7.84:1 on navbar-pill-bg) */
  --navbar-hover-bg: #183A4B;        /* Elevated navy hover (navbar-text 10.84:1) */
  --navbar-border: #25485A;
  --brand-accent-text: #6AC0EE;      /* «البيان» accent in «يعمل بنظام البيان» (6.84:1 on topbar-bg) */

  --color-success: #4ADE80;          /* 9.84:1 with dark contrast */
  --color-success-contrast: #062014;
  --color-success-soft: #123325;
  --color-success-soft-text: #86EFAC;/* 9.80:1 on soft */

  --color-warning: #F5B041;          /* 9.50:1 with dark contrast */
  --color-warning-contrast: #241400;
  --color-warning-soft: #36260E;
  --color-warning-soft-text: #FBD38D;/* 10.28:1 on soft */

  --color-danger: #F27474;           /* 6.79:1 with dark contrast, 4.96:1 on surface */
  --color-danger-hover: #F79494;
  --color-danger-contrast: #240707;
  --color-danger-soft: #3B181C;
  --color-danger-soft-text: #FCA5A5; /* 8.30:1 on soft */

  --color-info: #5BB4E5;             /* 7.84:1 with dark contrast */
  --color-info-contrast: #081820;
  --color-info-soft: #193E52;
  --color-info-soft-text: #B3E0F7;   /* 8.06:1 on soft */

  --color-focus: #79C5EE;
  --color-overlay: rgba(4, 12, 18, 0.72);

  --shadow-none: none;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.42);
  --shadow-focus: 0 0 0 3px rgba(121, 197, 238, 0.35);
}
