/* ============================================================
 * StudentCenter — shared stylesheet (REDESIGN 2026-07-10)
 * ------------------------------------------------------------
 * Design source: DESIGN-SYSTEM.md (StudentCenter-redesigned zip)
 * + the z.ai preview. Every class name/token from the previous
 * stylesheet is preserved so all pages keep working; new
 * components (sidebar/topbar, avatars, stat cards, steps,
 * milestones, video grid, split login) are added on top.
 *
 * Golden rules (from DESIGN-SYSTEM.md):
 *   - tokens ONCE in :root, consume via var()
 *   - every shadow = 2 layers (near dark + far primary glow)
 *   - active buttons = gradient + colored glow, hover lift
 *   - badges = dot + light bg + dark fg + translucent border
 *   - NO black backgrounds
 *
 * Sections:
 *   1.  Fonts
 *   2.  Design tokens (:root) — new scale + legacy aliases
 *   3.  Reset + global + ambient background
 *   4.  Layout helpers
 *   5.  App shell: sidebar + topbar
 *   6.  Buttons
 *   7.  Badges
 *   8.  Inputs
 *   9.  Cards + page head
 *   10. Tables (SmartTable) + inline editors + avatars
 *   11. Pagination
 *   12. Modal / dialog
 *   13. Legacy top nav (kept for compatibility)
 *   14. Stat cards + sparkline
 *   15. Icon containers + PNG icon tints
 *   16. Activity feed
 *   17. Video grid
 *   18. Upload steps + progress + milestones
 *   19. Login (split screen)
 *   20. Empty state + toast
 *   21. Utility classes
 *   22. Animations
 *   23. Responsive
 * ============================================================ */

/* ──────────────────────────────────────────────────────────
 * Section 1 — Fonts (graceful fallback to Segoe UI offline)
 * ────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700;800&family=Noto+Kufi+Arabic:wght@500;600;700;800&display=swap');

/* ──────────────────────────────────────────────────────────
 * Section 2 — Design tokens
 * ────────────────────────────────────────────────────────── */
:root {
  /* Core palette — original identity preserved */
  --bg:           #E6F1FB;
  --bg-soft:      #F4F9FE;
  --card:         #FFFFFF;
  --primary:      #378ADD;
  --primary-dark: #185FA5;
  --primary-light:#6BB0EE;
  --primary-50:   #E8F2FD;
  --primary-tint:        rgba(55, 138, 221, 0.08);
  --primary-tint-2:      rgba(55, 138, 221, 0.14);
  --primary-tint-3:      rgba(55, 138, 221, 0.22);
  --primary-tint-strong: rgba(55, 138, 221, 0.18); /* legacy alias */
  --text-dark:    #042C53;
  --text-body:    #334155;
  --text-muted:   #8AA6C2;
  --text-faint:   #B8CCE0;
  --input-bg:     #F4F9FE;
  --input-border: #B5D4F4;
  --line:         rgba(181, 212, 244, 0.55);
  --line-soft:    rgba(181, 212, 244, 0.32);

  /* Accents (bg + fg pairs) */
  --emerald: #10B981; --emerald-bg: #D1FAE5; --emerald-fg: #065F46;
  --amber:   #F59E0B; --amber-bg:   #FEF3C7; --amber-fg:   #92400E;
  --rose:    #F43F5E; --rose-bg:    #FFE4E6; --rose-fg:    #9F1239;
  --violet:  #8B5CF6; --violet-bg:  #EDE9FE; --violet-fg:  #5B21B6;
  --cyan:    #06B6D4; --cyan-bg:    #CFFAFE; --cyan-fg:    #155E75;

  /* Legacy status aliases (pages reference these inline) */
  --success-fg: var(--emerald-fg);  --success-bg: var(--emerald-bg);
  --warn-fg:    var(--amber-fg);    --warn-bg:    var(--amber-bg);
  --danger-fg:  #A32D2D;            --danger-bg:  #FCEBEB;
  --blocked-fg: #FFFFFF;            --blocked-bg: #1E293B;

  /* Typography */
  --font-sans:    'Noto Sans Arabic', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Noto Kufi Arabic', 'Noto Sans Arabic', 'Segoe UI', sans-serif;
  --font-mono:    'SFMono-Regular', Consolas, 'Sarasa Mono SC', monospace;
  --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px;
  --fs-md: 15px;  --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 24px;
  --fs-3xl: 30px; --fs-4xl: 38px;
  --fw-regular: 400; --fw-medium: 500; --fw-semi: 600; --fw-bold: 700; --fw-heavy: 800;
  --tracking-tight: -0.02em; --tracking-wide: 0.04em; --tracking-wider: 0.08em;

  /* Spacing (4px base) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* Radius */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  --r-2xl: 20px; --r-card: 18px; --r-pill: 999px;

  /* Layered shadows — near dark edge + far primary glow */
  --sh-xs: 0 1px 2px rgba(4,44,83,.04);
  --sh-sm: 0 1px 2px rgba(4,44,83,.04), 0 2px 6px -1px rgba(4,44,83,.06);
  --sh-md: 0 4px 8px -2px rgba(4,44,83,.06), 0 8px 24px -6px rgba(55,138,221,.14);
  --sh-lg: 0 8px 16px -4px rgba(4,44,83,.08), 0 24px 48px -12px rgba(55,138,221,.22);
  --sh-xl: 0 16px 32px -8px rgba(4,44,83,.1), 0 40px 72px -16px rgba(55,138,221,.28);
  --sh-primary: 0 6px 20px -4px rgba(55,138,221,.4), 0 12px 32px -8px rgba(55,138,221,.5);
  --sh-emerald: 0 6px 20px -4px rgba(16,185,129,.4);
  --sh-amber:   0 6px 20px -4px rgba(245,158,11,.4);
  --sh-rose:    0 6px 20px -4px rgba(244,63,94,.4);
  --sh-inset:   inset 0 1px 2px rgba(4,44,83,.06);
  /* Legacy shadow aliases */
  --shadow-sm: var(--sh-sm);
  --shadow-md: var(--sh-md);
  --shadow-lg: var(--sh-lg);
  --shadow-primary: var(--sh-primary);

  /* Motion */
  --ease:        cubic-bezier(.16, 1, .3, 1);
  --ease-out:    cubic-bezier(.34, 1.56, .64, 1);
  --ease-spring: cubic-bezier(.22, 1.2, .36, 1);
  --t-fast: 120ms; --t: 200ms; --t-slow: 350ms;
  /* Legacy motion aliases */
  --transition:      200ms cubic-bezier(.16, 1, .3, 1);
  --transition-fast: 120ms ease;

  /* Layout */
  --maxw-page: 1280px;
  --nav-h: 68px;
  --sidebar-w: 264px;
}

