/* ============================================================
   PASSE LA MAIN — Feuille de style globale
   Palette : teal (#2c5f7c), jaune (#f5c518), pêche (#f4c99b)
   ============================================================ */

:root {
  --teal:           #2c5f7c;
  --teal-dark:      #1e4561;
  --teal-light:     #d5e8f0;
  /* Alias utilisé par les styles inline des pages (badges, soulignés de titres). */
  --primaire:       #2c5f7c;
  --jaune:          #f5c518;
  --jaune-pale:     #fdf4a8;
  --peche:          #f4c99b;
  --beige:          #fdfaf4;
  --gris-fond:      #f6f7f9;
  --gris-bord:      #e5e7eb;
  --gris-texte:     #6b7280;
  --noir-doux:      #1f2937;
  --rouge:          #dc2626;
  --vert:           #059669;
  --radius:         8px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:      0 4px 12px rgba(0,0,0,.10);
  --max-width:      1100px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

/* ── Accessibilité ────────────────────────────────────────── */
/* Lien d'évitement : visible uniquement au focus clavier */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 1000;
  background: var(--teal);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
  color: #fff;
}

/* Focus clavier visible sur tous les éléments interactifs */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--jaune);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Respect de la préférence « animations réduites » */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--noir-doux);
  background: var(--beige);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding: 2rem 0;
}

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

a {
  color: var(--teal);
  text-decoration: none;
  transition: color .15s;
}
a:hover { color: var(--teal-dark); text-decoration: underline; }

h1, h2, h3 { color: var(--teal); margin-top: 0; line-height: 1.25; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

/* ── Header ───────────────────────────────────────────────── */
header {
  background: white;
  border-bottom: 3px solid var(--jaune);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: .9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--teal);
  text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo img { height: 44px; width: auto; }

nav#main-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
nav#main-nav a {
  padding: .35rem .15rem;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  color: var(--noir-doux);
  text-decoration: none;
}
nav#main-nav a.active,
nav#main-nav a:hover {
  color: var(--teal);
  border-bottom-color: var(--jaune);
  text-decoration: none;
}
nav#main-nav a.nav-user {
  color: var(--gris-texte);
  font-weight: 400;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  background: var(--teal);
  color: white;
  padding: 1.5rem 0;
  text-align: center;
  font-size: .9rem;
  margin-top: 3rem;
}
footer a { color: white; text-decoration: underline; }
footer a:hover { color: var(--jaune-pale); }

/* ── Boutons ──────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .6rem 1.2rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}
.btn-primary {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: white; text-decoration: none; }

.btn-secondary {
  background: var(--jaune);
  color: var(--noir-doux);
  border-color: var(--jaune);
}
.btn-secondary:hover { background: #e5b817; border-color: #e5b817; text-decoration: none; }

.btn-outline {
  background: transparent;
  color: var(--teal);
  border-color: var(--teal);
}
.btn-outline:hover { background: var(--teal); color: white; text-decoration: none; }

.btn-sm { padding: .35rem .8rem; font-size: .9rem; }
.btn-block { display: block; width: 100%; }

/* ── Formulaires ──────────────────────────────────────────── */
form .field { margin-bottom: 1rem; }
form label {
  display: block;
  font-weight: 500;
  margin-bottom: .35rem;
  color: var(--noir-doux);
}
form input[type=text],
form input[type=email],
form input[type=tel],
form input[type=password],
form textarea,
form select {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--gris-bord);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: white;
  transition: border-color .15s, box-shadow .15s;
}
form input:focus, form textarea:focus, form select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(44,95,124,.15);
}
form textarea { min-height: 110px; resize: vertical; }
form .help { font-size: .85rem; color: var(--gris-texte); margin-top: .25rem; }

/* ── Champ mot de passe avec œil pour afficher/masquer ──────── */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 2.6rem; }
.password-toggle {
  position: absolute;
  right: .55rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: .25rem .35rem;
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--gris-texte);
  border-radius: 4px;
}
.password-toggle:hover { color: var(--teal); background: var(--gris-fond); }
.password-toggle:focus { outline: 2px solid var(--teal); outline-offset: 1px; }

/* ── Cartes / Cadres ──────────────────────────────────────── */
.card {
  background: white;
  border: 1px solid var(--gris-bord);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ── Messages flash ───────────────────────────────────────── */
.msg {
  padding: .85rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  font-weight: 500;
}
.msg-ok  { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.msg-err { background: #fef2f2; color: #7f1d1d; border: 1px solid #fca5a5; }
.msg-info{ background: #eff6ff; color: #1e3a8a; border: 1px solid #93c5fd; }

/* ── Page d'accueil (hero) ────────────────────────────────── */
.hero {
  text-align: center;
  padding: 2.5rem 0 1.5rem;
}
.hero-logo {
  max-width: 180px;
  height: auto;
  margin: 0 auto 1.25rem;
  display: block;
}
.hero-banner {
  width: 100%;
  max-width: 960px;
  height: auto;
  max-height: 380px;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: block;
  margin: 0 auto 1.5rem;
}
.hero h1 {
  font-size: 2.4rem;
  margin: 0 0 .35rem;
}
.hero .tagline {
  font-size: 1.15rem;
  color: var(--gris-texte);
  margin: 0 0 2rem;
}

@media (max-width: 700px) {
  .hero-banner { max-height: 220px; border-radius: 4px; }
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 780px;
  margin: 0 auto;
  align-items: stretch;
}
.home-grid .card {
  display: flex;
  flex-direction: column;
}
.home-grid .card h2 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}
/* Pousse la dernière action (form / bouton) en bas pour aligner les cartes */
.home-grid .card > form,
.home-grid .card > p:last-of-type {
  margin-top: auto;
}

/* ── Page mentions / contenus textuels ───────────────────── */
.prose {
  max-width: 760px;
  margin: 0 auto;
}
.prose section {
  background: white;
  border: 1px solid var(--gris-bord);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.prose h2 {
  font-size: 1.15rem;
  margin-top: 0;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--jaune);
  display: inline-block;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: .5rem 0;
}
.prose th, .prose td {
  padding: .45rem .65rem;
  border-bottom: 1px solid var(--gris-bord);
  text-align: left;
  vertical-align: top;
}
.prose th { width: 32%; color: var(--gris-texte); font-weight: 500; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
  .home-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.7rem; }
  .hero .tagline { font-size: 1rem; }
  .header-inner { flex-wrap: wrap; }
  nav#main-nav { gap: .6rem; font-size: .95rem; }

  /* Tableaux d'administration : défilement horizontal propre */
  .admin-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Grilles de formulaire à 2 colonnes → 1 colonne */
  .grid-2 { grid-template-columns: 1fr !important; }

  /* Barres de recherche / filtres → empilées */
  .search-bar { flex-direction: column; align-items: stretch; }
  .search-bar input,
  .search-bar select,
  .search-bar button,
  .search-bar .btn { width: 100%; min-width: 0 !important; }

  /* Le contenu .prose et .container respire moins large */
  .prose th { width: auto; }
}

/* Très petits écrans : cases du code 2FA */
@media (max-width: 400px) {
  .otp-group { gap: .3rem !important; }
  .otp-box {
    width: 2.4rem !important;
    height: 3rem !important;
    font-size: 1.3rem !important;
  }
}
