/* ==========================================================================
   BFA Design System — Laravel layer
   أكاديمية فتنس البحرين / Bahrain Fitness Academy

   DIRECTION MODEL (carried over from the Execution 01 prototype, mandatory):
   Layout direction is driven ONLY by the `dir` attribute on <html>, which the
   Blade layout derives from the locale.
     dir="rtl" (Arabic)  -> sidebar on the RIGHT, navigation starts RIGHT
     dir="ltr" (English) -> sidebar on the LEFT,  navigation starts LEFT

   All spacing, borders and insets use CSS LOGICAL PROPERTIES so the same rules
   produce the mirrored layout. Never hardcode `left`/`right` for geometry.

   COLOUR PROVENANCE: tokens are PROVISIONAL, carried over from the prototype and
   NOT verified against the official brand asset (blocker B-08).
   ========================================================================== */

:root {
  --bfa-red: #e31229;
  --bfa-red-strong: #da1027;
  --bfa-red-soft: #fff0f1;

  --bfa-ink-900: #101924;
  --bfa-ink-700: #253244;
  --bfa-ink-600: #46556a;
  /* Muted body text. Darkened from #8994a3, which measured 2.71–3.08:1 against
     the light surfaces it is used on and failed WCAG AA (4.5:1) — axe reported
     it as a serious violation on the dashboard, the CPD register and the coach
     profile. #5f6877 measures 4.97:1 against the darkest of those surfaces
     (#eef1f5) and 5.63:1 against white, so it clears AA everywhere the token is
     used while still reading as secondary text rather than body copy.
     Guarded by StylesheetContrastTest. */
  --bfa-ink-400: #5f6877;
  --bfa-line: #e4e8ed;
  --bfa-surface: #ffffff;
  --bfa-surface-alt: #f8fafc;
  --bfa-canvas: #f3f5f8;
  --bfa-on-dark: #e2e6eb;
  --bfa-on-dark-muted: #aebbc7;

  --bfa-success-bg: #e1f5ed;
  --bfa-success-fg: #097449;
  --bfa-warning-bg: #fff0cf;
  --bfa-warning-fg: #915900;
  --bfa-danger-bg: #fee5e6;
  --bfa-danger-fg: #bf2130;
  --bfa-info-bg: #e8f0fe;
  --bfa-info-fg: #1a4fa0;
  --bfa-focus: #1f6feb;

  /* Tajawal first (self-hosted, see public/fonts/tajawal/README.md), then a
     system stack that renders acceptably before the webfont swaps in and that
     covers Latin copy in both locales. The fallback deliberately keeps an
     Arabic-capable face (Tahoma/Noto Naskh) so Arabic never falls through to a
     font that cannot shape it. */
  --bfa-font-sans: 'Tajawal', 'Noto Naskh Arabic', Tahoma, Arial, 'Segoe UI', system-ui, -apple-system, sans-serif;
  --bfa-fs-sm: 12px;
  --bfa-fs-base: 13px;
  --bfa-fs-md: 15px;
  --bfa-fs-lg: 17px;
  --bfa-fs-xl: 22px;

  --bfa-space-1: 4px;
  --bfa-space-2: 8px;
  --bfa-space-3: 12px;
  --bfa-space-4: 16px;
  --bfa-space-5: 20px;
  --bfa-space-6: 24px;

  --bfa-radius-sm: 8px;
  --bfa-radius-md: 10px;
  --bfa-radius-pill: 99px;
  --bfa-shadow-sm: 0 2px 12px #101a3010;
  --bfa-shadow-md: 0 8px 30px #101a3022;

  --bfa-sidebar-width: 265px;
  --bfa-content-max: 1400px;
}

* { box-sizing: border-box; }

body.bfa {
  margin: 0;
  font-family: var(--bfa-font-sans);
  font-size: var(--bfa-fs-base);
  line-height: 1.6;
  color: var(--bfa-ink-900);
  background: var(--bfa-canvas);
}

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

.bfa-skip {
  position: absolute;
  inset-block-start: -100px;
  inset-inline-start: var(--bfa-space-4);
  z-index: 200;
  padding: var(--bfa-space-3) var(--bfa-space-5);
  background: var(--bfa-ink-900);
  color: #fff;
  border-radius: var(--bfa-radius-sm);
  text-decoration: none;
}
.bfa-skip:focus { inset-block-start: var(--bfa-space-3); }

/* ---------------------------------------------------------------- shell ---- */
.bfa-shell {
  display: grid;
  grid-template-columns: var(--bfa-sidebar-width) 1fr;
  min-block-size: 100vh;
}