/* ──────────────────────────────────────────────────────────
 * Section 3 — Reset + global + ambient background
 * ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  color: var(--text-body);
  /* Layered ambient gradient — light blue, alive, no flat color */
  background-image:
    radial-gradient(900px 500px at 100% -8%, rgba(107,176,238,.22), transparent 55%),
    radial-gradient(800px 480px at -8% 4%, rgba(55,138,221,.14), transparent 52%),
    radial-gradient(1200px 600px at 50% 110%, rgba(234,243,251,.6), transparent 60%),
    linear-gradient(180deg, #EAF3FB 0%, #E1EDF9 100%);
  background-attachment: fixed;
  line-height: 1.5;
  direction: rtl;            /* G8: RTL */
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Faint grid pattern layer over the gradient */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(55,138,221,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(55,138,221,.04) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 80%);
  opacity: .4;
  pointer-events: none;
}
h1, h2, h3, h4 {
  color: var(--text-dark);
  font-weight: var(--fw-bold);
  font-family: var(--font-display);
  margin: 0 0 var(--sp-3) 0;
  letter-spacing: var(--tracking-tight);
}
h5, h6 { color: var(--text-dark); font-weight: var(--fw-bold); margin: 0 0 var(--sp-3) 0; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
a { color: var(--primary); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--primary-dark); text-decoration: underline; }
code, pre { font-family: var(--font-mono); direction: ltr; }

/* Page entrance.
   fill-mode is `backwards`, NOT `both`: `forwards` would retain the final
   keyframe's transform (translateY(0) — identity, but not `none`), and any
   computed transform makes this element the containing block for its
   position:fixed descendants. That trapped every .modal-backdrop inside
   main instead of the viewport, so on short pages the modal centred in a
   short box and its top fields slid up under the topbar. */
main.container { animation: fadeUp .5s var(--ease) backwards; }

/* ──────────────────────────────────────────────────────────
 * Section 4 — Layout helpers
 * ────────────────────────────────────────────────────────── */
.container { max-width: var(--maxw-page); margin: 0 auto; padding: var(--sp-5) var(--sp-6); }
.stack > * + * { margin-top: var(--sp-4); }
.row { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }

.ta-right  { text-align: right; }
.ta-left   { text-align: left; }
.ta-center { text-align: center; }

/* ──────────────────────────────────────────────────────────
 * Section 5 — App shell: sidebar (fixed, right/RTL) + topbar
 *   Emitted by web/admin/_header.php + web/doctor/_header.php.
 *   body.has-sidebar reserves space; collapses under 880px.
 * ────────────────────────────────────────────────────────── */
body.has-sidebar { padding-right: var(--sidebar-w); }

.sidebar {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(244,249,254,.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--line);   /* RTL: edge on the left side */
  z-index: 60;
  transition: transform var(--t-slow) var(--ease);
}

/* Brand row */
.sidebar .side-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 6px 16px -4px rgba(55,138,221,.5), inset 0 1px 0 rgba(255,255,255,.3);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; color: #fff;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0; border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.25), transparent 50%);
}
.brand-mark svg { width: 22px; height: 22px; position: relative; z-index: 1; }
.side-head .brand-text { line-height: 1.25; }
.side-head .brand-text b {
  display: block; color: var(--text-dark);
  font-family: var(--font-display); font-size: var(--fs-md);
  letter-spacing: var(--tracking-tight);
}
.side-head .brand-text span { font-size: var(--fs-2xs); color: var(--text-muted); }

/* Nav sections */
.side-nav {
  flex: 1; overflow-y: auto;
  padding: var(--sp-2) var(--sp-3);
  display: flex; flex-direction: column; gap: 2px;
}
.side-label {
  font-size: var(--fs-2xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-weight: var(--fw-semi);
  display: flex; align-items: center; gap: var(--sp-2);
  margin: var(--sp-3) var(--sp-2) var(--sp-1);
}
.side-label::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px 12px; border-radius: var(--r-md);
  color: var(--text-body); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  transition: all var(--t-fast) var(--ease);
  position: relative; text-decoration: none;
}
.nav-item .ti { font-size: 18px; transition: transform var(--t-fast) var(--ease); }
.nav-item:hover { background: var(--primary-tint); color: var(--primary-dark); text-decoration: none; }
.nav-item:hover .ti { transform: scale(1.08); }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 12px -3px rgba(55,138,221,.5);
}
.nav-item.active::before {
  content: ""; position: absolute; right: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 3px;
  background: #fff; box-shadow: 0 0 8px rgba(255,255,255,.6);
}
.nav-item .badge-count {
  margin-right: auto;
  background: var(--primary-tint-2); color: var(--primary-dark);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold);
  padding: 1px 7px; border-radius: var(--r-pill); min-width: 20px; text-align: center;
}
.nav-item.active .badge-count { background: rgba(255,255,255,.25); color: #fff; }

/* User card pinned to sidebar footer */
.side-user {
  margin: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r-lg);
  background: var(--primary-tint); border: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--sp-3);
}
.side-user .avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold); box-shadow: var(--sh-sm);
}
.side-user .su-info { flex: 1; min-width: 0; line-height: 1.3; }
.side-user .su-name {
  font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--text-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-user .su-role { font-size: var(--fs-2xs); color: var(--text-muted); }
.side-user .su-logout {
  width: 30px; height: 30px; border-radius: var(--r-sm); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: all var(--t-fast) var(--ease);
}
.side-user .su-logout:hover { background: var(--rose-bg); color: var(--rose-fg); text-decoration: none; }

/* Overlay for mobile drawer */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 55;
  background: rgba(4,44,83,.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* Topbar */
.topbar {
  height: var(--nav-h);
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-6);
}
.topbar .tb-title {
  font-family: var(--font-display);
  font-size: var(--fs-md); font-weight: var(--fw-bold);
  color: var(--text-dark); letter-spacing: var(--tracking-tight);
}
.topbar .tb-crumb { font-size: var(--fs-xs); color: var(--text-muted); }
.topbar .spacer { flex: 1; }
.topbar .tb-user {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); color: var(--text-body); font-weight: var(--fw-medium);
}
.topbar .tb-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold); font-size: var(--fs-xs); box-shadow: var(--sh-sm);
}

