/* ============================================================
   Salam Air Training — Design System
   Aesthetic: clean, modern aviation training. Salam Air's
   Mountain Green primary with Sea Shallows Blue accent on
   clean white surfaces. Fraunces for display, Inter for UI,
   JetBrains for data.
   ============================================================ */

:root {
  /* Brand — Salam Air official palette (verified from press.salamair.com).
     Mountain Green is the airline's primary color, used on liveries and signage.
     Sea Shallows Blue is the official secondary accent. */
  --green-900: #2E4F0E;   /* deepest, for high-contrast text on white */
  --green-800: #44731E;   /* darker accent, hover states */
  --green-700: #5A9128;   /* dark green */
  --green-600: #6BA42E;   /* medium-dark */
  --green-500: #81B43F;   /* PRIMARY — Salam Air Mountain Green (Pantone 377 C) */
  --green-400: #9CC865;   /* tints used for backgrounds */
  --green-300: #BEDB95;
  --green-200: #DCEBC0;
  --green-100: #EEF6DD;   /* faintest tint, subtle highlights */

  --blue-700: #00738A;    /* deep accent blue */
  --blue-500: #00ACCA;    /* Salam Air Sea Shallows (Pantone 3125 C) */
  --blue-300: #6DCEE0;
  --blue-100: #D6F2F8;    /* info background */

  /* Legacy aliases — kept so the rest of the codebase keeps compiling.
     Anywhere old code says var(--navy-700) it now picks up green.
     Anywhere it says var(--gold-500) it now picks up Salam Air green
     (because gold was used for primary CTAs and we want those green now). */
  --navy-900: #1A2F0A;
  --navy-800: #21380F;
  --navy-700: var(--green-800);
  --navy-600: var(--green-700);
  --navy-500: var(--green-600);

  --gold-700: var(--green-700);
  --gold-600: var(--green-600);
  --gold-500: var(--green-500);
  --gold-400: var(--green-400);
  --gold-300: var(--green-300);

  /* Surfaces — clean white-and-light, no warm paper tint */
  --ivory:   #FFFFFF;
  --paper:   #FFFFFF;
  --paper-2: #F6FAF1;     /* faint green-tinted off-white for cards on cards */
  --line:    #E5E9DF;     /* soft warm-gray with green undertone */
  --line-2:  #CCD4BE;

  /* Text */
  --ink-900: #0F1709;     /* near-black, slight green undertone */
  --ink-700: #2A3520;
  --ink-500: #5A6553;
  --ink-400: #7A8473;
  --ink-300: #B0B7AB;

  /* Semantic colors — adjusted to harmonize with green primary */
  --success: var(--green-700);   /* success = brand color naturally */
  --warning: #B4731B;
  --danger:  #C0392B;
  --info:    var(--blue-500);

  /* Type */
  --font-display: 'Fraunces', Georgia, serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* Geometry */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --radius-xl: 22px;

  /* Shadows — softened, neutral so they don't fight the green */
  --shadow-sm: 0 1px 2px rgba(15, 23, 9, 0.06), 0 1px 1px rgba(15, 23, 9, 0.04);
  --shadow:    0 4px 14px rgba(15, 23, 9, 0.08), 0 1px 2px rgba(15, 23, 9, 0.04);
  --shadow-lg: 0 22px 50px rgba(15, 23, 9, 0.16), 0 4px 14px rgba(15, 23, 9, 0.08);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-900);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  /* PWA: respect device notch/status bar when running as standalone app */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  /* Background that fills the safe-area zones so they don't look broken */
  background-color: var(--navy-800);
}
/* The actual app content sits on the paper background; safe area on body
   keeps the notch zone navy-colored to match the iOS status bar style */
#root { background: var(--paper); min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; color: var(--ink-900); }
h1 { font-size: 2rem; line-height: 1.15; }
h2 { font-size: 1.5rem; line-height: 1.2; }
h3 { font-size: 1.125rem; line-height: 1.25; }
h4 { font-size: 0.95rem; font-family: var(--font-ui); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-500); }
p { margin: 0; }
a { color: var(--navy-700); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--gold-600); }
button { font: inherit; cursor: pointer; }

/* ============================================================
   AUTH (Login)
   ============================================================ */
.auth-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper);
}
.auth-page__art {
  position: relative;
  background:
    radial-gradient(900px 600px at 30% 20%, rgba(129, 180, 63, 0.18), transparent 60%),
    radial-gradient(700px 500px at 80% 90%, rgba(42, 81, 128, 0.45), transparent 60%),
    linear-gradient(160deg, var(--navy-900), var(--navy-800) 50%, var(--navy-700));
  color: var(--ivory);
  padding: 56px 56px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}
