/* الجامعة - design system: indigo + violet, gold accent, soft surfaces */
:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #eef0ff;
  --violet: #7c3aed;
  --navy: #0b1437;
  --navy-2: #151f4f;
  --accent: #f5a524;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e6e9f5;
  --surface: #ffffff;
  --bg: #f4f6fd;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --grad-dark: linear-gradient(135deg, #0b1437 0%, #1e1b6b 55%, #4338ca 100%);
  --shadow-sm: 0 2px 8px rgba(30, 27, 107, .06);
  --shadow-md: 0 14px 36px rgba(30, 27, 107, .12);
  --radius: 1.1rem;
  --bs-primary: #4f46e5; --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5; --bs-link-hover-color: #3730a3;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-body-font-family: "Cairo", system-ui, sans-serif;
}

html { scroll-behavior: smooth; }
body {
  font-family: "Cairo", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }
h1, h2, h3, h4, h5 { font-weight: 800; letter-spacing: -.01em; }

/* ---------- navbar ---------- */
.navbar.site-nav {
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line) !important;
  padding: .55rem 0;
}
.site-nav .nav-link { font-weight: 600; color: #334155; border-radius: .6rem; padding: .45rem .8rem !important; }
.site-nav .nav-link:hover { background: var(--brand-light); color: var(--brand-dark); }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--navy) !important; display: flex; align-items: center; gap: .55rem; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 13px; display: inline-flex;
  align-items: center; justify-content: center; color: #fff;
  background: var(--grad); font-size: 1.2rem;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}