/* Square icon buttons (topbar bell / settings / logout / menu) */
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--card); color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  transition: all var(--t-fast) var(--ease);
  text-decoration: none;
}
.icon-btn:hover {
  color: var(--primary-dark); border-color: var(--primary-light);
  background: var(--primary-50); transform: translateY(-1px);
  text-decoration: none;
}
.icon-btn .ti { font-size: 18px; }
.icon-btn.danger:hover { color: var(--rose-fg); border-color: var(--rose); background: var(--rose-bg); }

/* Notification count bubble on an icon-btn */
.tb-badge {
  position: absolute; top: -5px; left: -5px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--rose); color: #fff;
  font-size: 10px; font-weight: var(--fw-bold);
  line-height: 17px; text-align: center;
  border: 2px solid var(--card);
  box-sizing: content-box;
}

/* Hamburger hidden on desktop */
.menu-btn { display: none; }

/* ──────────────────────────────────────────────────────────
 * Section 6 — Buttons: gradient + glow + lift/press
 * ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  padding: 9px 16px;
  font-family: inherit; font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background var(--t) var(--ease),
              border-color var(--t) var(--ease), opacity var(--t) var(--ease),
              box-shadow var(--t) var(--ease), color var(--t) var(--ease);
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 8px -2px rgba(55,138,221,.5), inset 0 1px 0 rgba(255,255,255,.2);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  box-shadow: var(--sh-primary);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--card);
  color: var(--primary-dark);
  border-color: var(--input-border);
  box-shadow: var(--sh-xs);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--primary-50);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--sh-sm);
}

.btn-danger {
  background: linear-gradient(135deg, #E85D5D 0%, #C53030 100%);
  color: #FFFFFF;
  box-shadow: 0 2px 8px -2px rgba(197,48,48,.4), inset 0 1px 0 rgba(255,255,255,.2);
}
.btn-danger:hover:not(:disabled) {
  box-shadow: var(--sh-rose);
  transform: translateY(-1px);
}

.btn-emerald {
  background: linear-gradient(135deg, var(--emerald) 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 2px 8px -2px rgba(16,185,129,.4), inset 0 1px 0 rgba(255,255,255,.2);
}
.btn-emerald:hover:not(:disabled) { box-shadow: var(--sh-emerald); transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--text-body); box-shadow: none; }
.btn-ghost:hover:not(:disabled) { background: var(--primary-tint); color: var(--primary-dark); }

.btn-sm { padding: 6px 11px; font-size: var(--fs-xs); border-radius: var(--r-md); }
.btn-lg { padding: 13px 22px; font-size: var(--fs-md); border-radius: var(--r-lg); }
.btn-icon { width: 34px; height: 34px; padding: 0; }

/* ──────────────────────────────────────────────────────────
 * Section 7 — Badges (status pills with dot)
 * ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semi);
  line-height: 1.5;
  border: 1px solid transparent;
  letter-spacing: var(--tracking-wide);
  white-space: nowrap; /* «بانتظار» كان بيتقسم سطرين جوّه الأعمدة الضيقة */
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.badge-success { background: var(--emerald-bg); color: var(--emerald-fg); border-color: rgba(16,185,129,.25); }
.badge-warn    { background: var(--amber-bg);   color: var(--amber-fg);   border-color: rgba(245,158,11,.25); }
.badge-danger  { background: var(--rose-bg);    color: var(--rose-fg);    border-color: rgba(244,63,94,.25); }
.badge-muted   { background: rgba(138,166,194,.14); color: #64809C; border-color: rgba(138,166,194,.25); }
.badge-info    { background: var(--cyan-bg);    color: var(--cyan-fg);    border-color: rgba(6,182,212,.25); }
.badge-violet  { background: var(--violet-bg);  color: var(--violet-fg);  border-color: rgba(139,92,246,.25); }
.badge-blocked { background: var(--blocked-bg); color: var(--blocked-fg); }
.badge-live::before { animation: ping 1.6s var(--ease) infinite; box-shadow: 0 0 0 2px currentColor; }

/* ──────────────────────────────────────────────────────────
 * Section 8 — Inputs
 * ────────────────────────────────────────────────────────── */
.input, input[type=text], input[type=email], input[type=password],
input[type=date], input[type=number], input[type=url], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit; font-size: var(--fs-base);
  color: var(--text-body);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--r-md);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}
.input:hover, input[type=text]:hover, input[type=email]:hover, input[type=password]:hover,
input[type=date]:hover, input[type=number]:hover, input[type=url]:hover, select:hover, textarea:hover {
  border-color: var(--primary-light);
}
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 4px rgba(55, 138, 221, 0.15);
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--text-muted); }