.auth-page__art::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
}
.auth-page__brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.auth-page__brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1.5px solid var(--gold-500);
  border-radius: 50%;
  color: var(--gold-400);
}
.auth-page__brand-text { font-family: var(--font-display); font-size: 22px; letter-spacing: 0.04em; }
.auth-page__brand-text small { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3em; color: var(--gold-300); text-transform: uppercase; margin-top: 2px; }

.auth-page__hero { position: relative; z-index: 1; max-width: 460px; }
.auth-page__hero h1 {
  color: var(--ivory);
  font-size: 3rem;
  line-height: 1.05;
  font-weight: 400;
}
.auth-page__hero h1 em { font-style: italic; color: var(--gold-400); }
.auth-page__hero p { color: rgba(247, 243, 234, 0.7); margin-top: 18px; max-width: 380px; }

.auth-page__meta {
  position: relative; z-index: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(247, 243, 234, 0.5);
  display: flex; justify-content: space-between;
  text-transform: uppercase;
}

.auth-page__form-wrap {
  display: grid;
  place-items: center;
  padding: 48px;
}
.auth-page__form { width: 100%; max-width: 380px; }
.auth-page__form h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}
.auth-page__form .auth-sub { color: var(--ink-500); margin-bottom: 32px; }

.auth-demo {
  margin-top: 24px;
  padding: 16px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.auth-demo h5 {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin: 0 0 10px;
  font-weight: 500;
}
.auth-demo__row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 0;
  color: var(--ink-700);
  cursor: pointer;
  border-radius: 4px;
  padding: 4px 6px;
  transition: background 0.15s;
}
.auth-demo__row:hover { background: rgba(129, 180, 63, 0.1); }
.auth-demo__row strong { color: var(--navy-800); font-weight: 600; }

@media (max-width: 880px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-page__art { padding: 32px 24px; min-height: 240px; }
  .auth-page__hero h1 { font-size: 2rem; }
  .auth-page__form-wrap { padding: 32px 24px 48px; }
}

/* ============================================================
   APP SHELL
   ============================================================ */
.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100dvh;
}

.sidebar {
  background: var(--navy-900);
  color: var(--ivory);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.sidebar__brand {
  padding: 22px 22px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar__brand-mark {
  width: 36px; height: 36px;
  border: 1.5px solid var(--gold-500);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--gold-400);
}
.sidebar__brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.04em;
}
.sidebar__brand-name small {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--gold-300);
  margin-top: 2px;
  text-transform: uppercase;
}

.sidebar__nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.sidebar__section {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: rgba(247, 243, 234, 0.4);
  text-transform: uppercase;
  padding: 14px 12px 8px;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: rgba(247, 243, 234, 0.75);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.sidebar__link:hover { background: rgba(255,255,255,0.04); color: var(--ivory); }
.sidebar__link.active {
  background: rgba(129, 180, 63, 0.12);
  color: var(--gold-300);
}
.sidebar__link.active::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px;
  background: var(--gold-500);
  border-radius: 0 2px 2px 0;
}
.sidebar__link svg { width: 18px; height: 18px; opacity: 0.85; }

