/* ═══════════════════════════════════════════════
   Harden Center — Main Stylesheet
   Colors: #1a4a8a (blue) | #E8A020 (gold)
   Default: Arabic RTL
═══════════════════════════════════════════════ */

:root {
  --primary: #1a4a8a;
  --primary-light: #2563b0;
  --primary-dark: #102f5c;
  --gold: #E8A020;
  --gold-light: #f5b84a;
  --gold-dark: #c07a10;
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-400: #adb5bd;
  --gray-600: #6c757d;
  --gray-800: #343a40;
  --success: #28a745;
  --danger: #dc3545;
  --kids-accent1: #ff6b6b;
  --kids-accent2: #4ecdc4;
  --kids-accent3: #ffe66d;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 16px rgba(26,74,138,0.12);
  --shadow-lg: 0 8px 32px rgba(26,74,138,0.18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  direction: rtl;
}
html[dir="ltr"] { direction: ltr; }

body {
  font-family: 'Segoe UI', 'Arial', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.6;
}

/* ─── Navbar ─────────────────────────────────── */
.navbar {
  background: var(--primary);
  color: var(--white);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
}
.nav-logo {
  width: 40px;
  height: 40px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--primary);
}
.nav-title {
  font-size: 1.1rem;
  font-weight: 700;
}
.nav-links {
  display: flex;
  gap: 4px;
}
.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: all 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
}
.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lang-btn {
  background: var(--gold);
  color: var(--primary);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}
.lang-btn:hover { background: var(--gold-light); }
.btn-logout {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 12px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.1); color: var(--white); }

/* ─── Page Container ─────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px;
}
.container-sm { max-width: 520px; margin: 0 auto; padding: 32px 20px; }

/* ─── Cards ──────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}
.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

/* ─── Buttons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-light); }
.btn-gold { background: var(--gold); color: var(--primary); }
.btn-gold:hover { background: var(--gold-light); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #b02a37; }
.btn-success { background: var(--success); color: var(--white); }
.btn-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Forms ──────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: border-color 0.2s;
  background: var(--white);
  color: var(--gray-800);
  text-align: inherit;
}
html[dir="ltr"] .form-control { text-align: left; }
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,74,138,0.12);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23343a40' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  padding-left: 36px;
}
html[dir="rtl"] .form-select {
  background-position: right 12px center;
  padding-left: 14px;
  padding-right: 36px;
}

/* ─── Alerts ─────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
}
.alert-danger { background: #fdecea; color: var(--danger); border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: var(--success); border: 1px solid #c3e6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ─── Auth Pages ─────────────────────────────── */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%, #0a1f3d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--white);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 460px;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo-circle {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 4px 16px rgba(26,74,138,0.3);
}
.auth-logo-circle span { font-size: 2rem; }
.auth-logo h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}
.auth-logo p {
  font-size: 0.9rem;
  color: var(--gray-600);
}
.auth-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  text-align: center;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--gray-600);
}
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ─── Portal Hero ────────────────────────────── */
.portal-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 32px 36px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.portal-hero h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.portal-hero p { opacity: 0.85; font-size: 0.95rem; }
.hero-stats { display: flex; gap: 20px; }
.stat-box {
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  text-align: center;
  backdrop-filter: blur(4px);
}
.stat-box .stat-value { font-size: 1.6rem; font-weight: 800; }
.stat-box .stat-label { font-size: 0.78rem; opacity: 0.85; }

