/* ============================================
   Mou3allim — Design System
   Palette: deep teal + warm amber + ink + sand
   Type: Fraunces (display) + Inter (body/UI)
   Signature: Tunisian zellige-inspired tile dividers
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=Noto+Kufi+Arabic:wght@400;500;600;700;800&display=swap');

:root {
  --teal: #0E7C66;
  --teal-dark: #0A5D4C;
  --teal-tint: #E6F4EC;
  --amber: #E8A33D;
  --amber-dark: #C9862A;
  --ink: #1C1C1E;
  --ink-soft: #4A4A4E;
  --muted: #6B6B70;
  --sand: #FAF8F4;
  --card: #FFFFFF;
  --border: #ECE7DE;
  --danger: #C24A3F;
  --danger-tint: #FBEAE7;
  --success: #2E8B57;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 2px 8px rgba(28,28,30,0.06);
  --shadow-md: 0 8px 24px rgba(28,28,30,0.08);
  --shadow-lg: 0 20px 50px rgba(28,28,30,0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--sand);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* Focus visibility for accessibility */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-narrow {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,248,244,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Fraunces', serif; font-weight: 700; font-size: 22px; color: var(--ink);
}
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 17px; font-weight: 700;
}
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-link { font-size: 15px; font-weight: 600; color: var(--ink-soft); transition: color 0.15s; }
.nav-link:hover { color: var(--teal); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 28px; border-radius: 999px; border: none;
  font-weight: 700; font-size: 15px; transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-dark); box-shadow: var(--shadow-md); }
.btn-amber { background: var(--amber); color: white; }
.btn-amber:hover { background: var(--amber-dark); box-shadow: var(--shadow-md); }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }
.btn-danger { background: var(--danger); color: white; }
.btn-block { width: 100%; }
.btn-sm { padding: 9px 18px; font-size: 13px; }
.btn:disabled { opacity: 0.6; pointer-events: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius-md);
  border: 1px solid var(--border); padding: 24px;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 13px; font-weight: 700; color: var(--ink);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.03em;
}
.input, .textarea, select.input {
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; color: var(--ink);
  background: var(--card); transition: border-color 0.15s;
}
.input:focus, .textarea:focus { border-color: var(--teal); outline: none; }
.textarea { resize: vertical; min-height: 90px; }
.helper { font-size: 13px; color: var(--muted); margin-top: 6px; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--card); font-size: 13px; font-weight: 600; color: var(--ink);
  transition: all 0.15s;
}
.chip:hover { border-color: var(--teal); }
.chip.active { background: var(--teal); border-color: var(--teal); color: white; }

/* ---------- Signature: Zellige tile divider ---------- */
.tile-divider {
  height: 14px;
  background-image: repeating-linear-gradient(45deg, var(--teal) 0, var(--teal) 2px, transparent 2px, transparent 14px),
                     repeating-linear-gradient(-45deg, var(--amber) 0, var(--amber) 2px, transparent 2px, transparent 14px);
  background-size: 28px 28px;
  opacity: 0.35;
}
.tile-corner {
  position: absolute; width: 120px; height: 120px; pointer-events: none;
  background-image:
    radial-gradient(circle at 0 0, transparent 20px, var(--teal-tint) 21px, var(--teal-tint) 22px, transparent 23px);
  background-size: 40px 40px;
  opacity: 0.6;
}

/* ---------- Utility ---------- */
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 32px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 32px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-success { background: var(--teal-tint); color: var(--teal-dark); }
.badge-warning { background: #FFF3DD; color: #8A6116; }
.badge-danger { background: var(--danger-tint); color: var(--danger); }

.spinner {
  width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite;
}
.spinner-dark { border-color: rgba(14,124,102,0.2); border-top-color: var(--teal); }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: white; padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; transition: all 0.3s; z-index: 1000;
  box-shadow: var(--shadow-lg); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, #f5f2ec 50%, var(--border) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@media (max-width: 640px) {
  .nav-links .nav-link-desktop { display: none; }
  h1.display { font-size: 32px !important; }
}

/* ---------- RTL support (Arabic) ---------- */
body.rtl {
  font-family: 'Inter', 'Noto Kufi Arabic', -apple-system, sans-serif;
}
body.rtl h1, body.rtl h2, body.rtl h3, body.rtl .display {
  font-family: 'Noto Kufi Arabic', 'Fraunces', Georgia, serif;
}
[dir="rtl"] .search-bar,
[dir="rtl"] .teacher-card,
[dir="rtl"] .identity-card,
[dir="rtl"] .review-head,
[dir="rtl"] .subject-row,
[dir="rtl"] .price-row {
  flex-direction: row-reverse;
}
[dir="rtl"] .teacher-price { text-align: left; }
[dir="rtl"] .back-link { flex-direction: row-reverse; }

/* ---------- Language switcher ---------- */
.lang-switch {
  display: flex; align-items: center; gap: 2px;
  background: var(--sand); border: 1px solid var(--border); border-radius: 999px; padding: 3px;
}
.lang-btn {
  padding: 6px 14px; border-radius: 999px; border: none; background: transparent;
  font-size: 13px; font-weight: 700; color: var(--muted); transition: all 0.15s;
}
.lang-btn.active { background: var(--teal); color: white; }
