/* ═══════════════════════════════════════════════════════════════════
   BAU Medical Portal — Styles
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Cairo:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────────────── */
:root {
  --font-en: 'Inter', sans-serif;
  --font-ar: 'Cairo', sans-serif;

  /* Dark theme (default) */
  --bg-base:        #070d1f;
  --bg-surface:     rgba(255,255,255,0.04);
  --bg-surface-hover: rgba(255,255,255,0.07);
  --bg-surface-active: rgba(255,255,255,0.10);
  --border:         rgba(255,255,255,0.08);
  --border-strong:  rgba(255,255,255,0.15);
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --color-primary:  #3b82f6;
  --color-primary-dim: rgba(59,130,246,0.15);
  --color-accent:   #f59e0b;
  --color-success:  #10b981;
  --color-danger:   #ef4444;
  --color-warning:  #f59e0b;

  --glass-bg:       rgba(15,23,42,0.7);
  --glass-border:   rgba(255,255,255,0.08);

  --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:      0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg:      0 24px 64px rgba(0,0,0,0.5);

  --radius-sm:      8px;
  --radius-md:      14px;
  --radius-lg:      20px;
  --radius-xl:      28px;

  --transition:     0.2s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 0.4s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] {
  --bg-base:        #eef2ff;
  --bg-surface:     rgba(255,255,255,0.8);
  --bg-surface-hover: rgba(255,255,255,0.95);
  --bg-surface-active: #ffffff;
  --border:         rgba(0,0,0,0.07);
  --border-strong:  rgba(0,0,0,0.15);
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --glass-bg:       rgba(255,255,255,0.75);
  --glass-border:   rgba(0,0,0,0.08);
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.08);
  --shadow-md:      0 8px 32px rgba(0,0,0,0.12);
  --shadow-lg:      0 24px 64px rgba(0,0,0,0.15);
}

[dir="rtl"] { font-family: var(--font-ar); }
[dir="ltr"] { font-family: var(--font-en); }

