/* ============================================================
   Dr. EL ALAOUI Adil — Centre Nejma Tanger
   Design system Oxatec adapté médical
   ============================================================ */

:root {
  --navy-900: #0f2247;
  --navy-800: #1e3a6f;
  --navy-700: #2c4d8a;
  --blue-500: #6ba3d0;
  --blue-400: #8fb8dc;
  --blue-100: #e8f0f8;
  --blue-50: #f4f8fc;
  --ink-900: #1a1f2e;
  --ink-700: #3f4757;
  --ink-500: #6b7280;
  --ink-400: #9ca3af;
  --ink-200: #e5e7eb;
  --ink-100: #f3f4f6;
  --paper: #ffffff;
  --paper-alt: #fafbfc;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15,34,71,0.05);
  --shadow: 0 2px 8px rgba(15,34,71,0.08);
  --shadow-md: 0 8px 24px rgba(15,34,71,0.08);
  --shadow-lg: 0 20px 40px rgba(15,34,71,0.12);

  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-ar: 'Noto Naskh Arabic', system-ui, sans-serif;

  /* HEADER HEIGHT (utilisée pour scroll-padding + éventuel sticky) */
  --header-h: 72px;

  --container: 1200px;
  --wa-green: #25D366;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 8px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-700);
  background: var(--paper);
  overflow-x: hidden;
}

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

img, video, iframe { max-width: 100%; height: auto; display: block; }

a { color: var(--navy-800); text-decoration: none; }
a:hover { color: var(--blue-500); }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--navy-900);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 4.5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); margin-bottom: 1rem; }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: 0.75rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.5rem; }

[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 { font-family: var(--font-ar); }

p { margin-bottom: 1rem; }
p.lead { font-size: 1.15rem; color: var(--ink-700); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-500);
  margin-bottom: 0.75rem;
}

/* ============================================================
   HEADER — position: sticky avec hauteur variable maîtrisée
   Le fix majeur : la nav mobile bascule en position "flex-column"
   et le CSS calcule dynamiquement --header-h via un padding sur main
   ============================================================ */

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--ink-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  min-width: 0;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.brand-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy-900);
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-text small {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--ink-500);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}
.nav-menu > li > a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-700);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav-menu > li > a:hover,
.nav-menu > li > a.active {
  color: var(--navy-800);
  background: var(--blue-50);
}

.nav-cta {
  background: var(--navy-800);
  color: #fff !important;
  padding: 0.6rem 1rem !important;
  border-radius: var(--radius) !important;
  font-weight: 600 !important;
}
.nav-cta:hover { background: var(--navy-900); }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.lang-switch button {
  padding: 0.4rem 0.65rem;
  background: transparent;
  border: none;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-500);
  cursor: pointer;
  font-family: inherit;
}
.lang-switch button.active {
  background: var(--navy-800);
  color: #fff;
}

/* Toggle mobile */
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 26px;
  height: 2.5px;
  background: var(--navy-900);
  transition: transform .2s;
  border-radius: 2px;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ============================================================
   ⚠️ RESPONSIVE HEADER — LE FIX
   Sur tablette et mobile, le menu bascule en drawer plein écran
   ce qui garantit qu'il n'y a plus jamais de chevauchement
   avec le contenu ni de wrap qui déborde
   ============================================================ */

@media (max-width: 1024px) {
  :root { --header-h: 64px; }

  .nav-toggle { display: flex; }

  .brand-text { font-size: 1rem; }
  .brand-text small { display: none; }

  /* Menu = drawer full-height sous le header */
  .nav-menu {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--paper);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 1rem 1.25rem 2rem;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform .25s ease-out;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-top: 1px solid var(--ink-200);
  }
  .nav-menu.open { transform: translateX(0); }

  .nav-menu > li {
    border-bottom: 1px solid var(--ink-100);
  }
  .nav-menu > li:last-child { border-bottom: none; }

  .nav-menu > li > a {
    display: block;
    padding: 1rem 0.5rem;
    font-size: 1rem;
    white-space: normal;
  }

  .nav-cta {
    display: block;
    text-align: center;
    margin-top: 1rem;
  }

  .lang-switch {
    margin: 1rem auto;
    display: inline-flex;
  }

  body.nav-open { overflow: hidden; }
}

