/**
 * ====================================================================
 * ULTIMATE SECURITY SERVICES (USS) - ENTERPRISE DESIGN SYSTEM
 * Central Token Definition (Light/Dark Themes, Noto Sans Typography,
 * Sizing Scale, Semantic Sets, and Responsive Layout Rules)
 * ====================================================================
 */

/* 1. SELF-HOSTED FONT DECLARATIONS (ZERO THIRD-PARTY REQUESTS) */
@font-face {
  font-family: 'Noto Sans';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/noto-sans-variable.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;
}

@font-face {
  font-family: 'Noto Sans Condensed';
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 62.5% 85%;
  font-display: swap;
  src: url('../fonts/noto-sans-variable.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;
}

@font-face {
  font-family: 'Noto Sans Arabic';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/noto-sans-arabic-variable.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E;
}

/* 2. UNIVERSAL DESIGN TOKENS */
:root {
  /* ====================================================================
   * MASTER REDESIGN TOKENS (PickShipHub & Nexora CRM Reference Inspiration)
   * ==================================================================== */
  --sidebar-w: 260px;
  --header-h: 70px;
  --sidebar-bg: #FFFFFF;                     /* Deep Executive Midnight Navy */
  --sidebar-text: #0F172A;                   /* Crisp White Brand & Section Header */
  --sidebar-muted: #64748B;                  /* Slate for Inactive Icons & Categories */
  --sidebar-item-text: #334155;              /* High-Contrast Inactive Menu Text */
  --sidebar-hover: #F1F5F9; /* Translucent Modern Hover */
  --sidebar-hover-text: #0F172A;             /* Pure White on Hover */
  --sidebar-active-bg: #FF5A1F;              /* Radiant Solid Orange Active Pill (Reference Image 1) */
  --sidebar-active-text: #FFFFFF;            /* Pure White Active Text */
  --sidebar-active-icon: #FFFFFF;            /* Pure White Active Icon */
  --sidebar-active-shadow: 0 4px 14px rgba(255, 90, 31, 0.35); /* Subtle Radiant Glow */
  --sidebar-divider: #E2E8F0; /* Crisp Menu Section Divider */
  --sidebar-footer-bg: #F8FAFC;  /* Grounded Admin Footer */

  --dashboard-bg: #F4F7FB;                  /* Crisp Clean Slate-Gray Dashboard Canvas */
  --card-bg: #FFFFFF;                       /* Pure White Dashboard Cards */
  --card-bg-hover: #F8FAFC;
  --card-border: #E2E8F0;                   /* Subtle Elegant Card Border */
  --card-shadow: 0 1px 3px rgba(11, 25, 44, 0.04), 0 4px 12px rgba(11, 25, 44, 0.03);
  --card-shadow-hover: 0 4px 8px -1px rgba(11, 25, 44, 0.06), 0 12px 24px -4px rgba(11, 25, 44, 0.08);
  --border-color: #E2E8F0;
  --border-subtle: #E2E8F0;

  --header-bg: #FFFFFF;                     /* Clean Top Header */
  --header-border: #E2E8F0;
  --header-title: #0F172A;                  /* High Contrast Heading */
  --header-sub: #64748B;                    /* Crisp Subtitle */

  --brand-primary: #FF5A1F;                 /* PickShipHub Radiant Orange */
  --brand-primary-hover: #E04B16;
  --brand-navy: #0B192C;

  --table-th-bg: #F8FAFC;
  --table-th-text: #475569;
  --table-th-border: #E2E8F0;
  --table-td-border: #F1F5F9;
  --table-hover-bg: #F8FAFC;
  --table-text: #1E293B;

  --input-bg: #FFFFFF;
  --input-border: #CBD5E1;
  --input-text: #0F172A;
  --input-focus-border: #FF5A1F;
  --input-focus-ring: rgba(255, 90, 31, 0.18);

  /* Typography Families */
  --font-sans: 'Noto Sans', 'Noto Sans Arabic', Arial, 'Helvetica Neue', system-ui, sans-serif;
  --font-table: 'Noto Sans Condensed', 'Arial Narrow', Arial, sans-serif;
  --font-arabic: 'Noto Sans Arabic', 'Noto Sans', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Geometry & Grid */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --space-unit: 8px;

  /* Typography Sizes: Web Admin (Desktop & Tablet) */
  --fs-admin-body: 14px;
  --lh-admin-body: 1.5;
  --fs-admin-table-hdr: 12px;
  --fs-admin-btn: 14px;
  --fs-admin-h1: 24px;
  --fs-admin-h2: 18px;
  --fs-admin-caption: 12px;
  --fs-admin-sidebar: 14px;

  /* Typography Sizes: Mobile Portals (Guards & Supervisors) */
  --fs-mobile-body: 16px;
  --lh-mobile-body: 1.5;
  --fs-mobile-input: 16px; /* Strictly >= 16px to prevent iOS auto-zoom */
  --fs-mobile-label: 14px;
  --fs-mobile-help: 13px;
  --fs-mobile-btn: 16px;
  --fs-mobile-btn-lg: 18px;
  --min-touch-target: 48px;
  --fs-mobile-h1: 22px;
  --fs-mobile-h2: 20px;
  --fs-mobile-progress: 14px;

  /* Typography Sizes: Dense Attendance & Payroll Tables */
  --fs-att-title: 14px;
  --fs-att-header: 10px;
  --fs-att-weekday: 7px;
  --fs-att-cell: 12px;
  --fs-att-total: 12px;
  --row-h-att-header: 45px;
  --row-h-att-row: 20px;

  /* Checkpoint Group Bars (White text, WCAG >= 4.5:1) */
  --group-fire: #B03A2E;
  --group-security: #1F4E79;
  --group-parking: #9A5A08;
  --group-utilities: #0B6E77;
  --group-common: #6C3483;
}

/* 3. LIGHT THEME TOKENS (DEFAULT & EXPORT PALETTE) */
:root,
[data-theme="light"] {
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #EEF2F6;
  --border: #C9D1DB;
  --border-strong: #8A97A3; /* 3:1 on white for form/table outlines */
  --text: #1E242E;          /* 15.6:1 on white */
  --text-2: #4A5560;        /* 7.6:1 on white */
  --text-muted: #5F6B76;    /* 5.5:1 on white */
  --heading: #12263F;       /* 15.3:1 on white */
  --primary: #235F63;       /* 7.3:1 with white text */
  --primary-hover: #1B4A4E; /* 9.2:1 with white text */
  --link: #0B5C66;          /* 7.7:1 on white */
  --header-band: #12263F;   /* Top bars and report title bands */
  --accent: #2F7478;
  --success: #1B6E41;       /* 6.3:1 on surface */
  --warning: #9A5A08;       /* 5.5:1 on surface */
  --danger: #B3261E;        /* 6.5:1 on surface */
  --info: #1F4E79;          /* 8.7:1 on surface */
  --focus: #0B5C66;         /* High visibility focus ring */

  --card-shadow: 0 4px 12px rgba(18, 38, 63, 0.06);
  --modal-overlay: rgba(18, 38, 63, 0.6);

  /* Semantic Attendance Codes (Light) */
  --code-d-color: #1E242E;
  --code-d-bg: rgba(30, 36, 46, 0.06);
  --code-n-color: #1F3A93;
  --code-n-bg: rgba(31, 58, 147, 0.10);
  --code-off-color: #B3261E;
  --code-off-bg: rgba(179, 38, 30, 0.12);
  --code-s-color: #9A5A08;
  --code-s-bg: rgba(154, 90, 8, 0.10);
  --code-b-color: #6A2C91;
  --code-b-bg: rgba(106, 44, 145, 0.10);

  /* Severity Chips (Light) */
  --chip-critical-bg: rgba(179, 38, 30, 0.12);
  --chip-critical-text: #B3261E;
  --chip-high-bg: rgba(184, 90, 14, 0.12);
  --chip-high-text: #B85A0E;
  --chip-medium-bg: rgba(154, 90, 8, 0.12);
  --chip-medium-text: #9A5A08;
  --chip-low-bg: rgba(27, 110, 65, 0.12);
  --chip-low-text: #1B6E41;
}

/* 4. DARK THEME TOKENS (NEXORA CRM REFERENCE INSPIRATION) */
[data-theme="dark"] {
  /* Left Sidebar in Dark Theme - Deep Midnight Navy & Teal/Cyan Active Pill */
  --sidebar-bg: #0B192C;                     /* Nexora Deep Midnight Navy */
  --sidebar-text: #FFFFFF;                   /* Crisp White Brand Header */
  --sidebar-muted: #64748B;                  /* Soft Slate Category & Section Headers */
  --sidebar-item-text: #8FA0B5;              /* Soft Slate-Blue Inactive Menu Items */
  --sidebar-hover: rgba(255, 255, 255, 0.08); /* Translucent Modern Navy Hover */
  --sidebar-hover-text: #FFFFFF;             /* Pure White on Hover */
  --sidebar-active-bg: #0E7490;              /* Nexora Teal/Cyan Selection Pill */
  --sidebar-active-text: #FFFFFF;            /* Pure White Active Text */
  --sidebar-active-icon: #FFFFFF;            /* Pure White Active Icon */
  --sidebar-active-shadow: 0 4px 14px rgba(14, 116, 144, 0.40); /* Radiant Teal Glow */
  --sidebar-divider: rgba(255, 255, 255, 0.08); /* Crisp Subtle Divider */
  --sidebar-footer-bg: rgba(0, 0, 0, 0.25);  /* Deep Subdued Admin Footer */

  /* Dashboard Canvas & Cards in Dark Theme */
  --dashboard-bg: #0B1320;                  /* Rich Executive Dark Navy Canvas */
  --card-bg: #111C2E;                       /* Elevated Midnight Card Surface */
  --card-bg-hover: #16243B;
  --card-border: rgba(255, 255, 255, 0.08); /* Crisp Subtle Card Border */
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.45);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.08);

  --header-bg: #0E1829;                     /* Midnight Top Header */
  --header-border: rgba(255, 255, 255, 0.08);
  --header-title: #F8FAFC;                  /* Crisp White Header Title */
  --header-sub: #94A3B8;                    /* Readable Slate Subtitle */

  --table-th-bg: #0E1829;
  --table-th-text: #94A3B8;
  --table-th-border: rgba(255, 255, 255, 0.08);
  --table-td-border: rgba(255, 255, 255, 0.05);
  --table-hover-bg: rgba(255, 255, 255, 0.03);
  --table-text: #E2E8F0;

  --input-bg: #111C2E;
  --input-border: #2A3A52;
  --input-text: #F8FAFC;
  --input-focus-border: #0E7490;
  --input-focus-ring: rgba(14, 116, 144, 0.25);

  --bg: #0B1320;
  --surface: #111C2E;
  --surface-2: #16243B;
  --border: #2A3A52;
  --border-strong: #475569;
  --text: #F1F5F9;
  --text-2: #94A3B8;
  --text-muted: #64748B;
  --heading: #F8FAFC;
  --primary: #0E7490;
  --primary-hover: #0891B2;
  --link: #38BDF8;
  --header-band: #0B192C;
  --accent: #06B6D4;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #38BDF8;
  --focus: #0E7490;

  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --modal-overlay: rgba(0, 0, 0, 0.75);

  /* Semantic Attendance Codes (Dark) */
  --code-d-color: #E6EEF0;
  --code-d-bg: rgba(230, 238, 240, 0.08);
  --code-n-color: #9DB4FF;
  --code-n-bg: rgba(157, 180, 255, 0.15);
  --code-off-color: #FF9A92;
  --code-off-bg: rgba(255, 154, 146, 0.18);
  --code-s-color: #FFBE73;
  --code-s-bg: rgba(255, 190, 115, 0.15);
  --code-b-color: #D6A6FF;
  --code-b-bg: rgba(214, 166, 255, 0.15);

  /* Severity Chips (Dark) */
  --chip-critical-bg: rgba(255, 142, 133, 0.16);
  --chip-critical-text: #FF8E85;
  --chip-high-bg: rgba(245, 162, 93, 0.16);
  --chip-high-text: #F5A25D;
  --chip-medium-bg: rgba(240, 176, 96, 0.16);
  --chip-medium-text: #F0B060;
  --chip-low-bg: rgba(16, 185, 129, 0.16);
  --chip-low-text: #10B981;
}

/* 5. ALWAYS-LIGHT PRINT & EXPORT OVERRIDE */
@media print {
  :root, body, [data-theme="dark"], [data-theme="light"] {
    --bg: #FFFFFF !important;
    --surface: #FFFFFF !important;
    --surface-2: #F6F8FB !important;
    --border: #C9D1DB !important;
    --border-strong: #000000 !important;
    --text: #000000 !important;
    --text-2: #333333 !important;
    --text-muted: #555555 !important;
    --heading: #000000 !important;
    --primary: #235F63 !important;
    --header-band: #12263F !important;
    color: #000000 !important;
    background: #FFFFFF !important;
  }
}

/* 6. TABULAR NUMERALS UTILITY */
.tabular-nums,
table,
.metric-value,
.timer-display,
.kpi-value,
.code-badge {
  font-variant-numeric: tabular-nums;
  -moz-font-feature-settings: "tnum";
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
}

/* 7. FOCUS VISIBLE ACCESSIBILITY OUTLINE */
:focus-visible {
  outline: 2px solid var(--focus) !important;
  outline-offset: 2px !important;
}

/* 8. PREFERS-REDUCED-MOTION */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
