/* ===================================================================
 * brand.css — Research Egypt brand layer for the Research HR System
 * ===================================================================
 * Loaded LAST on every page, so it re-maps the app's existing tokens
 * (--primary, --brand, --accent, --surface…) to the company palette
 * without touching each component file.
 *
 * Palette (same as the company website, docs/BRAND.md):
 *   Navy   #0D1940  primary — sidebar/login ground, headings, logo on light
 *   Blue   #084887  secondary — buttons, links, focus rings (white on blue 9.2:1)
 *   Orange #F58220  accent ONLY — small markers (active item, short rule under a title).
 *          Never body text on white (2.6:1). Orange as text on light uses
 *          #D96A0B (large) / #B45309 (small); on dark grounds the brand orange itself.
 * Type: Cairo first (Arabic interface), Montserrat for Latin. No letter-spacing on Arabic.
 * Every colour below is defined for both themes (light :root, dark html[data-theme="dark"]).
 * =================================================================== */

:root {
  /* brand */
  --brand-navy: #0D1940;
  --brand-blue: #084887;
  --brand-orange: #F58220;
  --brand-white: #FFFFFF;

  /* app tokens re-mapped to the brand */
  --primary: #0D1940;
  --primary-light: #084887;
  --brand: #0D1940;
  --brand-strong: #084887;
  --accent: #084887;            /* interactive accent = Blue (as on the website) */
  --accent-hover: #063A70;
  --accent-blue-light: #1F66AE;
  --accent-2: #F58220;          /* Orange: highlights only */
  --orange-text: #B45309;       /* orange as small text on light grounds (5.0:1) */
  --orange-text-lg: #D96A0B;    /* orange as large text on light grounds */
  --on-accent: #FFFFFF;

  --bg-color: #F4F6FA;          /* cool off-white page ground (website --paper) */
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --surface-3: #EEF2F8;
  --overlay: rgba(13, 25, 64, 0.5);
  --text-main: #0D1940;
  --text-muted: #4A5578;        /* 6.8:1 on the ground */
  --border: #DCE2EE;
  --focus-ring: #084887;

  --font-ar: 'Cairo', 'Montserrat', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --font-en: 'Montserrat', 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --glass-bg: rgba(255, 255, 255, 0.88);
}

html[data-theme="dark"] {
  --primary: #8DB9EA;
  --primary-light: #5B9BE0;
  --brand: #0D1940;
  --brand-strong: #2F6FBF;
  --accent: #2F6FBF;            /* white text on it 5.1:1 */
  --accent-hover: #1F66AE;
  --accent-blue-light: #5B9BE0;
  --accent-2: #F58220;
  --orange-text: #F58220;       /* brand orange on the dark ground 6.6:1 */
  --orange-text-lg: #F58220;
  --on-accent: #FFFFFF;

  --bg-color: #0A1330;
  --surface: #0D1940;
  --surface-2: #12204F;
  --surface-3: #1A2B63;
  --overlay: rgba(0, 0, 0, 0.6);
  --text-main: #EAF0FA;
  --text-muted: #A9B6D3;
  --border: rgba(234, 240, 250, 0.14);
  --focus-ring: #5B9BE0;
  --glass-bg: rgba(13, 25, 64, 0.88);
}

/* Dark grounds inside the light theme (navy sidebar, login visual, splash, navy cards):
   orange text may use the brand orange itself, blue text needs the light blue. */
.sidebar, .lp-visual, .splash-overlay, .home-hero, .re-ground-dark,
body.login-page, .lp-form-side {
  --orange-text: #F58220;
  --orange-text-lg: #F58220;
  --link-on-dark: #8DB9EA;
}

/* ─── Type ─── */
/* zero-specificity selectors, so icon-font classes (.fas …) keep their own family */
:where(html, body, *) { font-family: var(--font-ar); }
:where([lang="en"], [lang="en"] *, input[type="email"], input[type="url"], input[dir="ltr"], .re-latin) {
  font-family: var(--font-en);
}
:where(code, pre, kbd, samp, .mono) { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

body { background-color: var(--bg-color); color: var(--text-main); line-height: 1.55; }

/* No letter-spacing on Arabic text (it breaks the joined letters). Latin labels that
   keep tracking carry lang="en". */
html[lang="ar"] body *:not([lang="en"]):not([lang="en"] *) { letter-spacing: normal !important; }

/* ─── Brand logo ─── */
.re-logo { display: block; height: auto; max-width: 100%; }
.re-logo-sidebar { width: 156px; margin-inline: auto; }
.re-symbol-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-navy); border-radius: 10px; padding: 6px;
}
.re-symbol-badge img { width: 100%; height: 100%; display: block; }