.label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-dark);
  font-weight: var(--fw-medium);
}
.hint { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-1); }

/* Input with icon (login pages) */
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); width: 18px; height: 18px; pointer-events: none;
  transition: color var(--t-fast) var(--ease);
}
.input-wrap .input:focus ~ .input-icon { color: var(--primary); }
.pw-toggle {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-fast) var(--ease);
}
.pw-toggle:hover { color: var(--primary); background: var(--primary-tint); }

/* ──────────────────────────────────────────────────────────
 * Section 9 — Cards + page head
 * ────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--line);
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--ease), border-color var(--t) var(--ease);
}
.card-hover:hover {
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
  border-color: var(--primary-light);
}
.card-title { font-size: var(--fs-lg); margin-bottom: var(--sp-4); }

/* Page header: icon + title + description + actions */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.page-head h1 {
  font-size: var(--fs-2xl); font-weight: var(--fw-heavy);
  display: flex; align-items: center; gap: var(--sp-3);
  margin: 0;
}
.page-head .h-icon {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-tint-2); color: var(--primary);
  box-shadow: var(--sh-xs);
}
.page-head .h-icon .ti { font-size: 24px; }
.page-head .h-icon svg { width: 24px; height: 24px; }
.page-head .h-icon.emerald { background: var(--emerald-bg); color: var(--emerald); }
.page-head .h-icon.amber   { background: var(--amber-bg);   color: var(--amber); }
.page-head .h-icon.violet  { background: var(--violet-bg);  color: var(--violet); }
.page-head .h-icon.rose    { background: var(--rose-bg);    color: var(--rose); }
.page-head .h-icon.cyan    { background: var(--cyan-bg);    color: var(--cyan); }
.page-head .desc { margin: var(--sp-2) 0 0; color: var(--text-muted); font-size: var(--fs-sm); max-width: 620px; }
.page-head .actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

/* ──────────────────────────────────────────────────────────
 * Section 10 — Tables (SmartTable base)
 * ────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--line);
  overflow-x: auto;          /* horizontal scroll when table is too wide */
  -webkit-overflow-scrolling: touch;
}
table.data-table {
  width: 100%;
  min-width: 900px;          /* don't squeeze columns below readable width */
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.data-table thead th {
  background: linear-gradient(180deg, var(--bg-soft), rgba(244,249,254,.4));
  color: var(--text-dark);
  font-weight: var(--fw-semi);
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-wide);
  text-align: right;            /* RTL */
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;              /* SmartTable uses this for sort */
  user-select: none;
  vertical-align: top;
  line-height: 1.4;
  transition: background var(--t-fast) var(--ease);
}
.data-table thead th:hover { background: var(--primary-tint); }
.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-body);
  vertical-align: middle;
  overflow-wrap: break-word;    /* wrap long text (emails, URLs) inside cell */
  word-break: break-word;
  max-width: 320px;             /* prevent any single cell from hogging width */
}
.data-table tbody tr { transition: background var(--t-fast) var(--ease); }
.data-table tbody tr:hover { background: var(--primary-tint); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Numbers that change should not shift width */
.data-table td { font-variant-numeric: tabular-nums; }
.data-table .pts { font-weight: var(--fw-bold); color: var(--text-dark); }

/* Sort arrows — SmartTable sets data-sort attribute */
.data-table th[data-sort="asc"]::after  { content: " ▲"; color: var(--primary); font-size: 10px; }
.data-table th[data-sort="desc"]::after { content: " ▼"; color: var(--primary); font-size: 10px; }

/* Filter row — inputs inside th */
.data-table th input,
.data-table th select {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  margin-top: 6px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-regular);
  letter-spacing: 0;
  font-family: inherit;
  border-radius: var(--r-sm);
  box-sizing: border-box;
  border: 1px solid var(--input-border);
  background: var(--card);
  color: var(--text-body);
  direction: rtl;          /* Arabic placeholder/value starts from the right */
  text-align: right;       /* keep typed text aligned to the right edge */
  line-height: 1.5;
  height: auto;
}
.data-table th input::placeholder {
  color: var(--text-muted);
  opacity: 1;
  text-align: right;
}
/* date inputs: keep native picker usable but still RTL-aligned value */
.data-table th input[type="date"] {
  text-align: right;
  direction: rtl;
}

/* SmartTable toolbar (search + clear) — styled via class, see smart-table.js */
.smart-table-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--sp-3) var(--sp-4);
  gap: var(--sp-2); flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.smart-table-search {
  flex: 1; min-width: 200px; max-width: 400px;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--r-md);
  background: var(--card);
}
.smart-table-page-size {
  width: auto; padding: 4px 8px;
  border: 1px solid var(--input-border);
  border-radius: var(--r-sm);
  background: var(--card);
}