.sidebar__footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold-700);
  color: var(--ivory);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex: 0 0 auto;
}
.sidebar__footer-user {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.sidebar__user { flex: 1; min-width: 0; }
.sidebar__user-name { color: var(--ivory); font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user-role { color: rgba(247, 243, 234, 0.5); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; }
.sidebar__signout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(247, 243, 234, 0.85);
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.sidebar__signout:hover {
  background: rgba(129, 180, 63, 0.12);
  border-color: var(--gold-500);
  color: var(--gold-300);
}
.sidebar__signout svg { width: 16px; height: 16px; }

.main {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--paper);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 250, 247, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar__title { display: flex; align-items: baseline; gap: 14px; }
.topbar__title h2 { font-size: 1.35rem; }
.topbar__title small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.topbar__bell {
  position: relative;
  background: transparent;
  border: 1px solid var(--line-2);
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--ink-700);
  transition: all 0.15s;
}
.topbar__bell:hover { border-color: var(--gold-500); color: var(--gold-700); }
.topbar__bell-dot {
  position: absolute;
  top: 8px; right: 9px;
  width: 8px; height: 8px;
  background: var(--gold-500);
  border-radius: 50%;
  border: 2px solid var(--paper);
}

.content { padding: 32px; max-width: 1320px; width: 100%; }

.mobile-toggle { display: none; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .shell.menu-open .sidebar { transform: translateX(0); }
  .shell.menu-open::after {
    content: '';
    position: fixed; inset: 0;
    background: rgba(15, 23, 9, 0.5);
    z-index: 99;
  }
  .topbar { padding: 14px 18px; }
  .content { padding: 20px; }
  .mobile-toggle {
    display: grid;
    place-items: center;
    background: transparent;
    border: 1px solid var(--line-2);
    width: 38px; height: 38px;
    border-radius: var(--radius);
    color: var(--ink-700);
  }
  .topbar__title h2 { font-size: 1.1rem; }
}

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: 18px; }
.field__label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 6px;
  font-weight: 500;
}
.field__hint { font-size: 12px; color: var(--ink-400); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font: inherit;
  color: var(--ink-900);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(129, 180, 63, 0.15);
}
.textarea { resize: vertical; min-height: 90px; font-family: var(--font-ui); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%235A6573' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13.5px;
  border: 1px solid transparent;
  transition: transform 0.1s, background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--navy-800);
  color: var(--ivory);
}
.btn--primary:hover { background: var(--navy-700); }
.btn--gold {
  background: var(--gold-500);
  color: var(--navy-900);
}
.btn--gold:hover { background: var(--gold-400); }
.btn--ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--ink-700);
}
.btn--ghost:hover { border-color: var(--navy-700); color: var(--navy-800); background: var(--paper); }
.btn--danger {
  background: transparent;
  border-color: rgba(179, 58, 58, 0.3);
  color: var(--danger);
}
.btn--danger:hover { background: rgba(179, 58, 58, 0.06); border-color: var(--danger); }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--lg { padding: 14px 24px; font-size: 15px; }
.btn--full { width: 100%; }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   CARDS, KPIs, TABLES
   ============================================================ */
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 16px;
}
.card__head h3 { font-family: var(--font-display); font-size: 1.2rem; }
.card__head .label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-400);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.kpi {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gold-500);
  opacity: 0;
  transition: opacity 0.2s;
}
.kpi:hover::before { opacity: 1; }
.kpi__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 8px;
}
.kpi__value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--ink-900);
  line-height: 1;
}
.kpi__sub {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: 8px;
}
.kpi__sub strong { color: var(--success); font-weight: 600; }

.section { margin-bottom: 28px; }
.section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.section__head h3 { font-size: 1.4rem; }
.section__head .label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-400);
}

.table-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 500;
  padding: 14px 18px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(129, 180, 63, 0.04); }
.table-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-400);
  font-style: italic;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.pill--success { background: rgba(44, 122, 75, 0.1); color: var(--success); }
.pill--warning { background: rgba(180, 115, 27, 0.12); color: var(--warning); }
.pill--danger  { background: rgba(179, 58, 58, 0.1); color: var(--danger); }
.pill--info    { background: rgba(42, 111, 168, 0.1); color: var(--info); }
.pill--muted   { background: var(--paper-2); color: var(--ink-500); }
.pill--gold    { background: rgba(129, 180, 63, 0.15); color: var(--gold-700); }

/* ============================================================
   COURSE CARDS
   ============================================================ */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.course-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
}
.course-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--gold-500);
}
.course-card__cover {
  height: 130px;
  background:
    radial-gradient(400px 200px at 20% 30%, rgba(129, 180, 63, 0.25), transparent 60%),
    linear-gradient(135deg, var(--navy-800), var(--navy-600));
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 16px;
  color: var(--ivory);
}
.course-card__cover::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at top right, black 30%, transparent 75%);
}
.course-card__code {
  position: relative;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold-300);
}
.course-card__body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.course-card__title { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.2; margin-bottom: 8px; }
.course-card__desc { color: var(--ink-500); font-size: 13px; line-height: 1.5; margin-bottom: 14px; flex: 1; }
.course-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-500);
}
.course-card__meta-item { display: flex; align-items: center; gap: 6px; }

.progress-bar {
  height: 6px;
  background: var(--paper-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-400));
  border-radius: 999px;
  transition: width 0.4s var(--ease);
}

/* ============================================================
   COURSE PLAYER
   ============================================================ */
.player {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100dvh;
  background: var(--navy-900);
  color: var(--ivory);
}
.player__rail {
  background: var(--navy-900);
  border-right: 1px solid rgba(255,255,255,0.06);
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.player__rail-header {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 16px;
}
.player__exit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: rgba(247, 243, 234, 0.5);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.player__exit:hover { color: var(--gold-400); }
.player__course-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--ivory); }
.player__course-meta { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--gold-300); text-transform: uppercase; margin-top: 4px; }

.player__lessons { flex: 1; }
.player__lesson {
  margin-bottom: 18px;
}
.player__lesson-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: rgba(247, 243, 234, 0.4);
  text-transform: uppercase;
  padding: 0 12px 8px;
}
.player__slide-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(247, 243, 234, 0.7);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.player__slide-link:hover { background: rgba(255,255,255,0.04); color: var(--ivory); }
.player__slide-link.active { background: rgba(129, 180, 63, 0.12); color: var(--gold-300); }
.player__slide-link__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(247, 243, 234, 0.4);
  min-width: 22px;
}
.player__slide-link.done .player__slide-link__num { color: var(--gold-500); }
.player__slide-link.active .player__slide-link__num { color: var(--gold-400); }
.player__slide-link.locked { cursor: not-allowed; }
.player__slide-link.locked:hover { background: transparent; color: inherit; }

