/* ================================================================
   base.css — Variables CSS, reset, layout global, typographie
   ================================================================ */

:root {
  --primary:        #9B2743;
  --primary-dark:   #7c1e36;
  --primary-light:  #f5e8eb;

  --bg:             #f2f3f7;
  --surface:        #ffffff;
  --surface-raised: #ffffff;
  --border:         #e0e1e8;
  --border-focus:   #9B2743;

  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-disabled:  #6b7280;

  --radius-sm:  4px;
  --radius:     8px;
  --radius-lg:  14px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.07);
  --shadow:     0 2px 8px rgba(0,0,0,.09);
  --shadow-lg:  0 4px 20px rgba(0,0,0,.12);

  --transition: .15s ease;

  --header-h:   60px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .01em;
}
.logo:hover { text-decoration: none; opacity: .9; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-shortcuts {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 16px;
  margin-right: 16px;
  border-right: 1px solid rgba(255,255,255,.2);
}

.nav-shortcuts:empty {
  display: none;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Raccourcis nav : pill sans bordure (override min-height de .btn pour rester
   sur le header 60px tout en gardant ≥ 44px de cible tactile via padding) */
.nav-shortcuts .btn-ghost {
  border-color: transparent;
  color: rgba(255,255,255,.92);
  font-size: .82rem;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 22px;
}
.nav-shortcuts .btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,.12);
  border-color: transparent;
  color: #fff;
}

/* Bouton compte : icône + nom */
.nav-user-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: .82rem;
  font-weight: 500;
  color: rgba(255,255,255,.92);     /* contraste WCAG AA sur primary */
  text-decoration: none;
  min-width: 44px;
  min-height: 44px;
  padding: 5px 10px;
  border-radius: 22px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.nav-user-btn:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
  text-decoration: none;
}

/* Bouton déconnexion : icône seule, cible 44×44 (touch target) */
.nav-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: rgba(255,255,255,.92);     /* avant : .6 = sous-contraste */
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.nav-logout-btn:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
  text-decoration: none;
}

/* ── Main ─────────────────────────────────────────────────── */
.site-main {
  padding: 32px 0 80px;
}

/* ── Burger menu (toggle nav < 640px) ─────────────────────── */
.nav-toggle {
  display: none;                 /* visible uniquement en mobile */
  background: transparent;
  border: 0;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
}
.nav-toggle:hover { background: rgba(255,255,255,.12); }
.nav-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ── Mobile (< 640px) ─────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 0 14px; }

  .nav-toggle { display: inline-flex; }

  /* La nav devient un dropdown sous le header quand le burger est ouvert */
  .site-nav {
    position: absolute;
    top: var(--header-h);
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 14px;
    background: var(--primary);
    box-shadow: 0 6px 12px rgba(0,0,0,.18);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
  }
  .site-nav.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-shortcuts {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding-right: 0;
    margin-right: 0;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.2);
    padding-bottom: 8px;
    margin-bottom: 8px;
  }
  .nav-shortcuts .btn-ghost {
    justify-content: flex-start;
    width: 100%;
    border-radius: var(--radius);
  }

  .nav-auth {
    justify-content: space-between;
  }
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .875rem;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  margin-bottom: 14px;
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden { display: none !important; }