/* User cell: avatar + name + sub-line */
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-user .uname {
  font-weight: var(--fw-semi); color: var(--text-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell-user .usub {
  font-size: var(--fs-2xs); color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  direction: ltr; text-align: right;
}

/* Avatars — 6 rotating gradients, stable per row */
.av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold); font-size: var(--fs-xs); color: #fff;
  box-shadow: var(--sh-xs);
}
.av.a1 { background: linear-gradient(135deg, #378ADD, #185FA5); }
.av.a2 { background: linear-gradient(135deg, #8B5CF6, #5B21B6); }
.av.a3 { background: linear-gradient(135deg, #10B981, #065F46); }
.av.a4 { background: linear-gradient(135deg, #F59E0B, #92400E); }
.av.a5 { background: linear-gradient(135deg, #F43F5E, #9F1239); }
.av.a6 { background: linear-gradient(135deg, #06B6D4, #155E75); }

/* ── Inline editors inside table cells (doctor pages) ── */
.data-table input.inline-date,
.data-table input.inline-notes,
.data-table input.inline-text {
  width: 100% !important;
  box-sizing: border-box;
  padding: 4px 6px !important;
  font-size: var(--fs-sm);
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-body);
  outline: none;
  min-width: 0;
}
.data-table input.inline-date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.5;
}
.data-table input.inline-date:hover,
.data-table input.inline-notes:hover,
.data-table input.inline-text:hover {
  border-color: var(--input-border);
  background: var(--input-bg);
}
.data-table input.inline-date:focus,
.data-table input.inline-notes:focus,
.data-table input.inline-text:focus {
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 2px rgba(55, 138, 221, 0.12);
}
.data-table input.inline-blocked {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
  accent-color: var(--primary);
}
.data-table .save-btn {
  padding: 4px 12px;
  font-size: var(--fs-xs);
  white-space: nowrap;
}

/* ── Doctor content pages: selected row + inline detail expansion ── */
.data-table tbody tr.row-selected,
.data-table tbody tr.row-selected:hover { background: var(--primary-tint-2); }
.data-table tbody tr.inline-detail-row,
.data-table tbody tr.inline-detail-row:hover { background: var(--input-bg); }
.inline-detail-row > td {
  padding: 12px 16px !important;
  border-right: 3px solid var(--primary);
}
.inline-detail-title {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-dark);
  margin-bottom: 8px;
}
/* inner table inside the expansion: lift the 900px min-width so it fits */
.inline-detail-row .data-table { min-width: 0; }

/* ──────────────────────────────────────────────────────────
 * Section 11 — Pagination (SmartTable consumes)
 * ────────────────────────────────────────────────────────── */
.pagination {
  display: flex; gap: var(--sp-2); align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line);
  justify-content: space-between;
  flex-wrap: wrap;
  background: var(--bg-soft);
}
.pagination .pages { display: flex; gap: var(--sp-1); }
.pagination .page-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  border: 1px solid var(--input-border);
  background: var(--card);
  color: var(--text-body);
  border-radius: var(--r-sm);
  cursor: pointer; font-size: var(--fs-sm);
  transition: all var(--t-fast) var(--ease);
}
.pagination .page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-50);
}
.pagination .page-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 2px 6px -1px rgba(55, 138, 221, 0.5);
}
.pagination .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ──────────────────────────────────────────────────────────
 * Section 12 — Modal / dialog
 * ────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 44, 83, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fade-in .2s ease both;
}
.modal {
  background: var(--card);
  border-radius: var(--r-card);
  padding: var(--sp-6);
  width: min(560px, 90vw);
  max-height: 90vh; overflow: auto;
  box-shadow: var(--sh-xl);
  border: 1px solid rgba(255,255,255,.6);
  animation: modal-in .3s var(--ease-spring) both;
}
.modal-title { font-size: var(--fs-xl); margin: 0 0 var(--sp-4) 0; }
.modal-actions { display: flex; gap: var(--sp-3); justify-content: flex-start; margin-top: var(--sp-5); }

/* ──────────────────────────────────────────────────────────
 * Section 13 — Legacy top nav (kept: harmless, unused after
 * the sidebar migration; safety net for any stray page)
 * ────────────────────────────────────────────────────────── */
.topnav {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line), 0 2px 12px -4px rgba(55,138,221,.12);
  height: var(--nav-h);
  display: flex; align-items: center;
  padding: 0 var(--sp-5);
  position: sticky; top: 0; z-index: 50;
}
.topnav .brand { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-dark); margin-left: var(--sp-6); }
.topnav .links { display: flex; gap: var(--sp-1); }
.topnav .links a {
  color: var(--text-body); font-weight: var(--fw-medium);
  padding: 8px 13px; border-radius: var(--r-md);
  transition: all var(--t-fast) var(--ease);
}
.topnav .links a:hover { background: var(--primary-tint); color: var(--primary-dark); text-decoration: none; }
.topnav .links a.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff !important; text-decoration: none;
  box-shadow: 0 3px 8px rgba(55,138,221,.35);
}
.topnav .spacer { flex: 1; }

/* ──────────────────────────────────────────────────────────
 * Section 14 — Stat cards + sparkline
 * ────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
}
.stat {
  background: var(--card);
  border-radius: var(--r-card);
  padding: var(--sp-5);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--ease), border-color var(--t) var(--ease);
}
.stat::before {
  content: "";
  position: absolute; top: 0; right: 0;
  width: 120px; height: 120px;
  background: radial-gradient(circle at top right, var(--primary-tint-2), transparent 70%);
  pointer-events: none;
}
.stat::after {
  content: "";
  position: absolute; top: 0; left: 0; width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  opacity: 0; transition: opacity var(--t) var(--ease);
}
.stat:hover {
  box-shadow: var(--sh-md);
  transform: translateY(-3px);
  border-color: var(--primary-light);
}
.stat:hover::after { opacity: 1; }
.stat .stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.stat .label { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-2); font-weight: var(--fw-medium); }
.stat .value {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-heavy);
  color: var(--text-dark);
  letter-spacing: var(--tracking-tight);
  font-family: var(--font-display);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat .delta { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: var(--sp-2); font-weight: var(--fw-semi); display: inline-flex; align-items: center; gap: 4px; }
.stat .delta.up   { color: var(--emerald); }
.stat .delta.down { color: var(--rose); }
.stat .spark { display: block; width: 100%; height: 36px; margin-top: var(--sp-3); }

/* Colored icon tile inside stat cards */
.stat-ico {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-tint-2); color: var(--primary);
}
.stat-ico .ti { font-size: 22px; }
.stat-ico svg { width: 22px; height: 22px; }
.stat-ico.emerald { background: var(--emerald-bg); color: var(--emerald); }
.stat-ico.amber   { background: var(--amber-bg);   color: var(--amber); }
.stat-ico.violet  { background: var(--violet-bg);  color: var(--violet); }
.stat-ico.rose    { background: var(--rose-bg);    color: var(--rose); }
.stat-ico.cyan    { background: var(--cyan-bg);    color: var(--cyan); }