/* ------------------------------------------------------------------------
   Sidebar placement uses grid flow, which follows the writing direction.
   In RTL the first column is on the RIGHT, in LTR on the LEFT. No `left` or
   `right` is written anywhere, so both directions are correct by construction.
   ------------------------------------------------------------------------ */
.bfa-sidebar {
  background: var(--bfa-ink-900);
  color: var(--bfa-on-dark);
  padding: var(--bfa-space-5) var(--bfa-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--bfa-space-6);
}

.bfa-brand { display: flex; align-items: center; gap: var(--bfa-space-3); }
.bfa-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 46px;
  block-size: 46px;
  border-radius: var(--bfa-radius-md);
  background: var(--bfa-red);
  color: #fff;
  font-weight: 700;
  letter-spacing: .5px;
  flex: none;
}
.bfa-brand-text { display: flex; flex-direction: column; }
.bfa-brand-text strong { font-size: var(--bfa-fs-md); color: #fff; }
.bfa-brand-text small { color: var(--bfa-on-dark-muted); font-size: 10px; letter-spacing: .8px; }

.bfa-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bfa-nav-link {
  display: block;
  padding: var(--bfa-space-3) var(--bfa-space-4);
  color: var(--bfa-on-dark);
  text-decoration: none;
  border-radius: var(--bfa-radius-sm);
  /* Logical border: appears on the reading-start edge in both directions. */
  border-inline-start: 3px solid transparent;
}
.bfa-nav-link:hover { background: #ffffff12; color: #fff; }
.bfa-nav-link.is-active {
  background: #ffffff1a;
  color: #fff;
  border-inline-start-color: var(--bfa-red);
}

.bfa-sidebar-foot { margin-block-start: auto; color: var(--bfa-on-dark-muted); font-size: 10px; }

/* ---------------------------------------------------------------- body ----- */
.bfa-body { display: flex; flex-direction: column; min-inline-size: 0; }

.bfa-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--bfa-space-4);
  padding: var(--bfa-space-4) var(--bfa-space-6);
  background: var(--bfa-surface);
  border-block-end: 1px solid var(--bfa-line);
}
.bfa-topbar-end { display: flex; align-items: center; gap: var(--bfa-space-4); }
.bfa-user { color: var(--bfa-ink-600); }
.bfa-inline-form { margin: 0; }
.bfa-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--bfa-line);
  border-radius: var(--bfa-radius-sm);
  padding: var(--bfa-space-2) var(--bfa-space-3);
  cursor: pointer;
  font-size: var(--bfa-fs-md);
}
.bfa-lang {
  color: var(--bfa-red-strong);
  text-decoration: none;
  font-weight: 600;
}

.bfa-main {
  padding: var(--bfa-space-6);
  max-inline-size: var(--bfa-content-max);
  inline-size: 100%;
  flex: 1;
}
.bfa-footer {
  padding: var(--bfa-space-5) var(--bfa-space-6);
  color: var(--bfa-ink-400);
  font-size: var(--bfa-fs-sm);
  border-block-start: 1px solid var(--bfa-line);
}

/* --------------------------------------------------------------- states ---- */
.bfa-demo-banner {
  background: var(--bfa-warning-bg);
  color: var(--bfa-warning-fg);
  padding: var(--bfa-space-3) var(--bfa-space-4);
  border-radius: var(--bfa-radius-sm);
  margin-block-end: var(--bfa-space-5);
  font-weight: 600;
}
.bfa-alert { padding: var(--bfa-space-3) var(--bfa-space-4); border-radius: var(--bfa-radius-sm); margin-block-end: var(--bfa-space-4); }
.bfa-alert-success { background: var(--bfa-success-bg); color: var(--bfa-success-fg); }
.bfa-alert-error { background: var(--bfa-danger-bg); color: var(--bfa-danger-fg); }
.bfa-alert-warning { background: var(--bfa-warning-bg); color: var(--bfa-warning-fg); }
.bfa-alert-info { background: var(--bfa-info-bg); color: var(--bfa-info-fg); }
.bfa-error-list { margin: 0; padding-inline-start: var(--bfa-space-5); }
.bfa-empty { padding: var(--bfa-space-6); text-align: center; color: var(--bfa-ink-400); }

