/* ============================================================
   Saleem Events — shared theme

   Brand colours sampled directly from assets/brand/saleem-logo.png:
     #003260 navy  (86.7% of logo pixels — the wordmark)
     #1c75bc blue  (5.9%  — the checkmark)
   Orange #f58220 is the approved secondary accent.

   Three colour systems, kept deliberately independent — never
   reuse one for another's job, or the UI stops meaning anything:
     1. brand      navy / blue / orange   → identity, actions
     2. status     amber/green/red/purple → application state
     3. occupancy  green/yellow/red       → seats & tables

   Weights run heavier than typical on purpose: the HR team read
   the first build as too light.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* base — cool greys, tuned to sit under navy */
  --bg: #f2f6fa;
  --surface: #ffffff;
  --surface-sunken: #eef3f8;
  --surface-raised: #ffffff;
  --border: #dce6ef;
  --border-strong: #c2d2e0;
  --text: #0d2033;
  --text-muted: #667d90;
  --text-faint: #8a9aaa;

  /* brand — sampled from the logo */
  --navy: #003260;
  --blue: #1c75bc;
  --orange: #f58220;

  --brand: var(--navy);
  --brand-hover: #002344;
  --brand-tint: #e9f1f8;
  --brand-tint-strong: #cfe1f0;
  --brand-contrast: #ffffff;

  /* interactive blue — links, focus, secondary actions */
  --accent: var(--blue);
  --accent-hover: #155e97;
  --accent-tint: #e3f2fc;

  /* orange accent — highlights that must never read as a status */
  --accent-2: var(--orange);
  --accent-2-hover: #d96f12;
  --accent-2-tint: #fef1e5;
  --accent-2-tint-strong: #fbdcbe;

  /* application status (own family). Check-in is purple, not blue, so it
     can't be confused with the brand; amber sits clear of the orange. */
  --status-pending: #a86d12;
  --status-pending-tint: #fbf1de;
  --status-approved: #1f8a5f;
  --status-approved-tint: #e2f3ec;
  --status-rejected: #b3492f;
  --status-rejected-tint: #f9e8e3;
  --status-checked-in: #6b4fa1;
  --status-checked-in-tint: #eee9f7;
  --status-waitlisted: #0e8a8a;
  --status-waitlisted-tint: #e0f4f4;

  /* occupancy scale — seats & tables (own family, green→yellow→red) */
  --occ-empty: #2f9e6e;
  --occ-empty-tint: #e4f5ee;
  --occ-partial: #d4a017;
  --occ-partial-tint: #fbf2dc;
  --occ-full: #c0392b;
  --occ-full-tint: #fae9e6;

  /* live status */
  --live-on: #22a06b;
  --live-off: #c0392b;

  /* typography */
  --font-en: 'Inter', -apple-system, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', -apple-system, 'Geeza Pro', Tahoma, sans-serif;

  /* geometry */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* elevation — shadows tinted navy, not neutral black */
  --shadow-sm: 0 1px 2px rgba(0, 50, 96, .07), 0 1px 3px rgba(0, 50, 96, .05);
  --shadow-md: 0 4px 12px rgba(0, 50, 96, .10), 0 2px 4px rgba(0, 50, 96, .05);
  --shadow-lg: 0 22px 70px rgba(0, 50, 96, .16), 0 4px 8px rgba(0, 50, 96, .06);
  --shadow-brand: 0 6px 20px rgba(0, 50, 96, .28);
  --shadow-accent: 0 6px 20px rgba(245, 130, 32, .30);

  /* motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: 120ms;
  --t-med: 220ms;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  font-weight: 500;              /* heavier base — HR feedback */
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body[dir="ltr"] { font-family: var(--font-en); }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

p { margin: 0; }
a { color: var(--brand); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; font-weight: inherit; }

/* Logical properties throughout, so RTL/LTR flip is free. */