.player__stage {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ivory);
  color: var(--ink-900);
}
.player__progress {
  height: 3px;
  background: rgba(15, 23, 9, 0.06);
  position: relative;
}
.player__progress-fill {
  height: 100%;
  background: var(--gold-500);
  transition: width 0.3s var(--ease);
}
.player__slide-host {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 40px;
}
.slide {
  width: 100%;
  max-width: 980px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 48px 56px;
  position: relative;
  animation: slideIn 0.4s var(--ease-out);
}
.slide::before {
  content: '';
  position: absolute;
  top: 18px; left: 18px;
  width: 28px; height: 28px;
  border-top: 1.5px solid var(--gold-500);
  border-left: 1.5px solid var(--gold-500);
}
.slide::after {
  content: '';
  position: absolute;
  bottom: 18px; right: 18px;
  width: 28px; height: 28px;
  border-bottom: 1.5px solid var(--gold-500);
  border-right: 1.5px solid var(--gold-500);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.slide__kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-700);
  margin-bottom: 10px;
}
.slide__title { font-family: var(--font-display); font-size: 2rem; line-height: 1.15; margin-bottom: 14px; }
.slide__body { font-size: 15.5px; line-height: 1.65; color: var(--ink-700); }
.slide__body p { margin-bottom: 14px; }
.slide__body ul, .slide__body ol { padding-left: 22px; margin-bottom: 14px; }
.slide__body li { margin-bottom: 6px; }
.slide__media {
  margin: 20px 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-2);
  display: flex;
  justify-content: center;
}
.slide__media img, .slide__media video { max-width: 100%; height: auto; display: block; }
.slide__media video { width: 100%; }
.slide__media iframe { width: 100%; height: 60vh; border: 0; }
.slide__pdf-canvas { width: 100%; height: auto; max-height: 70vh; }

.slide__hotspots { position: relative; }
.hotspot {
  position: absolute;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold-500);
  color: var(--navy-900);
  border: 3px solid white;
  box-shadow: 0 0 0 2px var(--gold-500), 0 4px 12px rgba(0,0,0,0.3);
  display: grid; place-items: center;
  font-weight: 700;
  cursor: pointer;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.hotspot-info {
  position: absolute;
  background: var(--navy-800);
  color: var(--ivory);
  padding: 14px 18px;
  border-radius: var(--radius);
  max-width: 260px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.5;
  z-index: 5;
}

.player__bar {
  border-top: 1px solid var(--line);
  background: white;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.player__bar-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-500);
  text-transform: uppercase;
}

/* Knowledge check inside a slide */
.knowledge-check {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius);
  background: var(--paper);
}
.knowledge-check__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-700);
  margin-bottom: 6px;
}
.knowledge-check__q { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 14px; }
.kc-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: white;
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.kc-option:hover { border-color: var(--navy-500); }
.kc-option.selected { border-color: var(--navy-700); background: rgba(42, 81, 128, 0.05); }
.kc-option.correct { border-color: var(--success); background: rgba(44, 122, 75, 0.06); }
.kc-option.wrong { border-color: var(--danger); background: rgba(179, 58, 58, 0.05); }
.kc-option__bullet {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  flex: 0 0 auto;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
}
.kc-option.selected .kc-option__bullet { border-color: var(--navy-700); color: var(--navy-700); }
.kc-option.correct .kc-option__bullet { background: var(--success); color: white; border-color: var(--success); }
.kc-option.wrong .kc-option__bullet { background: var(--danger); color: white; border-color: var(--danger); }
.kc-explain {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.55;
}
.kc-explain--ok { background: rgba(44, 122, 75, 0.08); color: var(--success); }
.kc-explain--no { background: rgba(179, 58, 58, 0.08); color: var(--danger); }

/* Final quiz screen */
.quiz {
  width: 100%;
  max-width: 760px;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 48px;
  margin: auto;
}
.quiz__head { text-align: center; margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.quiz__head h2 { font-size: 1.75rem; margin-bottom: 6px; }
.quiz__progress {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-500);
  text-transform: uppercase;
}
.quiz__q { font-family: var(--font-display); font-size: 1.35rem; margin-bottom: 20px; line-height: 1.3; }

