/* ============================================
   Student Portal – page-specific components
   (extends theme.css / layout.css / components.css)
   ============================================ */

/* ---- Auth / login ---- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--navy-700) 0%, var(--navy-900) 100%);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 24px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.auth-logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--navy-600), var(--navy-500));
  border: 2px solid var(--gold-400);
  box-shadow: var(--shadow-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  color: var(--navy-600);
  margin-bottom: 4px;
}
[dir="rtl"] .auth-title { font-family: var(--font-arabic); }

.auth-portal-chip {
  display: inline-block;
  margin: 6px 0 10px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(169, 129, 48, 0.12);
  color: var(--gold-400);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.auth-subtitle { font-size: 14px; color: var(--gray-500); margin-bottom: 28px; }

.auth-field { text-align: start; margin-bottom: 20px; }

.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 14px 0 20px; }
.pin-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gray-200);
  transition: background 0.15s, transform 0.15s;
}
.pin-dot.filled { background: var(--gold-400); transform: scale(1.1); }

.auth-error {
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--r-md);
  color: var(--error);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.keypad {
  direction: ltr;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.keypad button {
  min-height: 56px;
  border-radius: var(--r-md);
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  color: var(--navy-600);
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  transition: all 0.15s;
}
.keypad button:hover { background: #FEF9E7; border-color: var(--gold-400); }
.keypad button:active { transform: scale(0.97); }

/* ---- Progress subject cards (dashboard) ---- */
.subject-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.subject-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  padding: 20px;
  transition: all 0.3s ease;
}
.subject-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(169, 129, 48, 0.35);
  transform: translateY(-3px);
}
.subject-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.subject-card-icon {
  width: 44px; height: 44px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.subject-card-name { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.subject-card-pct {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  margin-inline-start: auto;
}

/* ---- Homework list (table-like rows) ---- */
.hw-table { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--r-xl); overflow: hidden; }

.hw-table-head {
  display: grid;
  grid-template-columns: 2.2fr 1.2fr 1.2fr auto;
  gap: 16px;
  padding: 14px 24px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gray-500);
}

.hw-row {
  display: grid;
  grid-template-columns: 2.2fr 1.2fr 1.2fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.2s;
}
.hw-row:last-child { border-bottom: none; }
.hw-row:hover { background: var(--gray-50); }
.hw-row.is-static { cursor: default; }

.hw-cell-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hw-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.hw-name { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.hw-subject { font-size: 13px; color: var(--gray-500); }
.hw-due { font-size: 13px; color: var(--gray-600); }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-pill.in_progress { background: rgba(245, 158, 11, 0.12); color: #B45309; }
.status-pill.completed   { background: rgba(16, 185, 129, 0.12); color: #047857; }
.status-pill.late        { background: rgba(239, 68, 68, 0.12);  color: #B91C1C; }
.status-pill.not_started { background: var(--gray-100); color: var(--gray-600); }

@media (max-width: 767px) {
  .hw-table-head { display: none; }
  .hw-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "title status" "due status";
    row-gap: 6px;
  }
  .hw-cell-title { grid-area: title; }
  .hw-due { grid-area: due; }
  .hw-row > .status-pill-wrap { grid-area: status; }
  .hw-cell-subject { display: none; }
}

/* ---- Filter chips ---- */
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-chip {
  padding: 10px 20px;
  min-height: 44px;
  border-radius: var(--r-md);
  background: #fff;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.filter-chip:hover { background: var(--gray-50); border-color: var(--gray-300); }
.filter-chip.active {
  background: var(--grad-gold-btn);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-gold);
}

/* ---- Timetable ---- */
.timetable-wrap { overflow-x: auto; }
.timetable {
  width: 100%;
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 8px;
}
.timetable th {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-600);
  padding: 10px 6px;
  text-align: center;
}
[dir="rtl"] .timetable th { font-family: var(--font-arabic); }
.timetable td { padding: 0; }
.tt-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-align: center;
  width: 80px;
  white-space: nowrap;
}
.tt-cell {
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  background: var(--gray-50);
  min-height: 62px;
}
.tt-cell.filled { border: 1px solid rgba(0, 0, 0, 0.04); }
.tt-cell-icon { display: block; font-size: 16px; margin-bottom: 3px; }

/* ---- Badges ---- */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}
.badge-tile {
  text-align: center;
  padding: 20px 12px;
  border-radius: var(--r-lg);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  transition: all 0.25s;
}
.badge-tile:hover { box-shadow: var(--shadow-card); transform: translateY(-3px); }
.badge-tile.locked { opacity: 0.5; }
.badge-circle {
  width: 60px; height: 60px;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  background: #fff;
  border: 2px solid var(--gold-300);
  box-shadow: 0 3px 12px rgba(169, 129, 48, 0.18);
}
.badge-tile.locked .badge-circle { border-style: dashed; border-color: var(--gray-300); box-shadow: none; }
.badge-tile-name { font-size: 13px; font-weight: 600; color: var(--gray-800); margin-bottom: 3px; }
.badge-tile-desc { font-size: 11px; color: var(--gray-500); line-height: 1.4; }