/* ─── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
a { text-decoration: none; color: inherit; }
input, textarea, select { font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Utilities ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ─── Animations ────────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes orbFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  33%      { transform: translate(30px,-20px) scale(1.05); }
  66%      { transform: translate(-20px,30px) scale(0.97); }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.view { display: none; min-height: calc(100vh - 64px); }
.view.active { display: block; }
.view.fade-in { animation: fadeInUp 0.45s ease both; }

/* ─── Header ────────────────────────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  height: 64px;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
[dir="rtl"] .header-inner { flex-direction: row-reverse; }

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-primary);
  transition: opacity var(--transition);
}
.header-logo i { color: var(--color-primary); font-size: 1.2rem; }
.header-logo:hover { opacity: 0.8; }

.header-user-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 6px 14px 6px 6px;
  cursor: default;
}
[dir="rtl"] .user-menu { padding: 6px 6px 6px 14px; }

.user-avatar-wrap {
  position: relative;
  width: 36px; height: 36px;
}
.user-avatar-img {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
.user-avatar-initials {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
}
.user-online-dot {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  background: var(--color-success);
  border-radius: 50%;
  border: 2px solid var(--bg-base);
}
[dir="rtl"] .user-online-dot { right: auto; left: 0; }

.user-info { display: flex; flex-direction: column; }
.user-name  { font-weight: 600; font-size: 0.85rem; line-height: 1.2; }
.user-email { font-size: 0.72rem; color: var(--text-muted); }

.btn-signout {
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.btn-signout:hover { color: var(--color-danger); background: rgba(239,68,68,0.1); }

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
}
.btn-microsoft {
  background: #fff;
  color: #1f2937;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  width: 100%;
}
.btn-microsoft:hover { background: #f8fafc; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
.btn-microsoft:active { transform: translateY(0); }
.btn-microsoft:disabled { opacity: 0.6; cursor: wait; }

.btn-demo {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  width: 100%;
}
.btn-demo:hover { background: var(--bg-surface-hover); color: var(--text-primary); }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: all var(--transition);
  margin-bottom: 20px;
}
.btn-back:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--bg-surface-hover); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  transition: all var(--transition);
  font-size: 0.95rem;
  position: relative;
}
.btn-icon:hover { color: var(--text-primary); background: var(--bg-surface-hover); border-color: var(--border-strong); }
.btn-icon.active { color: var(--color-accent); border-color: var(--color-accent); background: rgba(245,158,11,0.1); }

.btn-icon-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-icon-ghost:hover { color: var(--text-primary); background: var(--bg-surface); }
.btn-icon-ghost.small { font-size: 0.8rem; padding: 4px 8px; }

.lang-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  height: 38px;
  transition: all var(--transition);
}
.lang-btn:hover { color: var(--text-primary); background: var(--bg-surface-hover); }

/* ─── Landing ───────────────────────────────────────────────────────── */
#view-landing.active {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.landing-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: orbFloat 12s ease-in-out infinite;
}
.orb1 { width: 500px; height: 500px; background: #1d4ed8; top: -150px; left: -100px; animation-delay: 0s; }
.orb2 { width: 400px; height: 400px; background: #7c3aed; bottom: -100px; right: -80px; animation-delay: 4s; }
.orb3 { width: 300px; height: 300px; background: #0e7490; top: 40%; left: 50%; transform: translate(-50%,-50%); animation-delay: 8s; }

[data-theme="light"] .bg-orb { opacity: 0.12; }

.landing-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
}

.landing-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.logo-mark {
  width: 80px; height: 80px;
  border-radius: 24px;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  box-shadow: 0 16px 48px rgba(59,130,246,0.4);
}
.logo-main {
  font-size: 1.9rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
[data-theme="light"] .logo-main {
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.logo-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.signin-card {
  width: 100%;
  border-radius: var(--radius-xl);
  padding: 2px;
  background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(124,58,237,0.2));
  box-shadow: var(--shadow-lg);
}
.signin-inner {
  background: var(--glass-bg);
  border-radius: calc(var(--radius-xl) - 2px);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.signin-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--color-primary-dim);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.signin-inner h2 { font-size: 1.25rem; font-weight: 700; }
.signin-inner p  { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }

/* ─── Login Options ─────────────────────────────────────────────── */
.login-option { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.login-option-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.login-option-label i { color: var(--color-primary); font-size: 0.9rem; }
.login-domain-badge {
  margin-left: auto;
  font-size: 0.7rem;
  background: rgba(59,130,246,0.15);
  color: var(--color-primary);
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
}
.login-domain-badge.personal {
  background: rgba(245,158,11,0.12);
  color: var(--color-accent);
}
.btn-personal {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition);
}
.btn-personal:hover { background: var(--bg-surface-hover); border-color: var(--color-accent); }

/* ─── Code Modal ─────────────────────────────────────────────────── */
.code-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.code-modal-overlay.hidden { display: none; }

.code-modal {
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.code-modal.verified { border-color: rgba(16,185,129,0.4); }

.code-modal-icon {
  width: 60px; height: 60px;
  border-radius: 18px;
  background: rgba(245,158,11,0.12);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}
.code-modal h3 { font-size: 1.2rem; font-weight: 700; }
#code-modal-sub { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }

.code-input-wrap {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}
.code-input {
  width: 100%;
  background: var(--bg-surface-active);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 48px 14px 18px;
  color: var(--text-primary);
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  outline: none;
  transition: border-color var(--transition);
  text-align: center;
}
.code-input:focus { border-color: var(--color-accent); }
.code-eye-btn {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 4px;
  transition: color var(--transition);
}
[dir="rtl"] .code-eye-btn { right: auto; left: 14px; }
.code-eye-btn:hover { color: var(--text-primary); }

.code-modal-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-code-verify {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #d97706, var(--color-accent));
  color: #000;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(245,158,11,0.3);
}
.btn-code-verify:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(245,158,11,0.4); }
.btn-code-verify:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-code-cancel {
  width: 100%;
  padding: 11px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.88rem;
  transition: all var(--transition);
}
.btn-code-cancel:hover { color: var(--text-primary); background: var(--bg-surface); }

.code-attempts {
  font-size: 0.8rem;
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.code-attempts.wrong { color: var(--color-danger); }
.code-attempts.locked { color: var(--color-warning); }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  15%      { transform: translateX(-8px); }
  30%      { transform: translateX(7px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(5px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(2px); }
}
.shake { animation: shake 0.5s ease; }

.signin-divider {
  width: 100%;
  position: relative;
  text-align: center;
}
.signin-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 1px;
  background: var(--border);
}
.signin-divider span {
  position: relative;
  background: var(--glass-bg);
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.landing-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.divider-dot { color: var(--text-muted); }

/* ─── View Hero ─────────────────────────────────────────────────────── */
.view-hero {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px 32px;
}
.view-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.view-hero p {
  color: var(--text-secondary);
  font-size: 1rem;
}
.view-hero.compact { padding-bottom: 20px; }

/* ─── Year Grid ─────────────────────────────────────────────────────── */
.year-grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.year-card {
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  border: 1px solid var(--border);
}
.year-card.unlocked {
  cursor: pointer;
  border-color: rgba(var(--accent-rgb), 0.3);
  box-shadow: 0 0 0 1px var(--border);
}
.year-card.unlocked::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent, var(--color-primary)), transparent 60%);
  opacity: 0.05;
  transition: opacity var(--transition);
}
.year-card.unlocked:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,0.3), 0 0 0 1px var(--accent,var(--color-primary)); }
.year-card.unlocked:hover::before { opacity: 0.1; }