/* ──────────────────────────────────────────────────────────
 * Section 15 — Icon containers + PNG icon tints
 * ────────────────────────────────────────────────────────── */
.icon-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-tint-2);
  color: var(--primary);
  transition: transform var(--t) var(--ease);
}
.icon-circle:hover { transform: scale(1.08); }
.icon-circle.success { background: var(--emerald-bg); color: var(--emerald-fg); }
.icon-circle.danger  { background: var(--rose-bg);    color: var(--rose-fg); }
.icon-circle.warn    { background: var(--amber-bg);   color: var(--amber-fg); }

/* PNG icons (/web/assets/icons/*) tinted via CSS filters.
   Usage: <img src="/web/assets/icons/icon_x.png" class="icn icn-primary"> */
.icn {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  display: inline-block;
}
.icn-sm { width: 13px; height: 13px; vertical-align: -2px; }
.icn-lg { width: 20px; height: 20px; vertical-align: -4px; }
.icn-xl { width: 28px; height: 28px; vertical-align: -6px; }

.icn-primary { filter: brightness(0) saturate(100%) invert(45%) sepia(66%) saturate(1244%) hue-rotate(187deg) brightness(94%) contrast(87%); }
.icn-dark    { filter: brightness(0) saturate(100%) invert(13%) sepia(37%) saturate(1852%) hue-rotate(182deg) brightness(93%) contrast(101%); }
.icn-danger  { filter: brightness(0) saturate(100%) invert(22%) sepia(51%) saturate(2308%) hue-rotate(342deg) brightness(92%) contrast(88%); }
.icn-success { filter: brightness(0) saturate(100%) invert(28%) sepia(23%) saturate(1421%) hue-rotate(120deg) brightness(93%) contrast(91%); }
.icn-warn    { filter: brightness(0) saturate(100%) invert(46%) sepia(66%) saturate(680%) hue-rotate(357deg) brightness(91%) contrast(88%); }
.icn-muted   { filter: brightness(0) saturate(100%) invert(70%) sepia(12%) saturate(704%) hue-rotate(174deg) brightness(93%) contrast(86%); }
.icn-white   { filter: brightness(0) invert(1); }

/* Icons inside primary buttons read as white */
.btn .icn, .btn-primary .icn { filter: brightness(0) invert(1); }
/* ...except ghost/secondary buttons keep their own tint */
.btn-ghost .icn, .btn-secondary .icn { filter: brightness(0) saturate(100%) invert(45%) sepia(66%) saturate(1244%) hue-rotate(187deg) brightness(94%) contrast(87%); }

/* Tabler icon defaults inside content */
main .ti { vertical-align: -2px; }

/* ──────────────────────────────────────────────────────────
 * Section 16 — Activity feed
 * ────────────────────────────────────────────────────────── */
.feed { display: flex; flex-direction: column; gap: 2px; }
.feed-item {
  display: flex; gap: var(--sp-3); padding: var(--sp-3);
  border-radius: var(--r-md);
  transition: background var(--t-fast) var(--ease);
}
.feed-item:hover { background: var(--primary-tint); }
.feed-dot {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-tint-2); color: var(--primary);
}
.feed-dot .ti { font-size: 17px; }
.feed-body { min-width: 0; }
.feed-body .ft { font-size: var(--fs-sm); color: var(--text-body); }
.feed-body .ft b { color: var(--text-dark); font-weight: var(--fw-semi); }
.feed-body .fm { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: 2px; }

/* ──────────────────────────────────────────────────────────
 * Section 17 — Video grid (cards)
 * ────────────────────────────────────────────────────────── */
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-5); }
.vid-card {
  background: var(--card); border-radius: var(--r-card); overflow: hidden;
  box-shadow: var(--sh-sm); border: 1px solid var(--line);
  transition: all var(--t) var(--ease); cursor: pointer;
}
.vid-card:hover { box-shadow: var(--sh-lg); transform: translateY(-4px); border-color: var(--primary-light); }
.vid-thumb { position: relative; aspect-ratio: 16/9; background: linear-gradient(135deg, #1E293B, #334155); overflow: hidden; }
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow) var(--ease); }
.vid-card:hover .vid-thumb img { transform: scale(1.06); }
.vid-thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,.5));
  pointer-events: none;
}
.vid-thumb .dur {
  position: absolute; bottom: 8px; left: 8px; z-index: 1;
  background: rgba(0,0,0,.8); color: #fff; padding: 2px 7px;
  border-radius: var(--r-sm); font-size: 11px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.vid-thumb .play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(.8);
  width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,.9);
  display: flex; align-items: center; justify-content: center; z-index: 1;
  opacity: 0; transition: all var(--t) var(--ease);
  box-shadow: 0 8px 20px -4px rgba(0,0,0,.4);
  color: var(--primary-dark);
}
.vid-card:hover .vid-thumb .play { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.vid-body { padding: var(--sp-4); }
.vid-body .vt { font-weight: var(--fw-semi); color: var(--text-dark); font-size: var(--fs-sm); }
.vid-body .vm { font-size: var(--fs-2xs); color: var(--text-muted); margin-top: 4px; }
.vid-body .progress { margin-top: var(--sp-2); height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.vid-body .progress .pf { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); }

/* ──────────────────────────────────────────────────────────
 * Section 18 — Upload steps + striped progress + milestones
 * ────────────────────────────────────────────────────────── */
.steps { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: var(--sp-2); }
.step .sn {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--card); border: 2px solid var(--line); color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold); font-size: var(--fs-xs);
  transition: all var(--t) var(--ease);
}
.step .st { font-size: var(--fs-xs); color: var(--text-muted); font-weight: var(--fw-medium); }
.step.done .sn {
  background: linear-gradient(135deg, var(--emerald), #059669);
  border-color: var(--emerald); color: #fff;
}
.step.done .st { color: var(--emerald-fg); }
.step.active .sn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: var(--primary); color: #fff;
  box-shadow: 0 0 0 4px var(--primary-tint-2);
}
.step.active .st { color: var(--primary-dark); font-weight: var(--fw-semi); }
.step-line { flex: 1; min-width: 18px; height: 2px; background: var(--line); border-radius: 2px; }