/* ─── Buttons & focus ─── */
.btn-primary, .btn-accent { background-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover, .btn-accent:hover { background-color: var(--accent-hover); color: var(--on-accent); }
.btn-hover-effect:hover { box-shadow: 0 8px 15px rgba(8, 72, 135, 0.25); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.form-control:focus, input:focus, select:focus, textarea:focus { border-color: var(--accent); }
a { color: inherit; }

/* ─── Sidebar (navy ground, orange active marker like the website dashboard) ─── */
.sidebar { background-color: var(--brand-navy); }
.sidebar .nav-item.active { border-right: 0; box-shadow: inset -4px 0 0 var(--brand-orange); }
html[dir="ltr"] .sidebar .nav-item.active { box-shadow: inset 4px 0 0 var(--brand-orange); }
.sidebar-header { border-bottom-color: rgba(255, 255, 255, 0.1); }

/* Short orange rule under page / section titles (the brand book's heading marker) */
.re-title-rule::after {
  content: ''; display: block; width: 40px; height: 3px; border-radius: 2px;
  background: var(--brand-orange); margin-top: 0.45rem;
}

/* ─── Readable sizes: nothing under 12px ─── */
small, .small, .text-xs { font-size: max(12px, 0.75rem); }

/* ─── Phones: 44px tap targets ─── */
@media (max-width: 768px), (pointer: coarse) {
  button, .btn, [role="button"], .nav-item, select,
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]):not([type="color"]) {
    min-height: 44px;
  }
  .modal-close, .header-icon-btn, .header-profile-btn, .icon-btn, .btn-icon, .menu-toggle,
  .notif-btn, .theme-toggle, button.close, .lp-pw-toggle {
    min-width: 44px; min-height: 44px;
  }
  input[type="checkbox"], input[type="radio"] { min-width: 20px; min-height: 20px; }
}

/* ─── Reduced motion: show the final state, no movement ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Employee home hero (navy ground) ─── */
.home-hero { background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-blue) 100%); }
.home-hero .home-att-btn:not(.outgoing):not(.btn-out-of-fence):not(:disabled) {
  background: #FFFFFF; color: var(--brand-navy); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
/* amber "outside the fence" state: navy text on amber (white on amber is unreadable) */
.btn-out-of-fence { color: var(--brand-navy) !important; }

/* ─── Version badge: small, and never on top of the phone bottom navigation ─── */
#oafVersionBadge { min-height: 0 !important; min-width: 0 !important; }
/* نص أبيض على كحلي سادة (الشفافية + opacity .5 كانت بتنزّل التباين تحت 4.5:1) */
#oafVersionBadge { background: #0D1940 !important; opacity: 1 !important; }
@media (max-width: 768px) {
  body:has(.bottom-nav-simple) #oafVersionBadge,
  body:has(.bottom-nav) #oafVersionBadge { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ─── Top bar menus (admin) ───
   task-summary.css forces `.topbar { overflow: hidden !important }`, which clipped the
   notifications and profile dropdowns to the 56px bar — the bell "didn't open". The bar's
   own zones already keep their content in bounds, so the bar itself may overflow. */
.topbar { overflow: visible !important; position: relative; z-index: 30; }
.topbar .notif-dropdown, .topbar .header-dropdown { z-index: 1001; }

/* Notification count: a readable pill, not a number squeezed into a 10px dot */
.notif-badge:not(:empty) {
  width: auto; height: 18px; min-width: 18px;
  padding: 0 5px; top: 2px; right: auto; inset-inline-end: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #B91C1C; color: #FFFFFF;          /* white on #B91C1C = 6.5:1 */
  font-size: 12px; font-weight: 700; line-height: 1; font-family: var(--font-en);
  border-radius: 9px; border: 2px solid var(--surface); box-shadow: none;
}

/* بوابة الموظف على الموبايل: شارة النسخة كانت بتغطي آخر سطر فوق القائمة اللي تحت.
   «فرض التحديث» لسه متاح من الكمبيوتر ومن لوحة الأدمن. */
@media (max-width: 768px) {
  body:has(.bottom-nav-simple) #oafVersionBadge { display: none !important; }
}