.year-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.year-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.year-number {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
}
.lock-badge {
  color: var(--text-muted);
  font-size: 1rem;
}
.year-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.coming-soon-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--border);
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 99px;
  margin-top: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ─── Semester Grid ──────────────────────────────────────────────────── */
.semester-grid {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.semester-card {
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  border: 1px solid var(--border);
}
.semester-card.unlocked {
  cursor: pointer;
}
.semester-card.unlocked:hover {
  transform: translateY(-4px);
  border-color: var(--accent, var(--color-primary));
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}
.semester-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
}
.sem-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
}
.sem-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.sem-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--glass-bg);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}
.lock-overlay i { font-size: 1.5rem; }

/* ─── Subject Grid ───────────────────────────────────────────────────── */
.subject-grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 48px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.subject-card {
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
}
.subject-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 40%, rgba(0,0,0,0.5) 100%);
}
.subject-card:hover { transform: translateY(-6px) scale(1.01); box-shadow: var(--shadow-lg); }
.subject-card-inner {
  position: relative;
  z-index: 1;
  padding: 28px;
  color: #fff;
}
.subject-icon-wrap {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}
.subject-name {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
}
.subject-desc {
  font-size: 0.88rem;
  opacity: 0.8;
  margin-bottom: 16px;
  line-height: 1.5;
}
.subject-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.82rem;
  opacity: 0.9;
}
.subject-meta i { margin-right: 4px; }
.kenhub-badge {
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
}
.subject-progress {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  opacity: 0.9;
}
.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar.slim { height: 4px; }
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--color-primary);
  transition: width 0.6s ease;
}
.progress-fill.white { background: rgba(255,255,255,0.9); }

/* ─── Lectures View ──────────────────────────────────────────────────── */
.subject-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 12px 0 16px;
}
.subject-header-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent, var(--color-primary)) 15%, transparent);
  color: var(--accent, var(--color-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.subject-header h1 { font-size: 1.6rem; font-weight: 800; }
.subject-header p { font-size: 0.88rem; color: var(--text-secondary); margin-top: 4px; }
.subject-progress-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}
.subject-progress-bar .progress-bar { height: 4px; background: var(--border); }

.lectures-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
  margin-top: 28px;
}
.section-title:first-child { margin-top: 0; }
.section-title i { color: var(--color-primary); }