/* Animated striped progress bar */
.progress-track {
  background: var(--bg-soft);
  border-radius: var(--r-pill);
  height: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-light) 0%, var(--primary) 50%, var(--primary-dark) 100%);
  border-radius: var(--r-pill);
  transition: width .5s var(--ease);
  position: relative;
  overflow: hidden;
}
.progress-fill::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(-45deg,
    rgba(255,255,255,.3) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,.3) 50%,
    rgba(255,255,255,.3) 75%, transparent 75%, transparent);
  background-size: 28px 28px;
  animation: progress-stripes .8s linear infinite;
}

/* Milestones under the bar */
.prog-milestones { display: flex; justify-content: space-between; position: relative; margin-top: var(--sp-3); }
.prog-milestones::before {
  content: ""; position: absolute; top: 5px; right: 0; left: 0; height: 2px; background: var(--line);
}
.milestone { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; }
.milestone .md {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--line);
  transition: all var(--t) var(--ease);
}
.milestone .ml { font-size: var(--fs-2xs); color: var(--text-muted); font-weight: var(--fw-medium); }
.milestone.done .md {
  background: var(--emerald); border-color: var(--emerald);
  box-shadow: 0 0 0 4px rgba(16,185,129,.2);
}
.milestone.done .ml { color: var(--emerald-fg); }
.milestone.active .md {
  background: var(--primary); border-color: var(--primary);
  animation: pulse 1.5s ease-in-out infinite;
}
.milestone.active .ml { color: var(--primary-dark); font-weight: var(--fw-semi); }

/* Big gradient percentage */
.prog-percent {
  font-size: var(--fs-3xl); font-weight: var(--fw-heavy);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums; min-width: 72px; text-align: left;
  font-family: var(--font-display);
}

/* Small spinner */
.spinner {
  width: 15px; height: 15px;
  border: 2px solid var(--primary-tint-2); border-top-color: var(--primary);
  border-radius: 50%; display: inline-block;
  animation: spin .8s linear infinite;
}

/* ──────────────────────────────────────────────────────────
 * Section 19 — Login (split screen: hero gradient + glass card)
 * ────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr;
}
@media (min-width: 960px) { .login-wrap { grid-template-columns: 1.1fr 1fr; } }

.login-hero {
  position: relative; overflow: hidden; color: #fff;
  padding: var(--sp-10);
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(800px 480px at 85% 5%, rgba(107,176,238,.6), transparent 55%),
    radial-gradient(700px 420px at 5% 95%, rgba(24,95,165,.5), transparent 55%),
    linear-gradient(155deg, var(--primary), var(--primary-dark));
}
.login-hero::before {
  content: ""; position: absolute; top: -30%; left: -15%;
  width: 60%; height: 160%;
  background: radial-gradient(closest-side, rgba(255,255,255,.14), transparent);
  animation: float1 14s ease-in-out infinite;
}
.login-hero::after {
  content: ""; position: absolute; bottom: -25%; right: -10%;
  width: 50%; height: 120%;
  background: radial-gradient(closest-side, rgba(255,255,255,.10), transparent);
  animation: float2 18s ease-in-out infinite;
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero .hero-tag {
  font-family: var(--font-display); font-weight: var(--fw-heavy);
  font-size: var(--fs-3xl); line-height: 1.35; letter-spacing: var(--tracking-tight);
}
.login-hero .hero-sub { opacity: .85; font-size: var(--fs-md); margin-top: var(--sp-3); max-width: 460px; }
.login-hero .hero-feats { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-6); }
.login-hero .hero-feat {
  display: flex; align-items: center; gap: var(--sp-3);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.login-hero .hero-feat .fi {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: rgba(255,255,255,.2);
  display: inline-flex; align-items: center; justify-content: center;
}
.login-hero .hero-stats { display: flex; gap: var(--sp-8); margin-top: var(--sp-6); }
.login-hero .hero-stat .n { font-size: var(--fs-2xl); font-weight: var(--fw-heavy); font-family: var(--font-display); }
.login-hero .hero-stat .l { font-size: var(--fs-2xs); opacity: .8; }

.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6);
}
.login-card {
  position: relative;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-xl);
  border: 1px solid rgba(255,255,255,.6);
  padding: var(--sp-8);
  width: 100%; max-width: 430px;
  animation: fadeUp .6s var(--ease-spring) both;
}
.login-card::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--r-2xl);
  background: linear-gradient(180deg, rgba(255,255,255,.5), transparent 30%);
  pointer-events: none;
}
.login-card > * { position: relative; }
.login-brand { text-align: center; margin-bottom: var(--sp-6); }
.login-brand .name {
  font-size: var(--fs-2xl); font-weight: var(--fw-heavy);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-family: var(--font-display);
}
.login-brand .sub { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-1); }
.login-tabs {
  display: flex; gap: var(--sp-1); padding: var(--sp-1);
  background: var(--bg-soft); border-radius: var(--r-md);
  border: 1px solid var(--line);
  margin-bottom: var(--sp-5);
}
.login-tabs a, .login-tabs button {
  flex: 1; text-align: center; padding: 8px 10px;
  border: none; background: transparent; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); font-family: inherit;
  color: var(--text-muted); cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  text-decoration: none;
}
.login-tabs .active { background: var(--card); color: var(--primary-dark); box-shadow: var(--sh-xs); font-weight: var(--fw-semi); }
.login-tabs a:hover { text-decoration: none; color: var(--primary-dark); }
.login-card .err {
  background: var(--rose-bg); color: var(--rose-fg);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); font-size: var(--fs-sm);
  border: 1px solid rgba(244,63,94,.25);
  margin-bottom: var(--sp-4); text-align: center;
  animation: fadeUp .3s ease both;
}
.login-card .field { margin-bottom: var(--sp-4); }
.login-card .btn-login {
  width: 100%; padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; border: none; border-radius: var(--r-md);
  font-size: var(--fs-base); font-weight: var(--fw-bold);
  cursor: pointer; font-family: var(--font-sans);
  box-shadow: var(--sh-primary), inset 0 1px 0 rgba(255,255,255,.2);
  transition: all var(--t) var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
}
.login-card .btn-login:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px -6px rgba(55,138,221,.55); }
.login-card .btn-login:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.login-card .btn-login:disabled { opacity: .6; cursor: not-allowed; }
/* login inputs get icon padding */
.login-card .input-wrap .input { padding-right: 40px; padding-left: 44px; }

