/* ══════════════════════════════════════════════════════════════
   EduRise Student Portal — macOS-Inspired Design System
   Clean • Minimal • Fast • Readable
   ══════════════════════════════════════════════════════════════ */

/* ── LIGHT (default — macOS Sonoma aesthetic) ── */
:root {
  --blue: #007AFF;
  --blue-hover: #0066D6;
  --blue-light: #E8F2FF;
  --blue-rgb: 0,122,255;
  --green: #34C759;
  --green-rgb: 52,199,89;
  --orange: #FF9500;
  --red: #FF3B30;
  --red-rgb: 255,59,48;
  --purple: #AF52DE;
  --teal: #5AC8FA;
  --pink: #FF2D55;
  --yellow: #FFCC00;
  --indigo: #5856D6;

  --bg: #F5F5F7;
  --bg-card: #FFFFFF;
  --bg-card-alt: #FAFAFA;
  --bg-input: #F5F5F7;
  --bg-hover: rgba(0,0,0,.03);
  --bg-active: rgba(0,122,255,.06);

  --text: #000000;
  --text-secondary: #3A3A3C;
  --text-tertiary: #636366;

  --border: rgba(0,0,0,.06);
  --border-strong: rgba(0,0,0,.1);
  --divider: rgba(0,0,0,.05);

  --shadow-xs: 0 0 0 1px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-hover: 0 4px 16px rgba(0,0,0,.1);

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 22px;
  --r-pill: 999px;

  --navbar-bg: rgba(255,255,255,.72);
  --navbar-blur: blur(20px) saturate(1.8);

  --font-en: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-ar: 'Cairo', 'SF Arabic', -apple-system, sans-serif;

  --ease: cubic-bezier(.25,.1,.25,1);
  --ease-spring: cubic-bezier(.175,.885,.32,1.275);
}

/* ── DARK ── */
:root[data-bs-theme="dark"] {
  --bg: #000000;
  --bg-card: #1C1C1E;
  --bg-card-alt: #2C2C2E;
  --bg-input: #2C2C2E;
  --bg-hover: rgba(255,255,255,.04);
  --bg-active: rgba(0,122,255,.12);

  --text: #FFFFFF;
  --text-secondary: #D1D1D6;
  --text-tertiary: #A1A1A6;

  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.12);
  --divider: rgba(255,255,255,.06);

  --shadow-xs: 0 0 0 1px rgba(255,255,255,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3), 0 0 0 1px rgba(255,255,255,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.05);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05);
  --shadow-hover: 0 4px 16px rgba(0,0,0,.4);

  --navbar-bg: rgba(28,28,30,.78);
  --blue-light: rgba(0,122,255,.15);
}

/* ══════════════════
   BASE
   ══════════════════ */
html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-en);
  font-size: 15px;
  line-height: 1.47;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -.01em;
}

[dir="rtl"] body { font-family: var(--font-ar); }
::selection { background: rgba(var(--blue-rgb),.2); }
a { color: var(--blue); text-decoration: none; font-weight: 600; }
a:hover { color: var(--blue-hover); }

/* Small text must be bold enough to read */
.small, small, .form-text, .breadcrumb, .badge,
.text-secondary, .text-muted {
  font-weight: 600;
}

/* Ensure secondary text is dark enough in light mode */
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-tertiary) !important; }

.max-student { max-width: min(1440px, 100%); width: 100%; margin-inline: auto; }
.student-main { flex: 1 0 auto; }

/* ══════════════════
   NAVBAR — macOS menu bar
   ══════════════════ */
.edu-navbar {
  background: var(--navbar-bg);
  backdrop-filter: var(--navbar-blur);
  -webkit-backdrop-filter: var(--navbar-blur);
  border-bottom: 1px solid var(--border);
  padding: .35rem 0;
  z-index: 1030;
}

.edu-brand {
  font-weight: 700;
  font-size: 1.1rem;
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none; color: var(--text);
  letter-spacing: -.02em;
}

.edu-brand .brand-dot {
  width: 24px; height: 24px; border-radius: var(--r-xs);
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: .6rem; font-weight: 800;
}

.edu-nav-link {
  color: var(--text-secondary);
  font-size: .84rem;
  font-weight: 600;
  padding: .4rem .7rem;
  border-radius: var(--r-sm);
  transition: all .15s var(--ease);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: .3rem;
  white-space: nowrap;
}

.edu-nav-link:hover { color: var(--text); background: var(--bg-hover); }

.edu-nav-link.active {
  color: var(--blue);
  background: var(--blue-light);
  font-weight: 600;
}

.btn-nav {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s var(--ease);
}

.btn-nav:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }

.wallet-chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .7rem;
  border-radius: var(--r-pill);
  background: rgba(var(--green-rgb),.08);
  border: 1px solid rgba(var(--green-rgb),.12);
  color: var(--green);
  font-size: .78rem; font-weight: 600;
  text-decoration: none;
  transition: all .15s var(--ease);
}