/* ---------------------------------------------------------------- cards ---- */
.bfa-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--bfa-space-4); margin-block-end: var(--bfa-space-6); }
.bfa-card {
  background: var(--bfa-surface);
  border: 1px solid var(--bfa-line);
  border-radius: var(--bfa-radius-md);
  padding: var(--bfa-space-5);
  box-shadow: var(--bfa-shadow-sm);
}
.bfa-card-label { color: var(--bfa-ink-500, #657487); font-size: var(--bfa-fs-sm); }
.bfa-card-value { font-size: var(--bfa-fs-xl); font-weight: 700; margin-block-start: var(--bfa-space-2); }

.bfa-panel {
  background: var(--bfa-surface);
  border: 1px solid var(--bfa-line);
  border-radius: var(--bfa-radius-md);
  padding: var(--bfa-space-5);
  margin-block-end: var(--bfa-space-5);
}
.bfa-panel-title { margin-block-start: 0; font-size: var(--bfa-fs-lg); }
.bfa-panel-subtitle { margin-block-end: var(--bfa-space-2); font-size: var(--bfa-fs-md); color: var(--bfa-ink-700); }

/* --------------------------------------------------------------- tables ---- */
.bfa-table-wrap { overflow-x: auto; background: var(--bfa-surface); border: 1px solid var(--bfa-line); border-radius: var(--bfa-radius-md); }
.bfa-table { inline-size: 100%; border-collapse: collapse; }
.bfa-table th, .bfa-table td {
  /* `start` follows the writing direction: right in Arabic, left in English. */
  text-align: start;
  padding: var(--bfa-space-3) var(--bfa-space-4);
  border-block-end: 1px solid var(--bfa-line);
}
.bfa-table th { background: var(--bfa-surface-alt); font-weight: 600; color: var(--bfa-ink-600); }
.bfa-table tbody tr:last-child td { border-block-end: 0; }

/* ---------------------------------------------------------------- badges --- */
.bfa-badge {
  display: inline-block;
  padding: 2px var(--bfa-space-3);
  border-radius: var(--bfa-radius-pill);
  font-size: var(--bfa-fs-sm);
  font-weight: 600;
}
.bfa-badge-success { background: var(--bfa-success-bg); color: var(--bfa-success-fg); }
.bfa-badge-warning { background: var(--bfa-warning-bg); color: var(--bfa-warning-fg); }
.bfa-badge-danger  { background: var(--bfa-danger-bg);  color: var(--bfa-danger-fg); }
.bfa-badge-info    { background: var(--bfa-info-bg);    color: var(--bfa-info-fg); }
.bfa-badge-muted   { background: var(--bfa-line);       color: var(--bfa-ink-600); }

/* --------------------------------------------------------------- buttons --- */
.bfa-btn {
  display: inline-block;
  padding: var(--bfa-space-2) var(--bfa-space-4);
  border-radius: var(--bfa-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: var(--bfa-fs-base);
  font-family: inherit;
  text-decoration: none;
}
.bfa-btn-primary { background: var(--bfa-red); color: #fff; }
.bfa-btn-primary:hover { background: var(--bfa-red-strong); }
.bfa-btn-ghost { background: transparent; border-color: var(--bfa-line); color: var(--bfa-ink-600); }
.bfa-btn-danger { background: var(--bfa-danger-bg); color: var(--bfa-danger-fg); }
.bfa-btn-link { background: transparent; border: 0; color: var(--bfa-ink-600); padding-inline: 0; text-decoration: underline; }

/* ----------------------------------------------------------------- forms --- */
.bfa-field { margin-block-end: var(--bfa-space-4); }
.bfa-field label { display: block; margin-block-end: var(--bfa-space-2); font-weight: 600; }
.bfa-input, .bfa-select, .bfa-textarea {
  inline-size: 100%;
  padding: var(--bfa-space-3);
  border: 1px solid var(--bfa-line);
  border-radius: var(--bfa-radius-sm);
  font-family: inherit;
  font-size: var(--bfa-fs-base);
}
/* ------------------------------------------------------ profile progress --- */
.bfa-completion-figure {
  display: flex;
  align-items: baseline;
  gap: var(--bfa-space-3);
  margin: 0 0 var(--bfa-space-2);
}
.bfa-completion-figure strong { font-size: var(--bfa-fs-xl); color: var(--bfa-red); }

/* Native <progress>, so the value is exposed to assistive technology without a
   custom ARIA role. Styled with logical properties only; nothing here hardcodes
   a side, so the bar fills from the reading-start edge in both directions. */
.bfa-progress {
  inline-size: 100%;
  block-size: 10px;
  border: none;
  border-radius: var(--bfa-radius-pill);
  background: var(--bfa-surface-alt);
  overflow: hidden;
  margin-block-end: var(--bfa-space-3);
}
.bfa-progress::-webkit-progress-bar { background: var(--bfa-surface-alt); border-radius: var(--bfa-radius-pill); }
.bfa-progress::-webkit-progress-value { background: var(--bfa-red); border-radius: var(--bfa-radius-pill); }
.bfa-progress::-moz-progress-bar { background: var(--bfa-red); border-radius: var(--bfa-radius-pill); }

.bfa-hint { color: var(--bfa-ink-400); font-size: var(--bfa-fs-sm); }

/* ----------------------------------------------------------------- auth ---- */
.bfa-auth-wrap { min-block-size: 100vh; display: grid; place-items: center; background: var(--bfa-canvas); padding: var(--bfa-space-5); }
.bfa-auth-card { inline-size: 100%; max-inline-size: 420px; background: var(--bfa-surface); border: 1px solid var(--bfa-line); border-radius: var(--bfa-radius-md); padding: var(--bfa-space-6); box-shadow: var(--bfa-shadow-md); }
.bfa-auth-head { text-align: center; margin-block-end: var(--bfa-space-5); }


/* ==========================================================================
   Execution 03 — operational dashboard components

   Every declaration below uses LOGICAL properties (inline-start/end,
   block-start/end, text-align: start). No `left`, `right`, `margin-left` or
   `text-align: left` appears, so Arabic RTL and English LTR both render
   correctly from one rule set. The sidebar side is decided by grid flow in the
   shell above, which follows the writing direction.
   ========================================================================== */

/* ---------------------------------------------------------- page heading --- */
.bfa-page-head { margin-block-end: var(--bfa-space-5); }
.bfa-page-head h1 { margin: 0 0 var(--bfa-space-2); font-size: var(--bfa-fs-xl); }
.bfa-section-title {
  font-size: var(--bfa-fs-md);
  color: var(--bfa-ink-600);
  margin-block: var(--bfa-space-5) var(--bfa-space-3);
  padding-block-end: var(--bfa-space-2);
  border-block-end: 1px solid var(--bfa-line);
}

/* --------------------------------------------------- metric card variants -- */
/* A metric card that navigates: the whole card is the target, so the affordance
   must be visible without relying on the cursor. */
.bfa-card-link { display: block; text-decoration: none; color: inherit; }
.bfa-card-link:hover { border-color: var(--bfa-red); box-shadow: var(--bfa-shadow-md); }
.bfa-card-link::after {
  content: "←";
  display: block;
  margin-block-start: var(--bfa-space-2);
  color: var(--bfa-red-strong);
  font-size: var(--bfa-fs-sm);
}
/* In LTR the affordance points the other way, matching reading direction. */
html[dir="ltr"] .bfa-card-link::after { content: "→"; }

.bfa-card-note { margin-block-start: var(--bfa-space-2); color: var(--bfa-ink-400); font-size: var(--bfa-fs-sm); }

/* A blocked metric must not look like a normal figure. Dashed border and muted
   value so it cannot be mistaken for a count of zero. */
.bfa-card-blocked {
  background: var(--bfa-surface-alt);
  border-style: dashed;
  border-color: var(--bfa-ink-400);
}
.bfa-card-value-blocked { font-size: var(--bfa-fs-md); color: var(--bfa-ink-600); }

/* ----------------------------------------------------------- list / dl ----- */
.bfa-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--bfa-space-2); }
.bfa-list li { display: flex; align-items: center; gap: var(--bfa-space-3); flex-wrap: wrap; }

.bfa-dl { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: var(--bfa-space-2) var(--bfa-space-4); margin: 0; }
.bfa-dl dt { color: var(--bfa-ink-600); font-weight: 600; }
.bfa-dl dd { margin: 0; }

/* ------------------------------------------------------------- panels ------ */
.bfa-panel-warning { border-inline-start: 4px solid var(--bfa-warning-fg); background: var(--bfa-warning-bg); }

/* --------------------------------------------------------- filter bar ------ */
.bfa-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--bfa-space-3);
  padding: var(--bfa-space-4);
  background: var(--bfa-surface);
  border: 1px solid var(--bfa-line);
  border-radius: var(--bfa-radius-md);
  margin-block-end: var(--bfa-space-5);
}
.bfa-filters .bfa-field { margin-block-end: 0; }