/* ─── Activity Cards ─────────────────────────── */
.activity-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  text-align: center;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
  border-top: 4px solid var(--primary);
}
.activity-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.activity-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}
.activity-title { font-size: 1.15rem; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.activity-desc { font-size: 0.85rem; color: var(--gray-600); }

/* ─── Game Area ──────────────────────────────── */
.game-area {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px;
  max-width: 700px;
  margin: 0 auto;
}
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.game-title { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.game-progress {
  background: var(--gray-100);
  border-radius: 999px;
  height: 10px;
  margin-bottom: 28px;
  overflow: hidden;
}
.game-progress-bar {
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.score-badge {
  background: var(--gray-100);
  color: var(--primary);
  border-radius: 999px;
  padding: 4px 14px;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ─── Flashcard ──────────────────────────────── */
.flashcard-wrap {
  perspective: 1000px;
  margin: 28px auto;
  max-width: 440px;
  height: 220px;
}
.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s;
  cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  backface-visibility: hidden;
  padding: 24px;
}
.flashcard-front {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: var(--white);
}
.flashcard-back {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--primary);
  transform: rotateY(180deg);
}
.flashcard-word { font-size: 2.2rem; font-weight: 800; margin-bottom: 8px; }
.flashcard-hint { font-size: 0.85rem; opacity: 0.75; }
.flashcard-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ─── Spelling Game ──────────────────────────── */
.spelling-word {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin: 24px 0;
  letter-spacing: 2px;
}
.spelling-input-wrap {
  display: flex;
  gap: 10px;
  max-width: 360px;
  margin: 0 auto;
}
.spelling-input {
  flex: 1;
  font-size: 1.1rem;
  text-align: center;
  direction: ltr;
}
.answer-feedback {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  min-height: 40px;
  margin: 12px 0;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
}
.answer-feedback.correct { background: #d4edda; color: var(--success); }
.answer-feedback.wrong { background: #fdecea; color: var(--danger); }

/* ─── Quiz ───────────────────────────────────── */
.quiz-question {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 20px;
  line-height: 1.5;
}
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  padding: 14px 20px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  background: var(--white);
  text-align: inherit;
  width: 100%;
}
.quiz-option:hover { border-color: var(--primary); background: var(--gray-50); }
.quiz-option.correct { border-color: var(--success); background: #d4edda; color: var(--success); }
.quiz-option.wrong { border-color: var(--danger); background: #fdecea; color: var(--danger); }
.quiz-option:disabled { cursor: default; }

/* ─── Results Screen ─────────────────────────── */
.result-screen {
  text-align: center;
  padding: 20px;
}
.result-emoji { font-size: 5rem; margin-bottom: 16px; display: block; }
.result-score { font-size: 3rem; font-weight: 800; color: var(--primary); }
.result-label { font-size: 1rem; color: var(--gray-600); margin-bottom: 20px; }
.result-message { font-size: 1.2rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.stars-earned { font-size: 2rem; letter-spacing: 4px; margin: 12px 0; }
.points-earned { color: var(--gold-dark); font-weight: 700; font-size: 1.05rem; }

/* ─── Kids Portal (colorful) ─────────────────── */
.kids-portal .activity-card:nth-child(1) { border-color: var(--kids-accent1); }
.kids-portal .activity-card:nth-child(2) { border-color: var(--kids-accent2); }
.kids-portal .activity-card:nth-child(3) { border-color: var(--kids-accent3); }
.kids-portal .portal-hero {
  background: linear-gradient(135deg, #1a4a8a 0%, #2563b0 50%, #1e6aa0 100%);
}
.kids-portal .stat-box:nth-child(1) { background: rgba(255,107,107,0.2); }
.kids-portal .stat-box:nth-child(2) { background: rgba(255,230,109,0.2); }

/* ─── Progress Bars (Adults) ─────────────────── */
.progress-wrap { margin-bottom: 14px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: var(--gray-600);
}
.progress-bar-bg {
  background: var(--gray-200);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.6s ease;
}

/* ─── Vocabulary Match (Adults) ──────────────── */
.vocab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.vocab-item {
  padding: 14px 18px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
  background: var(--white);
  text-align: center;
}
.vocab-item:hover { border-color: var(--primary); background: var(--gray-50); }
.vocab-item.selected { border-color: var(--primary); background: rgba(26,74,138,0.08); }
.vocab-item.matched { border-color: var(--success); background: #d4edda; color: var(--success); pointer-events: none; }
.vocab-item.wrong-match { border-color: var(--danger); background: #fdecea; animation: shake 0.3s ease; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ─── Fill-in-blank ──────────────────────────── */
.blank-input {
  display: inline-block;
  border: none;
  border-bottom: 2px solid var(--primary);
  padding: 2px 8px;
  font-size: 1rem;
  font-style: italic;
  min-width: 120px;
  background: transparent;
  text-align: center;
  direction: ltr;
}
.blank-input:focus { outline: none; border-color: var(--gold); }
.sentence-item {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 12px;
  font-size: 1rem;
  line-height: 2;
}

/* ─── Reading ────────────────────────────────── */
.reading-passage {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 24px;
  margin-bottom: 24px;
  border-right: 4px solid var(--gold);
  font-size: 1rem;
  line-height: 1.9;
  color: var(--gray-800);
  direction: ltr;
  text-align: left;
}
html[dir="ltr"] .reading-passage { border-right: none; border-left: 4px solid var(--gold); }

/* ─── Worksheets ─────────────────────────────── */
.worksheet-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  background: var(--white);
  transition: box-shadow 0.2s;
  gap: 12px;
  flex-wrap: wrap;
}
.worksheet-item:hover { box-shadow: var(--shadow); }
.worksheet-week {
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.worksheet-title { font-weight: 600; flex: 1; }

/* ─── Teacher Dashboard ──────────────────────── */
.teacher-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--gray-200);
  flex-wrap: wrap;
}
.teacher-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.teacher-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.teacher-tab-panel { display: none; }
.teacher-tab-panel.active { display: block; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th {
  background: var(--primary);
  color: var(--white);
  padding: 10px 14px;
  text-align: inherit;
  font-weight: 600;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
}
.data-table tr:hover td { background: var(--gray-50); }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-kids { background: rgba(78,205,196,0.2); color: #0d8f87; }
.badge-adults { background: rgba(26,74,138,0.15); color: var(--primary); }

/* ─── Stars / Points Badges ──────────────────── */
.stars-display { letter-spacing: 2px; }
.points-pill {
  background: var(--gold);
  color: var(--primary);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-block;
}

/* ─── Loading Spinner ────────────────────────── */
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 640px) {
  .navbar { padding: 0 12px; height: 56px; }
  .nav-links { display: none; }
  .portal-hero { padding: 20px; }
  .portal-hero h1 { font-size: 1.2rem; }
  .hero-stats { gap: 10px; }
  .game-area { padding: 20px; }
  .flashcard-word { font-size: 1.6rem; }
  .vocab-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px; }
}