/* Score ring */
.score-ring {
  width: 180px; height: 180px;
  margin: 0 auto 20px;
  position: relative;
}
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring__bg { fill: none; stroke: var(--paper-2); stroke-width: 12; }
.score-ring__fill { fill: none; stroke: var(--gold-500); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); }
.score-ring__text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--ink-900);
}

/* ============================================================
   BUILDER
   ============================================================ */
.builder {
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  gap: 18px;
  height: calc(100dvh - 80px - 64px);
}
.builder__pane {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.builder__pane-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.builder__pane-head h4 { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.25em; color: var(--ink-500); }
.builder__pane-body { flex: 1; overflow-y: auto; padding: 12px; }

.lesson-node {
  margin-bottom: 6px;
}
.lesson-node__head {
  padding: 9px 10px;
  background: var(--paper-2);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.lesson-node__slides { padding: 4px 0 4px 12px; }
.slide-node {
  padding: 8px 10px;
  font-size: 12.5px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink-700);
  display: flex;
  align-items: center;
  gap: 8px;
}
.slide-node:hover { background: var(--paper); }
.slide-node.active { background: rgba(129, 180, 63, 0.12); color: var(--gold-700); font-weight: 500; }
.slide-node__num { font-family: var(--font-mono); font-size: 11px; color: var(--ink-400); min-width: 18px; }
.slide-node.active .slide-node__num { color: var(--gold-600); }

.dropzone {
  border: 2px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-500);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--gold-500);
  background: rgba(129, 180, 63, 0.05);
  color: var(--gold-700);
}
.dropzone strong { display: block; font-weight: 600; color: var(--ink-700); margin-bottom: 4px; }

/* ============================================================
   CERTIFICATE TEMPLATES
   ============================================================ */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.template-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.template-card:hover { border-color: var(--gold-500); box-shadow: var(--shadow-sm); }
.template-card__head { display: flex; align-items: center; gap: 12px; }
.template-card__swatch {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line);
  flex: 0 0 auto;
}
.template-card__name { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.2; }
.template-card__company { font-size: 12.5px; }
.template-card__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.template-card__meta .label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--ink-400);
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}
.template-card__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.template-card--new {
  border-style: dashed;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  min-height: 220px;
}
.template-card--new:hover { background: rgba(129, 180, 63, 0.04); }

.template-editor {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 24px;
  min-height: 520px;
}
.template-editor__form { max-height: 70vh; overflow-y: auto; padding-right: 10px; }
.template-editor__preview { position: sticky; top: 0; }
@media (max-width: 880px) {
  .template-editor { grid-template-columns: 1fr; min-height: auto; }
  .template-editor__form { max-height: none; }
}

.upload-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper-2);
}
.upload-preview img {
  max-height: 60px;
  max-width: 120px;
  object-fit: contain;
  background: white;
  border-radius: 4px;
  padding: 4px;
}

/* Segmented toggle (Text / Image) */
.segmented {
  display: inline-flex;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}
.segmented__btn {
  background: transparent;
  border: none;
  padding: 4px 12px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.segmented__btn:hover { color: var(--ink-900); }
.segmented__btn--active {
  background: white;
  color: var(--navy-800);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
#modal-root {
  position: fixed; inset: 0;
  z-index: 200;
  pointer-events: none;
}
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 9, 0.5);
  backdrop-filter: blur(2px);
  pointer-events: auto;
  animation: fade 0.2s var(--ease);
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  width: min(540px, calc(100vw - 32px));
  max-height: calc(100dvh - 64px);
  display: flex;
  flex-direction: column;
  animation: pop 0.2s var(--ease-out);
}
.modal--wide { width: min(820px, calc(100vw - 32px)); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.modal__head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal__head h3 { font-family: var(--font-display); font-size: 1.25rem; }
.modal__close {
  background: transparent;
  border: none;
  width: 32px; height: 32px;
  border-radius: var(--radius);
  display: grid; place-items: center;
  color: var(--ink-500);
}
.modal__close:hover { background: var(--paper-2); color: var(--ink-900); }
.modal__body { padding: 22px; overflow-y: auto; }
.modal__foot {
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--paper);
}

/* ============================================================
   TOAST
   ============================================================ */
#toast-root {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--navy-900);
  color: var(--ivory);
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  min-width: 220px;
  max-width: 380px;
  border-left: 3px solid var(--gold-500);
  pointer-events: auto;
  animation: toastIn 0.25s var(--ease-out);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }

/* ============================================================
   Misc
   ============================================================ */
.muted { color: var(--ink-400); }
.mono { font-family: var(--font-mono); }
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row--end { justify-content: flex-end; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 680px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .player { grid-template-columns: 1fr; }
  .player__rail { display: none; }
  .player.rail-open { grid-template-columns: 280px 1fr; }
  .builder { grid-template-columns: 1fr; height: auto; gap: 12px; }
  .slide { padding: 28px 24px; }
  .quiz { padding: 28px 24px; }
}

