/* ═══════════════════════════════════════════════════════════════
   AHMAD MOTIVATION — New premium UI theme (dark / gold / RTL)
   Loaded AFTER styles.css. Re-themes the existing dashboard shell
   (.dashboard-sidebar / .dashboard-main / .dashboard-header) to the
   approved new design and adds the mobile drawer. All new classes
   are prefixed with `am-` to avoid collisions with legacy styles.
   Works together with am-shell.js (sidebar upgrade + drawer logic).
   ═══════════════════════════════════════════════════════════════ */

:root {
  --am-bg: #070810;
  --am-panel: #0b0d17;
  --am-gold: #f0c764;
  --am-gold-light: #fadc7e;
  --am-gold-deep: #c9923a;
  --am-ink: #1a1405;
  --am-text: #e8e4d6;
  --am-strong: #f3ecd6;
  --am-hero: #f6efd6;
  --am-muted: #9b957e;
  --am-dim: #8a8470;
  --am-faint: #6a6454;
  --am-green: #7fdcaa;
  --am-green-deep: #3aa86a;
  --am-blue: #a8b6e0;
  --am-mint: #9bd2c0;
  --am-purple: #c9b8ff;
  --am-coral: #f0a988;
}

@keyframes amPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(232,184,82,.5); } 50% { box-shadow: 0 0 0 7px rgba(232,184,82,0); } }
@keyframes amShine { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes amFade  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Base ─── */
body.am-skin {
  background: var(--am-bg);
  font-family: 'Cairo', 'Tajawal', sans-serif;
  color: var(--am-text);
  overflow-x: hidden;
}

/* ─── Full-page app layout (kills the legacy "boxed" frame) ─────────────
   styles.css declares global `section { padding: 100px 0 }` and
   `.container { max-width: 1200px; margin: auto }`. The subscriber pages
   wrap their content in <section class="dashboard-content container">, so
   they inherited a huge vertical band plus a centered 1200px box inside
   the main area — the "framed / unwindowed" look. Neutralize both inside
   the app shell. `:where()` keeps specificity at zero so component
   paddings (.am-hero, .wlp-*, inline styles) still win. */
body.am-skin .dashboard-main :where(section) {
  padding-top: 0;
  padding-bottom: 0;
}
body.am-skin .dashboard-content.container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}
body.am-skin .dashboard-content {
  margin-top: 0;
  gap: 0;
}
/* Legacy centered glow ellipse reads as a halo frame — remove it */
body.am-skin .dashboard-glow::before {
  display: none;
}

/* ─── Page transitions ───────────────────────────────────────────────
   Enter: main content fades/slides in. Exit: Script.js already adds
   body.fade-out before internal navigation, but styles.css forces
   `body { opacity: 1 !important }`, which silenced it — re-enable it
   here with higher specificity. Both respect prefers-reduced-motion. */