/* Petit mobile */
@media (max-width: 400px) {
  .brand-logo { width: 36px; height: 36px; }
  .brand-text { font-size: 0.95rem; }
}

/* ============================================================
   HERO — page principale
   ============================================================ */

.hero {
  background: linear-gradient(135deg, var(--blue-50) 0%, var(--paper) 100%);
  padding: clamp(3rem, 8vw, 6rem) 0;
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero h1 { margin-bottom: 1.25rem; }
.hero .lead { margin-bottom: 2rem; color: var(--ink-700); }

.hero-btns {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.hero-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 4/5;
}
.hero-img img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-img { aspect-ratio: 16/10; max-height: 400px; }
}

/* ============================================================
   PAGE HERO (autres pages)
   ============================================================ */

.page-hero {
  background: linear-gradient(180deg, var(--blue-50) 0%, var(--paper) 100%);
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--ink-100);
}

.page-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 0.75rem;
}
.page-hero p {
  font-size: 1.05rem;
  color: var(--ink-500);
  max-width: 680px;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--ink-500);
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--ink-500); }
.breadcrumb a:hover { color: var(--navy-800); }
.breadcrumb span::before { content: "›"; margin-right: 0.5rem; color: var(--ink-400); }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  line-height: 1.2;
}
.btn-lg { padding: 1rem 1.75rem; font-size: 1rem; }
.btn-sm { padding: 0.5rem 0.85rem; font-size: 0.85rem; }
.btn-primary { background: var(--navy-800); color: #fff; border-color: var(--navy-800); }
.btn-primary:hover { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.btn-outline { background: var(--paper); color: var(--navy-800); border-color: var(--ink-200); }
.btn-outline:hover { background: var(--blue-50); border-color: var(--blue-500); color: var(--navy-800); }
.btn-wa { background: var(--wa-green); color: #fff; border-color: var(--wa-green); }
.btn-wa:hover { background: #1eb055; border-color: #1eb055; color: #fff; }
.btn svg { flex-shrink: 0; }

/* ============================================================
   SECTIONS
   ============================================================ */

.section { padding: clamp(3rem, 6vw, 5rem) 0; }
.section-sm { padding: clamp(2rem, 4vw, 3rem) 0; }
.section-alt { background: var(--paper-alt); }

.section-header { text-align: center; max-width: 720px; margin: 0 auto 3rem; }
.section-header p { color: var(--ink-500); }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 1.25rem; }
}
@media (min-width: 600px) and (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--paper);
  border: 1px solid var(--ink-100);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--blue-50);
  color: var(--navy-800);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

/* ============================================================
   LISTS
   ============================================================ */

.list-check { list-style: none; padding: 0; margin: 0; }
.list-check li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.75rem;
  color: var(--ink-700);
}
.list-check li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0.55rem;
  color: var(--blue-500);
  font-weight: 700;
}
[dir="rtl"] .list-check li { padding: 0.5rem 1.75rem 0.5rem 0; }
[dir="rtl"] .list-check li::before { left: auto; right: 0; }

/* ============================================================
   TIMELINE (parcours médecin)
   ============================================================ */

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--blue-100);
}
.timeline li {
  position: relative;
  padding: 0 0 2rem 3rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--navy-800);
  border: 3px solid var(--blue-100);
}
.timeline li small {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue-500);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.timeline li h4 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy-900);
  margin-bottom: 0.25rem;
}
.timeline li p { color: var(--ink-500); font-size: 0.95rem; margin: 0; }

[dir="rtl"] .timeline::before { left: auto; right: 12px; }
[dir="rtl"] .timeline li { padding: 0 3rem 2rem 0; }
[dir="rtl"] .timeline li::before { left: auto; right: 6px; }

/* ============================================================
   SPEC BLOCK (spécialités)
   ============================================================ */

.spec-block {
  padding: clamp(2rem, 4vw, 3rem);
  border-radius: var(--radius-lg);
  background: var(--paper);
  border: 1px solid var(--ink-100);
  margin-bottom: 2rem;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

/* ============================================================
   HOURS TABLE
   ============================================================ */

.hours-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.hours-table td {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--ink-100);
}
.hours-table td:first-child { font-weight: 500; color: var(--ink-700); }
.hours-table td:last-child { text-align: right; color: var(--ink-500); }
.hours-table td.closed { color: #b91c1c; font-weight: 500; }
[dir="rtl"] .hours-table td:last-child { text-align: left; }

/* ============================================================
   CONTACT
   ============================================================ */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 2.5rem;
}
@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
}