.wallet-chip:hover { background: rgba(var(--green-rgb),.12); color: var(--green); }

.lang-toggle {
  display: inline-flex; align-items: center; gap: .2rem;
  padding: .3rem .6rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: .72rem; font-weight: 600;
  cursor: pointer;
  transition: all .15s var(--ease);
}

.lang-toggle:hover { background: var(--bg-hover); color: var(--text); }

/* ══════════════════
   CARDS — clean macOS panels
   ══════════════════ */
.edu-card, .student-card, .card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  color: var(--text);
}

.edu-card .card-header, .student-card .card-header, .card .card-header {
  border-bottom: 1px solid var(--divider);
  background: transparent;
  font-weight: 700;
  font-size: .88rem;
  padding: 1rem 1.25rem;
  color: var(--text);
}

.edu-card .card-body, .student-card .card-body, .card .card-body {
  padding: 1.15rem 1.25rem;
}

.edu-card .card-footer, .student-card .card-footer, .card .card-footer {
  border-top: 1px solid var(--divider);
  background: transparent;
  padding: .85rem 1.25rem;
}

/* ══════════════════
   KPI — clean stat boxes
   ══════════════════ */
.student-kpi {
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 1.15rem;
  height: 100%;
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
}

.kpi-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  margin-bottom: .6rem;
}

.kpi-wrap:nth-child(1) .kpi-icon { color: var(--blue); background: var(--blue-light); }
.kpi-wrap:nth-child(2) .kpi-icon { color: var(--green); background: rgba(var(--green-rgb),.1); }
.kpi-wrap:nth-child(3) .kpi-icon { color: var(--orange); background: rgba(255,149,0,.1); }
.kpi-wrap:nth-child(4) .kpi-icon { color: var(--purple); background: rgba(175,82,222,.1); }

.student-kpi .label {
  font-size: .7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}

.student-kpi .value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -.03em;
}

/* ══════════════════
   PAGE HEADER
   ══════════════════ */
.student-page-header { margin-bottom: 1.25rem; }
.student-page-header h1 {
  font-size: 1.4rem; font-weight: 700;
  margin-bottom: .15rem; color: var(--text);
  letter-spacing: -.02em;
}
.student-page-header .lead {
  font-size: .88rem; color: var(--text-secondary); margin: 0; font-weight: 600;
}

/* ══════════════════
   COURSE CARDS — clean, image-first
   ══════════════════ */
.student-course-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  height: 100%;
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
  transition: all .2s var(--ease);
}

.student-course-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.student-course-card .thumb {
  aspect-ratio: 16/10; object-fit: cover; width: 100%; display: block;
}

.student-course-card .progress { height: 3px; background: var(--divider); border-radius: var(--r-pill); }
.student-course-card .progress-bar { background: var(--blue); border-radius: var(--r-pill); }

/* ══════════════════
   CONTINUE BANNER
   ══════════════════ */
.continue-banner {
  border-radius: var(--r-lg);
  background: var(--blue-light);
  border: 1px solid rgba(var(--blue-rgb),.1);
}

/* ══════════════════
   BUTTONS — macOS-style
   ══════════════════ */
.btn-student-primary {
  background: var(--blue);
  border: 0; color: white;
  font-weight: 600; font-size: .84rem;
  border-radius: var(--r-sm);
  padding: .45rem 1rem;
  transition: all .15s var(--ease);
}
.btn-student-primary:hover { background: var(--blue-hover); color: white; }

.btn-student-neon {
  background: var(--blue);
  border: 0; color: white;
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: all .15s var(--ease);
}
.btn-student-neon:hover { background: var(--blue-hover); color: white; }

.btn-student-ghost {
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: all .15s var(--ease);
}
.btn-student-ghost:hover { background: var(--bg-hover); color: var(--text); border-color: var(--text-tertiary); }

/* ══════════════════
   FORMS
   ══════════════════ */
.form-control, .form-select {
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--r-sm);
  font-size: .87rem;
  font-weight: 500;
  transition: all .15s var(--ease);
}
.form-control::placeholder { color: var(--text-tertiary); font-weight: 500; }
.form-control:focus, .form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb),.12);
  background: var(--bg-card); color: var(--text);
}

/* ══════════════════
   TABLE
   ══════════════════ */
.student-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.student-table-wrap .table {
  margin: 0;
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--divider);
  font-size: .85rem;
  font-weight: 500;
}
.student-table-wrap .table th { font-weight: 700; }

/* ══════════════════
   PILLS / BADGES
   ══════════════════ */
.quiz-status-pill {
  font-size: .7rem; padding: .15rem .45rem;
  border-radius: var(--r-pill);
  background: var(--blue-light); color: var(--blue);
  font-weight: 600; border: none;
}