@keyframes amPageEnter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
body.am-skin .dashboard-main {
  animation: amPageEnter 0.24s ease-out;
}
body.am-skin.fade-out {
  opacity: 0 !important;
  transition: opacity 0.2s ease-out !important;
}
@media (prefers-reduced-motion: reduce) {
  body.am-skin .dashboard-main { animation: none !important; }
  body.am-skin.fade-out { opacity: 1 !important; transition: none !important; }
  body.am-skin .am-page { animation: none !important; }
}
body.am-skin ::selection { background: rgba(212,168,74,.3); color: #fff; }
body.am-skin ::-webkit-scrollbar { width: 6px; height: 6px; }
body.am-skin ::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
body.am-skin ::-webkit-scrollbar-thumb { background: rgba(232,184,82,0.22); border-radius: 3px; }

/* ─── Sidebar (desktop: fixed right, like legacy layout) ─── */
body.am-skin .dashboard-sidebar {
  width: 258px;
  background: linear-gradient(180deg, #0b0d17 0%, #080912 100%);
  border-left: 1px solid rgba(232,184,82,0.09);
  box-shadow: none;
  padding: 24px 16px 28px;
  display: flex;
  flex-direction: column;
  z-index: 1100;
}

body.am-skin .dashboard-main {
  /* styles.css caps this at `max-width:1200px; margin:auto`, which floated
     the whole app in a centered box beside the fixed RTL sidebar — the
     "boxed / framed" look. Fill the real viewport instead. */
  max-width: none;
  width: auto;
  margin: 0 258px 0 0;
  min-height: 100vh;
  background:
    radial-gradient(1400px 700px at 80% -5%, rgba(232,184,82,0.07), transparent 55%),
    radial-gradient(800px 500px at 5% 5%, rgba(40,60,130,0.12), transparent 60%),
    var(--am-bg);
  padding: 28px 32px 80px;
}

/* Keep very wide monitors comfortable without re-creating the boxed feel:
   content spans the area, inner sections stay readable */
@media (min-width: 1750px) {
  body.am-skin .dashboard-content { max-width: 1440px; }
}

/* Brand block (built by am-shell.js inside .sidebar-logo) */
body.am-skin .sidebar-logo {
  -webkit-text-fill-color: initial;
  background: none;
  border-bottom: none;
  padding: 0 6px;
  margin-bottom: 28px;
}
.am-brand { display: flex; align-items: center; gap: 11px; }
.am-brand-logo {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, #f5cf65, #c9923a);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', 'Poppins', sans-serif; font-weight: 900;
  color: var(--am-ink); font-size: 15px;
  box-shadow: 0 6px 18px rgba(232,184,82,0.32);
}
.am-brand-name { font-weight: 800; font-size: 14px; color: var(--am-strong); letter-spacing: .1px; }
.am-brand-sub  { font-size: 10px; color: var(--am-faint); font-family: 'Inter', sans-serif; letter-spacing: .8px; }

/* Nav links */
body.am-skin .sidebar-menu { display: flex; flex-direction: column; gap: 3px; }
body.am-skin .sidebar-menu a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px;
  color: var(--am-muted); font-size: 13.5px; font-weight: 600;
  text-decoration: none; background: transparent;
  border: 1px solid transparent;
  transition: color .2s, background .2s, border-color .2s;
  overflow: visible;
}
body.am-skin .sidebar-menu a::before { display: none; }
body.am-skin .sidebar-menu a:hover {
  color: var(--am-gold);
  background: rgba(232,184,82,0.05);
  transform: none;
  box-shadow: none;
}
body.am-skin .sidebar-menu a.active,
body.am-skin .sidebar-menu .active {
  color: var(--am-gold);
  background: rgba(232,184,82,0.09);
  border-color: rgba(232,184,82,0.22);
}
.am-ico { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

/* User chip pinned at sidebar bottom (built by am-shell.js) */
.am-user-chip {
  margin-top: auto; padding-top: 22px;
}
.am-user-chip-inner {
  display: flex; align-items: center; gap: 10px; padding: 12px;
  border-radius: 12px; background: rgba(255,255,255,0.025);
  border: 1px solid rgba(232,184,82,0.10);
}
.am-user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #2b2a23, #14130d);
  border: 2px solid rgba(232,184,82,0.30);
  display: flex; align-items: center; justify-content: center;
  color: var(--am-strong); font-weight: 800; font-size: 13px;
}
.am-user-name  { font-size: 12px; font-weight: 700; color: var(--am-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-user-mail  { font-size: 10px; color: var(--am-dim); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

/* ─── Page header ─── */
body.am-skin .dashboard-header {
  background: linear-gradient(135deg, rgba(232,184,82,0.07), rgba(255,255,255,0.01));
  border: 1px solid rgba(232,184,82,0.13);
  border-radius: 18px;
  padding: 22px 30px;
  margin-bottom: 18px;
}
body.am-skin .dashboard-header h2 {
  margin: 0 0 4px; font-size: 25px; font-weight: 900; color: var(--am-hero);
}
body.am-skin .dashboard-header p { margin: 0; font-size: 13px; color: #a8a288; }

/* ─── Generic re-theme of legacy components to the new gold ─── */
body.am-skin .progress-card,
body.am-skin .card {
  background: linear-gradient(160deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
  border: 1px solid rgba(232,184,82,0.12);
  border-radius: 16px;
}
body.am-skin .dashboard-glow { box-shadow: none; }

/* ─── Mobile top bar + drawer ─── */
.am-mobilebar {
  display: none;
  align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px;
}
.am-menu-btn {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid rgba(232,184,82,0.22);
  background: rgba(255,255,255,0.03);
  color: var(--am-gold); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.am-mb-brand { display: flex; align-items: center; gap: 9px; }
.am-mb-logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #f5cf65, #c9923a);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Inter', sans-serif; font-weight: 900; color: var(--am-ink); font-size: 12px;
}
.am-mb-name { font-size: 14px; font-weight: 800; color: var(--am-strong); }
.am-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.60);
  z-index: 1150; cursor: pointer; backdrop-filter: blur(2px);
}
.am-backdrop[hidden] { display: none; }

@media (max-width: 1200px) {
  body.am-skin .dashboard-sidebar { width: 236px !important; }
  body.am-skin .dashboard-main { margin-right: 236px !important; padding: 22px 20px 64px !important; }
}

@media (max-width: 900px) {
  /* The off-canvas drawer must never create horizontal page scroll (RTL) */
  html:has(body.am-skin), body.am-skin { overflow-x: hidden; }

  /* Sidebar becomes a fixed drawer from the right, opened by ☰ */
  body.am-skin .dashboard-sidebar {
    position: fixed !important;
    top: 0 !important; bottom: 0 !important;
    right: -300px !important; left: auto !important;
    width: 280px !important; max-width: 84vw !important;
    height: 100% !important;
    border-left: none !important; border-bottom: none !important;
    padding: 24px 16px 28px !important;
    transition: right .28s ease;
    display: flex !important; flex-direction: column !important;
    box-shadow: -20px 0 60px rgba(0,0,0,0.55);
    z-index: 1200 !important;
    overflow-y: auto;
  }
  body.am-skin .dashboard-sidebar.am-open { right: 0 !important; }
  body.am-skin .sidebar-menu {
    display: flex !important; flex-direction: column !important; gap: 3px !important;
  }
  body.am-skin .sidebar-menu a {
    justify-content: flex-start !important; text-align: right !important;
    padding: 11px 12px !important; font-size: 13.5px !important;
  }
  body.am-skin .sidebar-logo { margin-bottom: 28px !important; border-bottom: none !important; }
  body.am-skin .dashboard-main { margin-right: 0 !important; padding: 18px 16px 64px !important; }
  body.am-skin .am-mobilebar { display: flex; }
}

@media (max-width: 600px) {
  body.am-skin .dashboard-main { padding: 14px 12px 56px !important; }
  body.am-skin .dashboard-header { padding: 18px !important; }
  body.am-skin .dashboard-header h2 { font-size: 1.3rem !important; }
}

/* ─── New-UI building blocks (for redesigned pages) ─── */
.am-page { animation: amFade .3s ease-out; }

.am-card {
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,0.025), rgba(255,255,255,0.005));
  border: 1px solid rgba(232,184,82,0.09);
}
.am-h1 { margin: 0 0 5px; font-size: 28px; font-weight: 900; color: var(--am-strong); }
.am-h2 { margin: 0 0 4px; font-size: 20px; font-weight: 800; color: var(--am-strong); }
.am-sub { font-size: 13px; color: var(--am-muted); }

.am-btn {
  border-radius: 13px; cursor: pointer;
  font-family: 'Cairo', 'Tajawal', sans-serif;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
}
.am-btn-gold {
  padding: 13px 22px; border: 0; font-weight: 800; font-size: 14px; color: var(--am-ink);
  background: linear-gradient(135deg, #fadc7e, #c9923a);
  box-shadow: 0 10px 26px rgba(232,184,82,0.28);
}
.am-btn-gold:hover { filter: brightness(1.06); }
.am-btn-ghost {
  padding: 13px 20px; border: 1px solid rgba(232,184,82,0.28);
  background: rgba(255,255,255,0.02);
  color: var(--am-strong); font-weight: 700; font-size: 13px;
}
.am-btn-ghost:hover { background: rgba(232,184,82,0.07); }
.am-btn-sm { padding: 8px 16px; border-radius: 10px; font-size: 12px; }

.am-chip {
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.02);
  color: var(--am-muted); font-family: 'Cairo', 'Tajawal', sans-serif;
  font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.am-chip.active {
  background: rgba(232,184,82,0.12); color: var(--am-gold);
  border-color: rgba(232,184,82,0.32);
}

.am-badge-on {
  padding: 4px 12px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(60,180,120,0.12); color: var(--am-green);
  border: 1px solid rgba(60,180,120,0.28);
}
.am-badge-gold {
  padding: 4px 12px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(232,184,82,0.09); color: var(--am-gold);
  border: 1px solid rgba(232,184,82,0.22);
}

.am-empty {
  padding: 40px 24px; border-radius: 16px; text-align: center;
  background: rgba(255,255,255,0.015); border: 1px dashed rgba(232,184,82,0.16);
  color: var(--am-muted); font-size: 13px; font-weight: 600;
}

.am-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.am-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.am-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 900px) {
  .am-grid-3, .am-grid-4 { grid-template-columns: 1fr 1fr; }
  .am-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .am-grid-3, .am-grid-4 { grid-template-columns: 1fr; }
}

/* Hero section for course / dashboard pages */
.am-hero {
  position: relative; border-radius: 24px; padding: 32px 36px; margin-bottom: 20px;
  overflow: hidden;
  background:
    radial-gradient(700px 360px at 95% 10%, rgba(232,184,82,0.16), transparent 55%),
    linear-gradient(135deg, #0e1022, #0a0c18);
  border: 1px solid rgba(232,184,82,0.22);
}
.am-hero::before {
  content: ''; position: absolute; top: 0; right: 0; left: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #f0c764 40%, #c9923a, transparent);
}
.am-hero-title { margin: 0 0 6px; font-size: 30px; font-weight: 900; color: var(--am-hero); line-height: 1.2; }
.am-hero-sub { margin: 0 0 6px; font-size: 15px; color: #c9b890; font-weight: 700; }
.am-hero-desc { margin: 0 0 18px; font-size: 13px; color: #a8a288; line-height: 1.75; max-width: 520px; }
.am-stat-chip {
  padding: 10px 14px; border-radius: 12px;
  background: rgba(232,184,82,0.08); border: 1px solid rgba(232,184,82,0.17);
  text-align: center; min-width: 64px;
}
.am-stat-chip .am-stat-num {
  font-family: 'Inter', 'Poppins', sans-serif; font-size: 20px; font-weight: 800;
  color: var(--am-gold); line-height: 1;
}
.am-stat-chip .am-stat-lbl { font-size: 10px; color: var(--am-dim); margin-top: 3px; }
.am-stat-chip.green { background: rgba(80,200,140,0.07); border-color: rgba(80,200,140,0.17); }
.am-stat-chip.green .am-stat-num { color: var(--am-green); }
.am-stat-chip.purple { background: rgba(180,160,255,0.07); border-color: rgba(180,160,255,0.15); }
.am-stat-chip.purple .am-stat-num { color: var(--am-purple); }
@media (max-width: 600px) {
  .am-hero { padding: 22px 18px; }
  .am-hero-title { font-size: 23px; }
}

/* ─── Dashboard intro video card (premium, balanced — no stretched banner) ──
   Two columns on desktop: aspect-correct player (capped) + info panel.
   The <video> keeps its real <source data-video-path> so the existing secure
   token-streaming loader (video-player-utils.js) works unchanged. */
.am-intro-video-card {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr);
  align-items: stretch;
  max-width: 920px;
  margin-bottom: 14px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255,255,255,0.03), rgba(255,255,255,0.005));
  border: 1px solid rgba(232,184,82,0.18);
  box-shadow: 0 14px 40px rgba(0,0,0,0.32);
}
.am-intro-video-media {
  position: relative;
  background: radial-gradient(circle at 50% 50%, #12131f, #05070d);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.am-intro-video-el {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 440px;
  object-fit: contain;          /* preserve real ratio — never stretch */
  background: #05070d;
  border: 0;
}
.am-intro-video-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 24px 26px;
  background: linear-gradient(160deg, rgba(232,184,82,0.06), transparent 70%);
  border-inline-start: 1px solid rgba(232,184,82,0.10);
}
.am-intro-video-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--am-gold);
  background: rgba(232,184,82,0.10);
  border: 1px solid rgba(232,184,82,0.24);
}
.am-intro-video-info h3 {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 800;
  color: var(--am-hero);
  line-height: 1.4;
}
.am-intro-video-info p {
  margin: 0;
  font-size: 13px;
  color: var(--am-muted);
  line-height: 1.7;
}
.am-intro-video-info .am-btn {
  align-self: flex-start;
  margin-top: 6px;
}
@media (max-width: 760px) {
  .am-intro-video-card { grid-template-columns: 1fr; max-width: 560px; }
  .am-intro-video-info { border-inline-start: 0; border-top: 1px solid rgba(232,184,82,0.10); }
}