.lec-search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 16px;
  margin-bottom: 6px;
  transition: border-color var(--transition);
}
.lec-search-wrap:focus-within { border-color: var(--color-primary); }
.lec-search-wrap i { color: var(--text-muted); }
.lec-search-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.92rem;
  padding: 13px 0;
}

.lec-list { display: flex; flex-direction: column; gap: 8px; }

.lec-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  transition: all var(--transition);
  border: 1px solid var(--border);
  position: relative;
}
.lec-card:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); }
.lec-card.watched { opacity: 0.65; }
.lec-card.watched:hover { opacity: 1; }
.lec-card.no-video { opacity: 0.55; }

.lec-num {
  min-width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-active);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kenhub-num {
  background: rgba(245,158,11,0.15);
  color: var(--color-accent);
}

.lec-info { flex: 1; min-width: 0; }
.lec-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lec-duration {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.lec-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
  width: 120px;
}
.lec-progress-bar div {
  height: 100%;
  background: var(--color-primary);
  border-radius: 99px;
  transition: width 0.3s ease;
}

.lec-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.watched-badge, .bookmark-indicator {
  color: var(--color-success);
  font-size: 0.9rem;
}
.bookmark-indicator { color: var(--color-accent); }

.btn-mark-watched {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}
.btn-mark-watched:hover { color: var(--color-success); background: rgba(16,185,129,0.1); }
.lec-card.watched .btn-mark-watched { color: var(--color-success); }

.lec-play-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
.lec-play-btn:hover { background: #2563eb; transform: scale(1.05); box-shadow: 0 6px 16px rgba(59,130,246,0.4); }
.lec-play-btn.disabled {
  background: var(--bg-surface-active);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.kenhub-section {
  margin-top: 32px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(245,158,11,0.02));
  border: 1px solid rgba(245,158,11,0.15);
}
.kenhub-title { color: var(--color-accent); }
.kenhub-logo {
  width: 24px; height: 24px;
  background: var(--color-accent);
  color: #000;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.75rem;
}
.kenhub-subtitle {
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin-left: 8px;
  font-size: 0.8rem;
}

.no-results {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ─── Player View ───────────────────────────────────────────────────── */
#view-player { min-height: calc(100vh - 64px); }

.player-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  height: calc(100vh - 64px);
  overflow: hidden;
  transition: grid-template-columns var(--transition-slow);
}
.player-layout.sidebar-open {
  grid-template-columns: 1fr 420px;
}
.player-layout:not(.sidebar-open) .player-sidebar {
  display: none;
}
@media (max-width: 900px) {
  .player-layout.sidebar-open {
    grid-template-columns: 1fr;
  }
}

.player-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.player-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.player-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  overflow: hidden;
}
.player-breadcrumb span:last-child {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.dot-indicator {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--color-accent);
  border-radius: 50%;
}

.video-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  min-height: 0;
}
.video-wrapper video,
.video-wrapper .plyr,
.video-wrapper iframe {
  width: 100%;
  height: 100%;
  max-height: 100%;
}
.video-wrapper .plyr { --plyr-color-main: var(--color-primary); }
.yt-frame { width: 100%; height: 100%; border: none; display: block; }

.no-video-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted);
  padding: 40px;
  text-align: center;
  background: #000;
  width: 100%;
  height: 100%;
  min-height: 300px;
}
.no-video-placeholder i { font-size: 3rem; opacity: 0.4; }
.no-video-placeholder p { font-size: 1rem; font-weight: 600; }
.no-video-placeholder span { font-size: 0.8rem; opacity: 0.6; max-width: 300px; line-height: 1.5; }