/* ---------- buttons ---------- */
.btn { border-radius: .8rem; font-weight: 700; }
.btn-brand, .btn-primary {
  background: var(--grad); border: 0; color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .28);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s;
}
.btn-brand:hover, .btn-brand:focus, .btn-primary:hover, .btn-primary:focus {
  background: var(--grad); filter: brightness(1.08); color: #fff;
  transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79, 70, 229, .36);
}
.btn-outline-brand, .btn-outline-primary { border: 1.5px solid var(--brand); color: var(--brand); background: transparent; }
.btn-outline-brand:hover, .btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-light { background: #fff; border-color: var(--line); }
.btn-gold { background: var(--accent); color: #3b2300; border: 0; box-shadow: 0 6px 16px rgba(245, 165, 36, .35); }
.btn-gold:hover { background: #ffb637; color: #3b2300; }

.text-brand { color: var(--brand) !important; }
.bg-brand { background: var(--grad) !important; color: #fff !important; }
.bg-brand-soft { background: var(--brand-light); }
.badge { font-weight: 700; }
.badge-soft { background: #eef0fb; color: #3d4670; font-weight: 600; border-radius: 2rem; padding: .4em .8em; }
.badge-brand { background: var(--brand-light); color: var(--brand-dark); border-radius: 2rem; padding: .45em .9em; }
.price { font-weight: 800; color: var(--brand); }

/* ---------- forms ---------- */
.form-control, .form-select {
  border-radius: .8rem; border: 1.5px solid var(--line); padding: .6rem .9rem; background-color: #fcfcff;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(79, 70, 229, .15); background: #fff;
}
.form-label { font-weight: 700; font-size: .92rem; color: #334155; }

/* ---------- cards ---------- */
.card { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-sm); background: var(--surface); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 800; padding: .9rem 1.1rem; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 1.1rem 1.2rem;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 5px; background: var(--grad);
}
.stat-card .value { font-size: 1.7rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.stat-card .small { color: var(--muted); font-weight: 600; }
.row > div:nth-child(4n+2) > .stat-card::before { background: linear-gradient(180deg, #06b6d4, #0ea5e9); }
.row > div:nth-child(4n+3) > .stat-card::before { background: linear-gradient(180deg, #f5a524, #f97316); }
.row > div:nth-child(4n+4) > .stat-card::before { background: linear-gradient(180deg, #10b981, #14b8a6); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff; padding: 4.5rem 0 5rem;
  background: var(--grad-dark);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none;
}
.hero::before { width: 380px; height: 380px; background: #7c3aed; top: -120px; inset-inline-end: -80px; }
.hero::after { width: 320px; height: 320px; background: #06b6d4; bottom: -160px; inset-inline-start: -60px; opacity: .35; }
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-weight: 800; font-size: clamp(1.85rem, 4.4vw, 3.1rem); line-height: 1.45; }
.hero .lead { color: #c7d0f5; }
.hero .badge-brand { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .25); }
.hero .btn-outline-brand { border-color: rgba(255, 255, 255, .6); color: #fff; }
.hero .btn-outline-brand:hover { background: #fff; color: var(--brand-dark); }
.hero .text-muted { color: #aeb9ec !important; }
.hero .text-brand { color: #fbbf24 !important; }
.hero .stat-card {
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2);
  backdrop-filter: blur(8px); box-shadow: none;
}
.hero .stat-card .value { color: #fff; }
.hero .stat-card .small { color: #c7d0f5 !important; }
.hero .stat-card::before { background: var(--accent) !important; }

.feature-icon {
  width: 54px; height: 54px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff; background: var(--grad); box-shadow: 0 8px 18px rgba(79, 70, 229, .3);
}
.col-md-4:nth-child(2) .feature-icon { background: linear-gradient(135deg, #06b6d4, #0ea5e9); box-shadow: 0 8px 18px rgba(14, 165, 233, .3); }
.col-md-4:nth-child(3) .feature-icon { background: linear-gradient(135deg, #f5a524, #f97316); box-shadow: 0 8px 18px rgba(249, 115, 22, .3); }
.section-title { position: relative; display: inline-block; }
.section-title::after { content: ""; display: block; width: 46px; height: 4px; border-radius: 4px; background: var(--accent); margin-top: .35rem; }

/* ---------- teacher cards ---------- */
.teacher-card { height: 100%; transition: transform .18s ease, box-shadow .18s ease; overflow: hidden; }
.teacher-card::before { content: ""; display: block; height: 6px; background: var(--grad); }
.teacher-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.avatar-circle {
  width: 58px; height: 58px; border-radius: 18px; background: var(--grad); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.3rem;
  overflow: hidden; flex: 0 0 auto; box-shadow: 0 6px 14px rgba(79, 70, 229, .25);
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- footer ---------- */
.site-footer { background: var(--navy); color: #c7d0f5; margin-top: 4rem !important; }
.site-footer .text-muted { color: #94a0d6 !important; }
.site-footer a { color: #dbe1ff; }
.site-footer a:hover { color: #fbbf24; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 160px); display: flex; align-items: center; }
.auth-card { border: 0; box-shadow: var(--shadow-md); overflow: hidden; }
.auth-side {
  background: var(--grad-dark); color: #fff; padding: 2.2rem; position: relative; overflow: hidden;
}
.auth-side::after {
  content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: #7c3aed;
  filter: blur(60px); opacity: .5; bottom: -90px; inset-inline-start: -60px;
}
.auth-side > * { position: relative; z-index: 1; }
.auth-side li { margin-bottom: .7rem; color: #dbe1ff; }
.auth-side i { color: #fbbf24; }

/* ---------- dashboard layout ---------- */
.dash-wrap { display: flex; gap: 1.5rem; padding: 1.5rem 0 3rem; }
.dash-nav {
  flex: 0 0 250px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; align-self: flex-start; position: sticky; top: 84px; box-shadow: var(--shadow-sm);
}
.dash-nav a {
  display: flex; align-items: center; gap: .65rem; padding: .62rem .85rem; border-radius: .8rem;
  color: #475569; font-weight: 600; font-size: .95rem; margin-bottom: 2px; transition: background .15s, color .15s;
}
.dash-nav a i { font-size: 1.1rem; color: #8b94b8; }
.dash-nav a:hover { background: var(--brand-light); color: var(--brand-dark); }
.dash-nav a.active { background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(79, 70, 229, .3); }
.dash-nav a.active i { color: #fff; }
.dash-content { flex: 1 1 auto; min-width: 0; }

@media (max-width: 991.98px) {
  .dash-wrap { display: block; padding-top: 1rem; }
  .dash-nav { position: static; display: flex; overflow-x: auto; gap: .35rem; margin-bottom: 1rem; padding: .5rem; scrollbar-width: none; }
  .dash-nav::-webkit-scrollbar { display: none; }
  .dash-nav a { white-space: nowrap; margin: 0; padding: .5rem .8rem; }
}

.page-title { font-weight: 800; font-size: 1.55rem; color: var(--navy); }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .75rem .7rem; vertical-align: middle; }
.table thead th { background: #f6f7fe; color: #475075; font-weight: 700; font-size: .88rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-hover tbody tr:hover > * { background: #f8f9ff; }
.table-responsive { border-radius: .8rem; }

/* ---------- misc components ---------- */
.alert { border-radius: .9rem; border: 0; }
.alert-info { background: #e8f1ff; color: #1e3a8a; }
.alert-success { background: #e4f8ee; color: #065f46; }
.alert-warning { background: #fff4dc; color: #7a4a00; }
.alert-danger { background: #ffe8ea; color: #991b1b; }
.nav-tabs .nav-link.active, .nav-pills .nav-link.active { background: var(--grad); color: #fff; border: 0; }
.nav-pills .nav-link { border-radius: .7rem; font-weight: 600; }
.pagination .page-link { border-radius: .6rem; margin: 0 2px; color: var(--brand); }
.pagination .active > .page-link { background: var(--brand); border-color: var(--brand); }
.list-group-item { border-color: var(--line); }
.progress { border-radius: 1rem; background: #eceefa; }
.progress-bar { background: var(--grad); }
.dropdown-menu { border-radius: .9rem; border: 1px solid var(--line); box-shadow: var(--shadow-md); padding: .4rem; }
.dropdown-item { border-radius: .6rem; font-weight: 600; }
.dropdown-item:hover { background: var(--brand-light); }

/* ---------- watch page ---------- */
.watch-shell {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9; width: 100%; box-shadow: var(--shadow-md);
}
.watch-shell iframe, .watch-shell #player { width: 100%; height: 100%; border: 0; }
#player { position: absolute; inset: 0; }
.player-shield { position: absolute; inset: 0; z-index: 4; cursor: pointer; background: transparent; display: flex; align-items: center; justify-content: center; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.player-shield i { display: none; font-size: 4rem; color: rgba(255, 255, 255, .9); }
.player-shield.paused { background: rgba(0, 0, 0, .92); }
.player-shield.paused i { display: block; }
.watermark {
  position: absolute; z-index: 5; pointer-events: none; color: rgba(255, 255, 255, .62);
  font-size: .85rem; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .85);
  transition: top 1.2s ease, left 1.2s ease; white-space: nowrap;
}
.watch-controls { background: var(--navy); color: #e2e8f0; padding: .65rem .85rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); }
.watch-controls .btn { color: #e2e8f0; border-color: #2c3a78; }
.watch-controls .btn:hover { background: #222e69; }
.watch-controls input[type="range"] { accent-color: #fbbf24; }
.watch-time { font-variant-numeric: tabular-nums; font-size: .85rem; color: #9fb0f0; }
.part-item { cursor: pointer; }
.part-item.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand-dark) !important; font-weight: 700; }
.video-locked { background: var(--navy); color: #cbd5e1; }

/* ---------- quiz ---------- */
.quiz-timer {
  position: sticky; top: 76px; z-index: 10; background: #fff7e6; border: 1px solid #fcd9a0;
  color: #8a4b00; border-radius: .9rem; padding: .6rem 1rem; font-weight: 700;
}
.question-card { border-inline-start: 5px solid var(--brand); }
.choice-row { display: flex; align-items: flex-start; gap: .6rem; padding: .65rem .85rem; border: 1.5px solid var(--line); border-radius: .8rem; margin-bottom: .5rem; cursor: pointer; transition: border-color .15s, background .15s; }
.choice-row:hover { background: #f6f7ff; border-color: #c5caf5; }
.schedule-day { font-weight: 700; color: var(--brand); }

@media (max-width: 575.98px) {
  .hero { padding: 2.6rem 0 3rem; }
  .page-title { font-size: 1.3rem; }
  .card-body { padding: 1rem; }
  .stat-card .value { font-size: 1.4rem; }
}

@media print {
  .navbar, .site-footer, .dash-nav, .no-print { display: none !important; }
  body { background: #fff; }
}

.nav-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; border: 2px solid var(--brand-light); }

.teacher-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
@media (min-width: 576px) { .teacher-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 992px) { .teacher-grid { grid-template-columns: repeat(6, 1fr); } }
.teacher-tile { display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none; color: inherit; gap: 4px; min-width: 0; }
.teacher-photo {
  width: 100%; max-width: 92px; aspect-ratio: 1 / 1; border-radius: 50%; overflow: hidden; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 2rem; box-shadow: 0 6px 14px rgba(79, 70, 229, .22);
}
.teacher-photo img { width: 100%; height: 100%; object-fit: cover; }
.teacher-name { font-size: .78rem; font-weight: 700; line-height: 1.3; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.teacher-subject { font-size: .68rem; color: #6b7280; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.teacher-tile:hover .teacher-photo { transform: scale(1.05); transition: transform .15s; }