/* ---------- layout helpers ---------- */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-5 { gap: 24px; } .gap-6 { gap: 32px; }
.grow { flex: 1; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ---------- card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  color: var(--brand-contrast);
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover:not([disabled]) { background: var(--brand-hover); }

.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(28, 117, 188, .28);
}
.btn-accent:hover:not([disabled]) { background: var(--accent-hover); }

.btn-orange {
  background: var(--accent-2);
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.btn-orange:hover:not([disabled]) { background: var(--accent-2-hover); }

.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover:not([disabled]) { background: var(--surface-sunken); }

.btn-quiet { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-quiet:hover:not([disabled]) { background: var(--surface-sunken); color: var(--text); }

.btn-approve { background: var(--status-approved); color: #fff; }
.btn-approve:hover:not([disabled]) { filter: brightness(.92); }
.btn-reject { background: var(--status-rejected); color: #fff; }
.btn-reject:hover:not([disabled]) { filter: brightness(.92); }

.btn-sm { padding: 6px 12px; font-size: .85rem; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; border-radius: var(--r-lg); }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
/* These live here, not in a page's <style> block: the HR portal's event
   editor, settings, check-in and broadcast all use them too. They were
   defined only in index.html, so every HR form rendered with no gaps and
   no two-column layout. */
.form-grid { display: grid; gap: 18px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }
.divider { height: 1px; background: var(--border); margin: 4px 0; }

.field { display: flex; flex-direction: column; gap: 7px; }
.label {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 5px;
}
.label .req { color: var(--status-rejected); font-weight: 700; }
.hint { font-size: .8rem; color: var(--text-muted); font-weight: 500; }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font-weight: 500;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint-strong);
}
.input[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: var(--status-rejected);
  box-shadow: 0 0 0 3px var(--status-rejected-tint);
}
.textarea { resize: vertical; min-height: 84px; }
.select { appearance: none; cursor: pointer; }

.err {
  font-size: .8rem;
  font-weight: 600;
  color: var(--status-rejected);
  min-height: 0;
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-pending { background: var(--status-pending-tint); color: var(--status-pending); }
.badge-approved { background: var(--status-approved-tint); color: var(--status-approved); }
.badge-rejected { background: var(--status-rejected-tint); color: var(--status-rejected); }
.badge-checked_in { background: var(--status-checked-in-tint); color: var(--status-checked-in); }
.badge-waitlisted { background: var(--status-waitlisted-tint); color: var(--status-waitlisted); }

/* ---------- logo ---------- */
/* One place for the real wordmark, so no page invents its own. */
.logo {
  height: 30px;
  width: auto;
  object-fit: contain;
  display: block;
}
.logo-lg { height: 46px; }
.logo-sm { height: 24px; }

/* The partner separator is the one place orange earns its keep on
   the public page — it ties Saleem to whoever we're partnered with. */
.partner-x {
  color: var(--accent-2);
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1;
}

/* ---------- live dot ---------- */
.live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: .82rem;
}
.live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
}
.live-on .live-dot {
  background: var(--live-on);
  box-shadow: 0 0 0 0 rgba(34, 160, 107, .6);
  animation: pulse 2s infinite var(--ease-out);
}
.live-on { color: var(--live-on); }
.live-off .live-dot { background: var(--live-off); }
.live-off { color: var(--live-off); }

@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(34, 160, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 160, 107, 0); }
}

/* ---------- lang toggle ---------- */
.lang-toggle {
  display: inline-flex;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.lang-toggle button {
  padding: 5px 14px;
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: .82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

/* ---------- toast ---------- */
.toast-host {
  position: fixed;
  inset-block-end: 24px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: .88rem;
  box-shadow: var(--shadow-lg);
  animation: toast-in var(--t-med) var(--ease-out);
}
.toast-ok { background: var(--status-approved); }
.toast-err { background: var(--status-rejected); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
}

/* ---------- misc ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/**
 * Numeric ratios ("166 / 200", "8/8").
 * In an RTL paragraph the bidi algorithm reorders the two number runs
 * around the neutral slash, so "166 / 200" displays as "200 / 166" —
 * i.e. exactly backwards. Isolate them as their own LTR run.
 */
.ratio {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

.spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