/* ------------------------------------------------------------ actions ------ */
.bfa-actions { display: flex; flex-wrap: wrap; gap: var(--bfa-space-2); align-items: center; }

/* --------------------------------------------------------- pagination ------ */
.bfa-pagination { margin-block-start: var(--bfa-space-5); }
.bfa-pagination nav { display: flex; gap: var(--bfa-space-2); flex-wrap: wrap; }
.bfa-pagination a, .bfa-pagination span {
  padding: var(--bfa-space-2) var(--bfa-space-3);
  border: 1px solid var(--bfa-line);
  border-radius: var(--bfa-radius-sm);
  text-decoration: none;
  color: var(--bfa-ink-600);
  background: var(--bfa-surface);
}
.bfa-pagination .is-current { background: var(--bfa-ink-900); color: #fff; border-color: var(--bfa-ink-900); }
.bfa-pagination .is-disabled { opacity: 0.5; cursor: not-allowed; }

/* --------------------------------------------------------- form grid ------- */
/* .bfa-form is a semantic marker on every <form> in the app: it carries no
   styling of its own (layout comes from .bfa-form-grid inside it), but it is
   declared so the class set is complete and a class-integrity check can treat
   it as intentional rather than as a typo. */
.bfa-form { display: block; }
.bfa-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--bfa-space-4); }
.bfa-form-grid .bfa-field { margin-block-end: 0; }
.bfa-field-error { color: var(--bfa-danger-fg); font-size: var(--bfa-fs-sm); margin-block-start: var(--bfa-space-1); }
.bfa-checkbox-row { display: flex; align-items: center; gap: var(--bfa-space-2); }