/* ──────────────────────────────────────────────────────────
 * Section 20 — Empty state + toast
 * ────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: var(--sp-10) var(--sp-5); }
.empty .ei {
  width: 72px; height: 72px; border-radius: 18px;
  background: var(--primary-tint); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-3);
}
.empty .ei .ti { font-size: 34px; }
.empty .et { font-weight: var(--fw-semi); color: var(--text-dark); }
.empty .em { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-1); }

.toast {
  position: fixed; bottom: var(--sp-6); left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text-dark); color: #fff;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); box-shadow: var(--sh-lg);
  font-size: var(--fs-sm);
  display: flex; align-items: center; gap: var(--sp-2);
  opacity: 0; pointer-events: none;
  transition: all var(--t) var(--ease);
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ──────────────────────────────────────────────────────────
 * Section 21 — Utility classes
 * ────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }

.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger-fg); }
.text-success { color: var(--success-fg); }
.fw-bold      { font-weight: var(--fw-bold); }
.fw-medium    { font-weight: var(--fw-medium); }

/* Thin custom scrollbar helper */
.nice-scroll { scrollbar-width: thin; scrollbar-color: var(--input-border) transparent; }
.nice-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.nice-scroll::-webkit-scrollbar-track { background: transparent; }
.nice-scroll::-webkit-scrollbar-thumb { background: var(--input-border); border-radius: var(--r-pill); }
.nice-scroll::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* Global scrollbar (WebKit) — matches the palette */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--input-border);
  border-radius: 8px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, var(--input-bg) 25%, rgba(181, 212, 244, 0.5) 37%, var(--input-bg) 63%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}

/* ──────────────────────────────────────────────────────────
 * Section 22 — Animations
 * ────────────────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes progress-stripes {
  from { background-position: 0 0; }
  to   { background-position: 28px 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--primary-tint-2); }
  50%      { box-shadow: 0 0 0 8px var(--primary-tint); }
}
@keyframes ping {
  0%   { transform: scale(1); opacity: .6; }
  75%, 100% { transform: scale(2.2); opacity: 0; }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.animate-pulse-soft { animation: pulse-soft 1.8s ease-in-out infinite; }
@keyframes float-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in-up { animation: float-up 0.45s var(--ease) both; }
@keyframes float1 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(20px,30px); } }
@keyframes float2 { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-24px,-20px); } }
@keyframes ping-soft {
  0%   { transform: scale(1); opacity: 0.7; }
  75%, 100% { transform: scale(2); opacity: 0; }
}
.ping-dot { position: relative; }
.ping-dot::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: ping-soft 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ──────────────────────────────────────────────────────────
 * Section 23 — Responsive
 * ────────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  /* Sidebar becomes a drawer */
  body.has-sidebar { padding-right: 0; }
  .sidebar { transform: translateX(100%); box-shadow: var(--sh-xl); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-overlay,
  .sidebar-overlay.show { display: block; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 var(--sp-4); }
  .container { padding: var(--sp-4); }
}
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .topnav .links { display: none; }
  .modal { width: 95vw; padding: var(--sp-4); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-head h1 { font-size: var(--fs-xl); }
  .topbar .tb-user span.tb-name { display: none; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ===== أنجح rebrand: white logo chip so the brand colors read ===== */
.brand-mark.logo { background: #fff; }
.brand-mark.logo::after { display: none; }
.brand-mark.logo img { width: 26px; height: 24px; position: relative; z-index: 1; display: block; }

/* ══════════════════════════════════════════════════════════
 * DOCTOR PHOTO 2026-07-11 — profile photo inside the circle
 * avatars (doctor sidebar/topbar, admin doctors table) + the
 * change-photo modal preview. Letter fallback keeps the old look.
 * ══════════════════════════════════════════════════════════ */
.side-user .avatar, .topbar .tb-user .avatar { position: relative; overflow: hidden; }
.side-user .avatar img, .topbar .tb-user .avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
}
.avatar-clickable { cursor: pointer; }
.avatar-edit-overlay {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: rgba(4, 44, 83, .45); color: #fff;
  border-radius: 50%; font-size: 15px;
}
.avatar-clickable:hover .avatar-edit-overlay,
.avatar-clickable:focus-visible .avatar-edit-overlay { display: flex; }

/* Change-photo modal: big round preview (photo or letter) */
.photo-preview {
  width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 42px; font-weight: var(--fw-bold);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; box-shadow: var(--sh-md);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* Small round avatar inside table cells (admin doctors list) */
.table-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold); font-size: var(--fs-xs);
  overflow: hidden; vertical-align: middle;
}
.table-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