/* Print (for certificate preview) */
@media print {
  .sidebar, .topbar, .player__bar { display: none !important; }
}

/* Focus visibility */
:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 2px;
}
.sidebar :focus-visible { outline-color: var(--gold-400); }

/* =========================================================
   Professional LMS Typography Override
   Purpose:
   - Use Inter for normal LMS interface, course cards, buttons, menus
   - Keep Fraunces only for large branding/login headings
   - Keep JetBrains Mono only for course codes / technical labels
   ========================================================= */

body,
button,
input,
select,
textarea,
.card,
.course-card,
.lesson-card,
.dashboard,
.shell,
.sidebar,
.modal,
.table,
.form,
.btn {
  font-family: Inter, Arial, sans-serif !important;
}

.course-card h1,
.course-card h2,
.course-card h3,
.course-card__title,
.card h3,
.card__title {
  font-family: Inter, Arial, sans-serif !important;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--ink-900, #111827);
}

.course-card p,
.course-card__subtitle,
.course-card__description,
.card p {
  font-family: Inter, Arial, sans-serif !important;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--ink-500, #5A6553);
}

.course-card .mono,
.course-card__code,
.course-card code,
.card .mono,
.card code,
.mono {
  font-family: "JetBrains Mono", monospace !important;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 600;
}

.login h1,
.auth h1,
.brand-title,
.hero-title {
  font-family: Fraunces, Georgia, serif !important;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.lesson-card h3,
.lesson-card__title h3 {
  font-family: Inter, Arial, sans-serif !important;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.builder h1,
.builder h2,
.builder h3,
.admin h1,
.admin h2,
.admin h3 {
  font-family: Inter, Arial, sans-serif !important;
  letter-spacing: -0.015em;
}

.btn,
button {
  font-family: Inter, Arial, sans-serif !important;
  font-weight: 700;
  letter-spacing: 0;
}

label,
.form label,
.kicker,
.slide__kicker,
.course-card__label {
  font-family: Inter, Arial, sans-serif !important;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.course-card *,
.lesson-card *,
.card * {
  font-family: inherit;
}

.course-card .mono,
.lesson-card .mono,
.card .mono,
.course-card code,
.lesson-card code,
.card code {
  font-family: "JetBrains Mono", monospace !important;
}


/* ============================================================
   SalamAir sidebar bright-green final correction
   Purpose:
   - Match sidebar color to the approved welcome/login green
   - Keep the clean "Salam Air" brand text already applied
   - Visual only: no system logic affected
   ============================================================ */

:root {
  --salamair-sidebar-green: #5A9128;
  --salamair-sidebar-green-2: #47751F;
  --salamair-sidebar-green-3: #345A17;
  --salamair-sidebar-soft: #EEF6DD;
  --salamair-sidebar-line: rgba(238, 246, 221, 0.24);
}

/* The previous sidebar was still too dark. This makes it visibly match the login green. */
.sidebar {
  background:
    radial-gradient(circle at 28% 0%, rgba(238, 246, 221, 0.20), transparent 34%),
    linear-gradient(180deg, var(--salamair-sidebar-green) 0%, var(--salamair-sidebar-green-2) 56%, var(--salamair-sidebar-green-3) 100%) !important;
  background-color: var(--salamair-sidebar-green) !important;
  color: #ffffff !important;
  border-right-color: var(--salamair-sidebar-line) !important;
}

/* Force any sidebar internal areas that may have inherited old dark backgrounds */
.sidebar__brand,
.sidebar__nav,
.sidebar__footer {
  background: transparent !important;
}

.sidebar__brand {
  border-bottom-color: var(--salamair-sidebar-line) !important;
}

.sidebar__footer {
  border-top-color: var(--salamair-sidebar-line) !important;
}

/* Keep the cleaned brand wording and font */
.sidebar__brand-name {
  font-size: 0 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  font-family: var(--font-ui, Inter, Arial, sans-serif) !important;
}

.sidebar__brand-name::before {
  content: "Salam Air";
  display: block;
  font-family: var(--font-ui, Inter, Arial, sans-serif) !important;
  font-size: 24px !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.05 !important;
  color: #ffffff !important;
}

.sidebar__brand-name small,
.sidebar__brand small,
.sidebar__brand-subtitle,
.sidebar__brand-tagline {
  display: none !important;
}

.sidebar__brand-mark {
  border-color: rgba(238, 246, 221, 0.95) !important;
  color: rgba(238, 246, 221, 0.95) !important;
}

/* Sidebar menu readability on brighter green */
.sidebar__section {
  color: rgba(238, 246, 221, 0.70) !important;
}

.sidebar__link {
  color: rgba(255, 255, 255, 0.88) !important;
}

.sidebar__link svg {
  color: rgba(255, 255, 255, 0.82) !important;
  opacity: 1 !important;
}

.sidebar__link:hover {
  background: rgba(238, 246, 221, 0.16) !important;
  color: #ffffff !important;
}

.sidebar__link.active {
  background: rgba(238, 246, 221, 0.22) !important;
  color: #ffffff !important;
}

.sidebar__link.active::before {
  background: #EEF6DD !important;
}

.sidebar__link.active svg {
  color: #ffffff !important;
}

/* User/footer section */
.avatar {
  background: rgba(238, 246, 221, 0.20) !important;
  color: #ffffff !important;
}

.sidebar__user-name {
  color: #ffffff !important;
}

.sidebar__user-role {
  color: rgba(238, 246, 221, 0.75) !important;
}

.sidebar__signout {
  background: rgba(238, 246, 221, 0.08) !important;
  border-color: rgba(238, 246, 221, 0.28) !important;
  color: #ffffff !important;
}

.sidebar__signout:hover {
  background: rgba(238, 246, 221, 0.18) !important;
  border-color: rgba(238, 246, 221, 0.55) !important;
}

/* Mobile overlay menu sidebar */
.shell.menu-open .sidebar {
  background:
    radial-gradient(circle at 28% 0%, rgba(238, 246, 221, 0.20), transparent 34%),
    linear-gradient(180deg, var(--salamair-sidebar-green) 0%, var(--salamair-sidebar-green-2) 56%, var(--salamair-sidebar-green-3) 100%) !important;
}


/* ============================================================
   Adaptive lesson player + sharper slide presentation
   Added 10 Jun 2026
   ============================================================ */
.player {
  min-height: 100dvh;
}
.player__main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--ivory);
}
.player__mobile-head {
  display: none;
}
.player__outline-btn {
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  color: var(--ivory);
  border-radius: var(--radius);
  min-height: 40px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 650;
}
.player__mobile-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ivory);
  font-size: 13px;
  font-weight: 650;
}
.player--desktop .slide--image,
.player--desktop .slide--video,
.player--desktop .slide--html {
  max-width: min(1280px, calc(100vw - 360px));
}
.player--desktop .slide--image.slide--has-media {
  padding: 34px 38px;
}
.slide--image .slide__title,
.slide--video .slide__title,
.slide--html .slide__title {
  margin-bottom: 16px;
}
.slide__media {
  width: 100%;
  min-width: 0;
  background: #fff;
  border: 1px solid rgba(15, 23, 9, 0.06);
}
.slide__media img {
  width: 100%;
  height: auto;
  max-height: min(78dvh, 980px);
  object-fit: contain;
  image-rendering: auto;
  -webkit-user-drag: none;
  user-select: none;
}
.slide__media video {
  max-height: 78dvh;
  background: #000;
}
.slide--html .slide__media,
.slide--video .slide__media {
  align-items: stretch;
}
.slide--html .slide__media iframe {
  height: min(78dvh, 860px);
  min-height: 620px;
  background: #fff;
}
.slide__body img {
  max-width: 100%;
  height: auto;
}