.player-title-row {
  padding: 12px 20px 0;
  flex-shrink: 0;
}
.player-title-row h2 {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-actions {
  display: flex;
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
  flex: 1;
  justify-content: center;
  min-width: 130px;
}
.action-btn:hover:not(:disabled):not(.faded) {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}
.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.action-btn.faded { opacity: 0.5; cursor: default; }

.ai-btn {
  background: linear-gradient(135deg, rgba(124,58,237,0.1), rgba(59,130,246,0.1));
  border-color: rgba(124,58,237,0.2);
  cursor: not-allowed;
}
.ai-badge {
  font-size: 0.68rem;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: #fff;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.slides-btn:not(.faded):hover { color: #16a34a; border-color: #16a34a; background: rgba(22,163,74,0.08); }
.guide-btn:not(.faded):hover { color: var(--color-accent); border-color: var(--color-accent); background: rgba(245,158,11,0.08); }

.soon-tag {
  font-size: 0.68rem;
  background: var(--border);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 99px;
}

/* ─── Player Sidebar ────────────────────────────────────────────────── */
.player-sidebar {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-base);
  overflow: hidden;
}
[dir="rtl"] .player-sidebar { border-left: none; border-right: 1px solid var(--border); }

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-tab {
  flex: 1;
  padding: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.sidebar-tab:hover { color: var(--text-primary); }
.sidebar-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); background: var(--bg-surface); }

.sidebar-content { flex: 1; overflow: hidden; position: relative; }
.sidebar-panel { display: none; height: 100%; flex-direction: column; }
.sidebar-panel.active { display: flex; }

.slides-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}
.slides-frame {
  flex: 1;
  border: none;
  background: #fff;
}

.sidebar-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 40px;
  text-align: center;
}
.sidebar-empty i { font-size: 2.5rem; opacity: 0.3; }
.sidebar-empty p { font-size: 0.9rem; }

.notes-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}
.notes-topbar span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}
.btn-save-notes {
  padding: 6px 14px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-save-notes:hover { background: #2563eb; }

.notes-textarea {
  flex: 1;
  padding: 16px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.7;
  resize: none;
  height: 100%;
}

/* ─── Progress Bars in Lecture List ────────────────────────────────── */
.year-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.year-progress .progress-bar { flex: 1; height: 5px; background: var(--border); }
.progress-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }

/* ─── Keyboard Shortcut Hint ────────────────────────────────────────── */
.kbd-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--glass-bg);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(16px);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
}
.kbd-hint.show { transform: translateX(-50%) translateY(0); }

/* ─── Toast Notifications ───────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
[dir="rtl"] #toast-container { right: auto; left: 24px; }

.toast {
  background: var(--glass-bg);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(16px);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  transform: translateX(120%);
  transition: transform var(--transition);
  max-width: 360px;
}
.toast.show { transform: translateX(0); }
.toast-error { border-color: rgba(239,68,68,0.3); }
.toast-error i { color: var(--color-danger); }
.toast-success i { color: var(--color-success); }

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .year-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .subject-grid { grid-template-columns: 1fr; }
  .semester-grid { grid-template-columns: 1fr; }
  .view-hero h1 { font-size: 1.5rem; }
  .player-actions { flex-direction: column; }
  .action-btn { min-width: unset; }
  .player-layout.sidebar-open { grid-template-columns: 1fr; }
  .player-sidebar { position: fixed; inset: 64px 0 0; z-index: 50; }
  .landing-content { gap: 24px; }
  .logo-main { font-size: 1.5rem; }
  .user-info { display: none; }
}

@media (max-width: 480px) {
  .year-grid { grid-template-columns: 1fr; }
  .signin-inner { padding: 24px 20px; }
  .view-hero { padding: 24px 16px 20px; }
  .year-grid, .subject-grid, .semester-grid, .lectures-container { padding-left: 16px; padding-right: 16px; }
}

/* ─── Plyr overrides ────────────────────────────────────────────────── */
.plyr--video { border-radius: 0; }
.plyr__control--overlaid { background: rgba(59,130,246,0.9) !important; }
.plyr--full-ui input[type=range] { color: var(--color-primary); }
