/* =========================
   Learning Portal – Clean Bilingual Design
   ========================= */

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

:root {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --background: #f2f2f7;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Naskh Arabic", "Amiri", Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Direction helpers */
[dir="rtl"] body { font-family: "Noto Naskh Arabic", "Amiri", "Segoe UI", Arial, sans-serif; }

/* =========================
   Header
   ========================= */
.header {
  text-align: center;
  padding: calc(40px + env(safe-area-inset-top)) 20px 24px;
}

.header h1 {
  font-size: 2.2rem;
  color: var(--primary);
  font-weight: 700;
}

.header p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 1.05rem;
}

/* Language switch */
.lang-switch {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}

.lang-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.lang-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.lang-btn:hover:not(.active) {
  border-color: var(--primary-light);
}

/* =========================
   Container
   ========================= */
.container {
  max-width: 1100px;
  margin: 0 auto 50px;
  padding: 0 20px;
}

/* =========================
   Cards Grid
   ========================= */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
  list-style: none;
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

.card a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  padding: 28px 18px;
  text-decoration: none;
  color: inherit;
  text-align: center;
}

.card .icon {
  font-size: 42px;
  color: var(--primary);
  margin-bottom: 12px;
}

.card h2 {
  font-size: 1.25rem;
  margin-bottom: 6px;
  color: var(--text);
}

.card p {
  font-size: 0.92rem;
  color: var(--muted);
}

/* Class / Unit cards (left border style) */
.card.horizontal a {
  flex-direction: row;
  justify-content: flex-start;
  text-align: start;
  min-height: 90px;
  gap: 16px;
  padding: 20px 22px;
}

.card.horizontal .icon {
  margin-bottom: 0;
  font-size: 32px;
}

.card.horizontal .info h2 {
  margin-bottom: 2px;
}

/* =========================
   Navigation
   ========================= */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.nav-bar .brand {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 10px;
  transition: background 0.2s;
}

.back-link:hover {
  background: rgba(30, 58, 138, 0.08);
}

/* =========================
   Page Title Section
   ========================= */
.page-title {
  text-align: center;
  padding: 32px 20px 20px;
}

.page-title h1 {
  font-size: 1.9rem;
  color: var(--primary);
}

.page-title p {
  margin-top: 6px;
  color: var(--muted);
}

/* =========================
   Footer
   ========================= */
.footer {
  text-align: center;
  padding: 30px 15px 40px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* =========================
   Quiz Placeholder
   ========================= */
.quiz-placeholder {
  background: var(--card);
  border-radius: 16px;
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow);
  max-width: 560px;
  margin: 30px auto;
}

.quiz-placeholder h2 {
  color: var(--primary);
  margin-bottom: 12px;
}

.quiz-placeholder p {
  color: var(--muted);
  margin-bottom: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn:hover {
  background: var(--primary-light);
}

.btn.secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 600px) {
  .header h1 { font-size: 1.8rem; }
  .page-title h1 { font-size: 1.6rem; }
  .grid { gap: 16px; }
  .card a { min-height: 150px; padding: 22px 14px; }
}