@media (min-width: 681px) and (max-width: 1180px) {
  .player {
    grid-template-columns: 230px 1fr;
  }
  .player__rail {
    padding: 14px;
  }
  .player__slide-host {
    padding: 24px;
    align-items: center;
  }
  .slide {
    max-width: 100%;
    padding: 34px 38px;
  }
  .slide__title {
    font-size: 1.65rem;
  }
  .slide__body {
    font-size: 15px;
  }
  .slide__media img,
  .slide__media video {
    max-height: 72dvh;
  }
  .slide--html .slide__media iframe {
    min-height: 560px;
    height: 72dvh;
  }
  .player__bar {
    padding: 14px 20px;
  }
}

@media (max-width: 680px) {
  .player {
    display: block;
    height: 100dvh;
    overflow: hidden;
  }
  .player__main {
    height: 100dvh;
  }
  .player__mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 8px;
    background: var(--navy-900);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex: 0 0 auto;
  }
  .player__rail {
    display: none;
  }
  .player.rail-open .player__rail {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(86vw, 340px);
    z-index: 250;
    box-shadow: 22px 0 40px rgba(0,0,0,0.32);
    padding-top: calc(env(safe-area-inset-top, 0px) + 18px);
  }
  .player.rail-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 9, 0.48);
    z-index: 240;
  }
  .player__stage {
    min-height: 0;
    flex: 1 1 auto;
  }
  .player__slide-host {
    padding: 12px;
    align-items: center;
  }
  .slide {
    border-radius: var(--radius-lg);
    padding: 22px 18px;
    max-width: 100%;
    box-shadow: 0 10px 28px rgba(15, 23, 9, 0.12);
  }
  .slide::before,
  .slide::after {
    display: none;
  }
  .slide__kicker {
    font-size: 9px;
    letter-spacing: 0.22em;
  }
  .slide__title {
    font-size: clamp(1.25rem, 6vw, 1.65rem);
    margin-bottom: 12px;
  }
  .slide__body {
    font-size: 15px;
    line-height: 1.58;
  }
  .slide__media {
    margin: 14px 0;
    border-radius: var(--radius);
  }
  .slide__media img,
  .slide__media video {
    max-height: calc(100dvh - 230px);
  }
  .slide--image.slide--has-media {
    padding: 14px;
  }
  .slide--image .slide__title {
    font-size: 1.15rem;
    margin-bottom: 10px;
  }
  .slide--html {
    padding: 12px;
  }
  .slide--html .slide__title {
    font-size: 1.15rem;
    margin-bottom: 10px;
  }
  .slide--html .html-package-control {
    margin-bottom: 10px;
  }
  .slide--html .slide__media iframe {
    min-height: 0;
    height: calc(100dvh - 250px);
  }
  .player__bar {
    padding: 10px 12px calc(env(safe-area-inset-bottom, 0px) + 10px);
  }
  .player__bar .row,
  .player__bar .row--between {
    gap: 8px;
  }
  .player__bar .btn {
    min-height: 42px;
  }
}