/* compact badges in dashboard widget */
.badges-mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.badge-mini { text-align: center; }
.badge-mini.locked { opacity: 0.45; }
.badge-mini-circle {
  width: 44px; height: 44px;
  border-radius: 50%;
  margin: 0 auto 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  background: #FEF9E7;
  border: 2px solid var(--gold-300);
}
.badge-mini.locked .badge-mini-circle { border-style: dashed; border-color: var(--gray-300); background: var(--gray-50); }
.badge-mini-name { font-size: 10px; color: var(--gray-500); line-height: 1.3; }

/* ---- Level journey ---- */
.level-track { display: flex; align-items: center; gap: 6px; }
.level-node { display: flex; align-items: center; gap: 6px; flex: 1; }
.level-circle {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--gray-100);
  color: var(--gray-500);
}
.level-circle.reached { background: var(--grad-gold-btn); color: #fff; box-shadow: var(--shadow-gold); }
.level-line { flex: 1; height: 4px; border-radius: 2px; background: var(--gray-200); }
.level-line.reached { background: var(--gold-400); }

/* ---- Messages ---- */
.message-row {
  display: flex;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
}
.message-row:last-child { border-bottom: none; }
.message-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-600), var(--navy-500));
  color: var(--gold-400);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.message-name { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.message-text { font-size: 14px; color: var(--gray-600); margin-top: 4px; line-height: 1.5; }
.message-time { font-size: 12px; color: var(--gray-400); margin-top: 6px; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--error); flex-shrink: 0; }

/* mini messages in widget */
.msg-mini { display: flex; gap: 12px; align-items: flex-start; }
.msg-mini + .msg-mini { margin-top: 16px; }
.msg-mini-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-600), var(--navy-500));
  color: var(--gold-400);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}
.msg-mini-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.msg-mini-text { font-size: 12px; color: var(--gray-500); margin-top: 2px; line-height: 1.45; }

/* ---- Practice cards ---- */
.practice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.practice-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.practice-card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(169, 129, 48, 0.4);
  transform: translateY(-4px);
}
.practice-icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin-bottom: 16px;
}
.practice-name {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--navy-600);
  margin-bottom: 6px;
}
[dir="rtl"] .practice-name { font-family: var(--font-arabic); }
.practice-count { font-size: 13px; color: var(--gray-500); margin-bottom: 16px; }

/* ---- Profile ---- */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--navy-600) 0%, var(--navy-700) 100%);
  color: #fff;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.profile-hero-avatar {
  width: 80px; height: 80px;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--navy-500), var(--navy-400));
  box-shadow: 0 0 0 2px var(--navy-700), 0 0 0 5px var(--gold-400);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 700;
  color: var(--gold-400);
  flex-shrink: 0;
}
.profile-hero-name { font-family: var(--font-heading); font-size: 24px; font-weight: 600; }
[dir="rtl"] .profile-hero-name { font-family: var(--font-arabic); }
.profile-hero-meta { font-size: 14px; color: rgba(255, 255, 255, 0.65); margin-top: 4px; }

.settings-list { display: flex; flex-direction: column; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  color: var(--gray-700);
}
.settings-row:last-child { border-bottom: none; }