.badge-soft {
  background: var(--blue-light); color: var(--blue);
  font-weight: 600; border: none;
  border-radius: var(--r-xs); padding: .25rem .55rem;
  font-size: .75rem;
}

/* ══════════════════
   EMPTY STATE
   ══════════════════ */
.empty-state { padding: 3rem 1.5rem; text-align: center; }
.empty-state .empty-icon {
  width: 64px; height: 64px; margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: var(--blue);
}

/* ══════════════════
   PROGRESS
   ══════════════════ */
.progress { height: 6px; background: var(--divider); border-radius: var(--r-pill); overflow: hidden; }
.progress-bar { background: var(--blue); border-radius: var(--r-pill); }

/* ══════════════════
   ALERTS
   ══════════════════ */
.alert { border-radius: var(--r-md); border: 1px solid var(--border); font-size: .85rem; }

/* ══════════════════
   FOOTER
   ══════════════════ */
.edu-footer { border-top: 1px solid var(--divider); background: var(--bg-card); }

/* ══════════════════
   BREADCRUMB
   ══════════════════ */
.breadcrumb { font-size: .78rem; }
.breadcrumb-item a { color: var(--blue); }

/* ══════════════════
   DROPDOWN
   ══════════════════ */
.dropdown-menu {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: .35rem; font-size: .85rem;
}
.dropdown-item { color: var(--text); border-radius: var(--r-xs); padding: .4rem .65rem; font-weight: 500; }
.dropdown-item:hover { background: var(--blue); color: white; }
.dropdown-divider { border-color: var(--divider); }

/* ══════════════════
   ACCORDION
   ══════════════════ */
.accordion-button { background: transparent; color: var(--text); box-shadow: none; border-radius: var(--r-sm) !important; font-size: .88rem; font-weight: 600; }
.accordion-button:not(.collapsed) { background: var(--bg-active); color: var(--blue); box-shadow: none; }
.accordion-item { background: transparent; border-color: var(--divider); }

/* ══════════════════
   NAV TABS
   ══════════════════ */
.nav-tabs { border-color: var(--divider); gap: .15rem; }
.nav-tabs .nav-link { color: var(--text-secondary); border-radius: var(--r-sm) var(--r-sm) 0 0; font-weight: 600; font-size: .87rem; padding: .55rem .9rem; }
.nav-tabs .nav-link.active { background: var(--bg-card); border-color: var(--border) var(--border) transparent; color: var(--blue); font-weight: 700; }

/* ══════════════════
   LIST GROUP
   ══════════════════ */
.list-group-item { background: transparent; border-color: var(--divider); color: var(--text); padding: .85rem 1.25rem; font-size: .88rem; font-weight: 500; }

/* ══════════════════
   MODAL
   ══════════════════ */
.modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); }

/* ══════════════════
   OFFCANVAS
   ══════════════════ */
.offcanvas { background: var(--bg-card); border-color: var(--border); }

/* ══════════════════
   HORIZONTAL SCROLL
   ══════════════════ */
.hscroll { overflow: auto hidden; white-space: nowrap; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }

/* ══════════════════
   RTL
   ══════════════════ */
[dir="rtl"] body,
[dir="rtl"] .edu-nav-link,
[dir="rtl"] .btn,
[dir="rtl"] .form-control,
[dir="rtl"] .form-select,
[dir="rtl"] input, [dir="rtl"] textarea, [dir="rtl"] select {
  font-family: var(--font-ar);
}
[dir="rtl"] .icon-flip,
[dir="rtl"] .bi-arrow-right::before,
[dir="rtl"] .bi-arrow-right-short::before,
[dir="rtl"] .bi-chevron-right::before,
[dir="rtl"] .bi-arrow-left::before,
[dir="rtl"] .bi-arrow-left-short::before,
[dir="rtl"] .bi-chevron-left::before,
[dir="rtl"] .bi-box-arrow-in-right::before,
[dir="rtl"] .bi-box-arrow-right::before {
  transform: scaleX(-1); display: inline-block;
}
[dir="rtl"] .student-page-header { text-align: right; }
[dir="rtl"] .table th, [dir="rtl"] .table td { text-align: right; }
[dir="rtl"] .table .text-end { text-align: left !important; }
[dir="rtl"] .alert, [dir="rtl"] .list-group-item, [dir="rtl"] .card-header, [dir="rtl"] .card-footer { text-align: right; }
[dir="rtl"] .hscroll { direction: rtl; }

/* ══════════════════
   REDUCED MOTION
   ══════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ══════════════════
   RESPONSIVE
   ══════════════════ */
@media (max-width: 575.98px) {
  .student-page-header h1 { font-size: 1.2rem; }
  .student-kpi .value { font-size: 1.25rem; }
  .student-kpi { padding: .9rem; }
  .edu-card, .student-card, .card { border-radius: var(--r-lg); }
}