@media (max-width: 680px) and (orientation: landscape) {
  .player__mobile-head {
    min-height: 48px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 6px);
  }
  .player__slide-host {
    padding: 8px 10px;
  }
  .slide {
    padding: 14px;
  }
  .slide__title {
    font-size: 1.15rem;
  }
  .slide__media img,
  .slide__media video {
    max-height: calc(100dvh - 145px);
  }
  .slide--html .slide__media iframe {
    height: calc(100dvh - 165px);
  }
}

/* ============================================================
   LMS title/text clipping fix - 10 Jun 2026
   Purpose: prevent LMS-rendered titles/headings from being cut
   on the left or overflowing on mobile/iPad/desktop.
   Safe to paste at the END of css/app.css.
   No database/API changes.
   ============================================================ */

.slide,
.card,
.panel,
.player__stage,
.player__slide-host,
.player__main,
.player__mobile-head,
.topbar,
.topbar__title,
.course-card,
.lesson-card {
  min-width: 0;
}

.slide__title,
.slide h1,
.slide h2,
.slide h3,
.card__title,
.course-card__title,
.lesson-card__title,
.topbar__title h1,
.topbar__title h2,
.player__course-title,
.player__mobile-title {
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
  text-indent: 0;
  padding-left: 0.04em;
  padding-right: 0.04em;
  line-height: 1.18;
}

/* Keep the compact mobile player title to one line, but do not crop from the left. */
.player__mobile-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: inherit;
}

/* Prevent imported filename/course titles such as LMS_Briefing from being clipped. */
.slide__title,
.card__title,
.course-card__title {
  display: block;
}

/* Give small screens extra breathing room around rendered text. */
@media (max-width: 680px) {
  .slide {
    padding-left: max(22px, env(safe-area-inset-left));
    padding-right: max(22px, env(safe-area-inset-right));
  }

  .slide__title,
  .slide h1,
  .slide h2 {
    font-size: clamp(1.35rem, 7vw, 1.9rem);
    line-height: 1.18;
  }
}

/* ============================================================
   Offline learning + Exam Security Mode — Added package 10 Jun 2026
   ============================================================ */
.offline-card-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #E5E9DF);
}
.offline-card-control small { font-size: 11px; }
.offline-mode-banner {
  padding: 8px 14px;
  background: rgba(0, 172, 202, 0.10);
  border-bottom: 1px solid rgba(0, 172, 202, 0.22);
  color: var(--ink-700, #2A3520);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.offline-media-missing {
  border: 1px dashed var(--warning, #B4731B) !important;
  background: rgba(180, 115, 27, 0.08) !important;
  color: var(--ink-700, #2A3520);
}
.exam-security-active,
.exam-security-active body,
.exam-security-active .quiz,
.exam-security-active .quiz * {
  -webkit-user-select: none !important;
  user-select: none !important;
}
.exam-watermark {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.075;
  transform: rotate(-28deg);
  color: var(--ink-900, #0F1709);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: clamp(16px, 3vw, 28px);
  font-weight: 900;
  text-align: center;
  white-space: pre-wrap;
  padding: 24px;
}
.quiz > *:not(.exam-watermark) {
  position: relative;
  z-index: 4;
}
@media print {
  .exam-security-active body { display: none !important; }
}