/* --------------------------------------------------------- notice box ------ */
/* Used for "blocked pending a business decision" copy. Deliberately neutral so
   it reads as information, not as a system error. */
.bfa-notice {
  padding: var(--bfa-space-4);
  border: 1px dashed var(--bfa-ink-400);
  border-radius: var(--bfa-radius-md);
  background: var(--bfa-surface-alt);
  color: var(--bfa-ink-700);
  margin-block-end: var(--bfa-space-4);
}
.bfa-notice-title { font-weight: 700; margin-block-end: var(--bfa-space-2); }

/* --------------------------------------------------------- status pills ---- */
.bfa-pill { display: inline-block; padding: 2px var(--bfa-space-2); border-radius: var(--bfa-radius-sm); font-size: var(--bfa-fs-sm); background: var(--bfa-line); color: var(--bfa-ink-700); }

/* ------------------------------------------------------------ mobile ------- */
@media (max-width: 640px) {
  .bfa-main { padding: var(--bfa-space-4); }
  .bfa-cards { grid-template-columns: 1fr; }
  .bfa-dl { grid-template-columns: 1fr; gap: var(--bfa-space-1); }
  .bfa-dl dt { margin-block-start: var(--bfa-space-2); }
  .bfa-filters { flex-direction: column; align-items: stretch; }
  .bfa-table th, .bfa-table td { padding: var(--bfa-space-2) var(--bfa-space-3); }
}

/* ------------------------------------------------------------ responsive --- */
@media (max-width: 900px) {
  .bfa-shell { grid-template-columns: 1fr; }
  .bfa-sidebar { display: none; }
  .bfa-sidebar.is-open { display: flex; }
  .bfa-menu-btn { display: inline-block; }
}

/* ------------------------------------------------------------ a11y focus --- */
:focus-visible { outline: 2px solid var(--bfa-focus); outline-offset: 2px; }

/* ------------------------------------------------------- inline disclosure ---
   A native <details>/<summary> so the control is keyboard operable and announced
   correctly without JavaScript. Used where a destructive or reasoned action
   needs a small confirmation form (guardian revocation). */
.bfa-disclosure > summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--bfa-space-1);
  list-style: none;
}
.bfa-disclosure > summary::-webkit-details-marker { display: none; }
.bfa-disclosure[open] > summary { margin-block-end: var(--bfa-space-2); }
.bfa-disclosure .bfa-form-compact {
  display: grid;
  gap: var(--bfa-space-2);
  max-inline-size: 32rem;
  padding: var(--bfa-space-3);
  background: var(--bfa-surface-alt);
  border: 1px solid var(--bfa-line);
  border-radius: var(--bfa-radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .bfa-sidebar, .bfa-topbar, .bfa-footer, .bfa-demo-banner { display: none !important; }
  .bfa-shell { grid-template-columns: 1fr; }
}

.bfa-login-03686026df {width:110px;max-width:100%;height:auto;object-fit:contain;}

.bfa-sidebar-logo { width:72px; max-height:72px; object-fit:contain; flex-shrink:0; }