.contact-info {
  background: var(--navy-800);
  color: #fff;
  padding: 2rem;
  border-radius: var(--radius-lg);
}
.contact-info h3 { color: #fff; margin-bottom: 0.5rem; }
.contact-info p { color: rgba(255,255,255,0.75); font-size: 0.95rem; margin-bottom: 1.5rem; }

.contact-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 0;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.contact-item-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-400);
}
.contact-item-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  margin-bottom: 2px;
}
.contact-item-value { font-size: 1rem; font-weight: 500; }
.contact-item-value a { color: #fff; }
.contact-item-value a:hover { color: var(--blue-400); }

.form-card {
  background: var(--paper);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--ink-100);
  box-shadow: var(--shadow);
}
.form-card h3 { margin-bottom: 0.25rem; }

.form-group { margin-bottom: 1.1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 0.35rem;
}
.form-group label .req { color: #b91c1c; }

.form-control {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border: 1.5px solid var(--ink-200);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--paper);
  transition: border-color .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--navy-800);
}
textarea.form-control { min-height: 130px; resize: vertical; }

.form-consent {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.85rem;
  color: var(--ink-500);
  margin: 1rem 0 1.5rem;
  line-height: 1.5;
}
.form-consent input {
  margin-top: 3px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: none;
  font-size: 0.9rem;
}
.alert.show { display: block; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #86efac; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }

.map-container {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  aspect-ratio: 16/9;
}
.map-container iframe { width: 100%; height: 100%; border: 0; }

/* ============================================================
   FAQ
   ============================================================ */

.faq-item {
  border-bottom: 1px solid var(--ink-100);
}
.faq-question {
  width: 100%;
  padding: 1.25rem 2.5rem 1.25rem 0;
  background: transparent;
  border: none;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy-900);
  cursor: pointer;
  font-family: inherit;
  position: relative;
}
[dir="rtl"] .faq-question { text-align: right; padding: 1.25rem 0 1.25rem 2.5rem; }

.faq-question::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--blue-500);
  transition: transform .2s;
}
[dir="rtl"] .faq-question::after { right: auto; left: 0; }
.faq-question.open::after { content: "−"; }

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease-out;
}
.faq-answer > div { padding: 0 0 1.25rem; color: var(--ink-700); }

/* ============================================================
   CTA BAND
   ============================================================ */

.cta-band {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 100%);
  color: #fff;
  padding: clamp(3rem, 6vw, 5rem) 0;
  text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band p {
  color: rgba(255,255,255,0.8);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  background: var(--navy-900);
  color: rgba(255,255,255,0.7);
  padding: 3.5rem 0 1.5rem;
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.3fr;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .footer-grid { grid-template-columns: 1fr; } }

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 1.15rem;
}
.footer-brand img { display: block; }
.footer-about { line-height: 1.6; }

.footer-col h4 {
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  font-weight: 600;
}
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { padding: 0.3rem 0; }
.footer-col a { color: rgba(255,255,255,0.7); font-size: 0.9rem; }
.footer-col a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.5);
}
.footer-bottom a { color: rgba(255,255,255,0.7); }

/* ============================================================
   WHATSAPP FLOAT
   ============================================================ */

.wa-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  background: var(--wa-green);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(37,211,102,0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: transform .2s, box-shadow .2s;
}
.wa-float:hover { transform: scale(1.08); color: #fff; box-shadow: 0 8px 24px rgba(37,211,102,0.5); }
.wa-float svg { width: 30px; height: 30px; }
[dir="rtl"] .wa-float { right: auto; left: 24px; }

/* ============================================================
   UTILITIES
   ============================================================ */

.text-center { text-align: center; }
.mb-2 { margin-bottom: 0.75rem; }
.mb-3 { margin-bottom: 1.25rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1.25rem; }
.mt-4 { margin-top: 2rem; }

/* Print */
@media print {
  .site-header, .site-footer, .wa-float, .nav-toggle, .cta-band { display: none; }
}