.toggle-switch {
  width: 46px; height: 26px;
  border-radius: 999px;
  padding: 3px;
  display: flex;
  background: var(--gray-300);
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch.on { background: var(--gold-400); justify-content: flex-end; }
.toggle-switch:not(.on) { justify-content: flex-start; }
.toggle-knob { width: 20px; height: 20px; border-radius: 50%; background: #fff; display: block; }

.teacher-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.teacher-row:last-child { border-bottom: none; }
.teacher-name { font-size: 13px; color: var(--gray-500); }

/* ---- Solve screen ---- */
.solve-screen { min-height: 100vh; display: flex; flex-direction: column; background: var(--gray-50); }

.solve-topbar {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 32px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.solve-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.solve-meta-group { display: flex; align-items: center; gap: 12px; }

.solve-score-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  font-weight: 700;
  font-size: 14px;
}
.solve-timer-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}
[dir="rtl"] .solve-timer-chip { padding: 6px 6px 6px 14px; }
.solve-pause-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: center;
  color: var(--navy-600);
  flex-shrink: 0;
}
.solve-pause-btn:hover { background: #FEF9E7; border-color: var(--gold-400); }
.solve-timer-text { font-weight: 700; font-size: 14px; color: var(--gray-800); font-variant-numeric: tabular-nums; direction: ltr; }

.solve-title { font-family: var(--font-heading); font-size: 18px; font-weight: 600; color: var(--navy-600); text-align: center; }
[dir="rtl"] .solve-title { font-family: var(--font-arabic); }
.solve-counter { font-size: 13px; color: var(--gray-500); margin-top: 2px; text-align: center; }

.solve-progress-track { height: 6px; border-radius: 999px; background: var(--gray-200); overflow: hidden; margin-top: 14px; }
.solve-progress-fill { height: 100%; border-radius: 999px; background: var(--grad-gold-btn); transition: width 0.3s ease; }

.solve-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }

.solve-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  text-align: center;
  width: 100%;
}
.solve-card.question { max-width: 680px; padding: 44px 48px; }
.solve-card.state { max-width: 460px; padding: 44px 36px; }

.solve-emoji { font-size: 46px; margin-bottom: 14px; }
.solve-headline { font-family: var(--font-heading); font-size: 21px; font-weight: 600; color: var(--navy-600); margin-bottom: 8px; }
[dir="rtl"] .solve-headline { font-family: var(--font-arabic); }
.solve-sub { font-size: 14px; color: var(--gray-500); }

.question-text {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
  margin-bottom: 32px;
  text-wrap: pretty;
}
[dir="rtl"] .question-text { font-family: var(--font-arabic); font-weight: 700; }

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.option-btn {
  min-height: 68px;
  padding: 16px 14px;
  border-radius: var(--r-lg);
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  color: var(--gray-800);
  font-size: 17px;
  font-weight: 600;
  transition: all 0.18s;
}
.option-btn:hover:not(:disabled) { border-color: var(--gold-400); background: #FEF9E7; }
.option-btn.correct { background: rgba(16, 185, 129, 0.1); border-color: var(--success); color: #047857; }
.option-btn.wrong   { background: rgba(239, 68, 68, 0.1);  border-color: var(--error);   color: #B91C1C; }
.option-btn.dim     { opacity: 0.5; }

.earned-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(169, 129, 48, 0.12);
  color: var(--gold-400);
  font-weight: 700;
  font-size: 14px;
  margin: 18px 0 24px;
}

@media (max-width: 767px) {
  .solve-topbar { padding: 14px 16px; }
  .solve-topbar-inner { gap: 12px; }
  .solve-title-group { order: 3; width: 100%; }
  .solve-card.question { padding: 28px 20px; }
  .question-text { font-size: 21px; margin-bottom: 22px; }
  .options-grid { grid-template-columns: 1fr; }
  .badges-mini { grid-template-columns: repeat(4, 1fr); }
  .profile-hero { padding: 20px; }
}

@media (max-width: 479px) {
  .subject-cards-grid { grid-template-columns: 1fr 1fr; }
  .level-circle { width: 36px; height: 36px; font-size: 13px; }
}
