/* =========================================================
   MAIN.CSS — PISCINE PDC
   Organisation :
   1) Variables
   2) Base
   3) Layout
   4) Header / Footer
   5) Composants (cards, btn, forms, alerts, tables...)
   6) Pages (overrides)
   ========================================================= */


/* ===================== 1) Variables ===================== */
:root{
  /* Couleur principale (identité mairie) */
  --primary-blue:  #29485A;

  /* Couleurs d’état */
  --primary-green: #28a745; /* succès / validé */
  --primary-red:   #dc3545; /* erreur / refus */

  /* Nuances de gris */
  --light-gray: #f8f9fa;
  --dark-gray:  #343a40;

  /* Texte */
  --text:  #212529;
  --muted: #6c757d;

  /* Bordures */
  --border: #dee2e6;
}


/* ===================== 2) Base / Reset ===================== */
html{
  /* Le box-sizing sur html permet un calcul plus simple des tailles */
  box-sizing:border-box;

  /* Police globale */
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;

  /* Base typographique */
  font-size:16px;
}

/* Héritage du box-sizing sur tous les éléments */
*, *::before, *::after{ box-sizing:inherit; }

body{
  /* Reset marge navigateur */
  margin:0;

  /* Couleur texte + fond */
  color:var(--text);
  background:#fff;

  /* Lisibilité */
  line-height:1.5;

  /* Layout : footer en bas */
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

/* Titres */
h1,h2,h3,h4,h5,h6{
  color:var(--primary-blue);
  margin:0 0 .5em;

  /* ✅ Empêche les longs textes (email, nom) de déborder */
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Paragraphes */
p{ margin:0; }

/* Petits textes */
small{ font-size:.875em; }

/* Texte “secondaire” / info */
.muted, .muted *{
  color:var(--muted) !important;
  font-style:italic;
}

/* Utilitaires */
.hidden{ display:none !important; }
.text-center{ text-align:center !important; }


/* ===================== 3) Layout ===================== */
.container{
  /* Largeur max + centrage */
  width:100%;
  max-width:1200px;
  margin:0 auto;

  /* Marges latérales */
  padding:0 1rem;
}

main{
  /* Prend l’espace (footer reste en bas) */
  flex:1;

  /* Respirations verticales */
  padding: 24px 0 56px;
}


/* ===================== 4) Header / Footer ===================== */
header{
  /* Bandeau haut */
  background: var(--primary-blue);
  color:#fff;

  /* ✅ Toujours pleine largeur même dans un body flex */
  width: 100%;
  align-self: stretch;
  flex-shrink: 0;
}

.header-inner{
  /* Alignement logo / actions */
  display:flex;
  justify-content:space-between;
  align-items:center;

  /* Espacement */
  padding:.5rem 0;

  /* Responsive : retour à la ligne possible */
  flex-wrap:wrap;
  gap:12px;
}

.brand{
  /* Lien “logo” */
  font-size:1.25rem;
  font-weight:900;
  text-decoration:none;
  color:#fff;

  /* Alignement du point + texte */
  display:inline-flex;
  align-items:center;
  gap:10px;
}

.brand .dot{
  /* Petit point identitaire */
  width:8px;
  height:8px;
  border-radius:50%;
  background: var(--primary-green);

  /* Ajustement visuel */
  position:relative;
  top:-1px;
}

.top-actions{
  /* Zone boutons/links à droite */
  display:flex;
  align-items:center;
  gap:1rem;
  flex-wrap:wrap;
}

footer{
  /* Footer “institutionnel” */
  background: var(--primary-blue);
  color:#fff;
  text-align:center;
  padding:.6rem 0;
  font-size:.9rem;
}

/* Footer alternatif (clair) si tu l’utilises sur certaines pages */
.site-footer{
  margin-top: 40px;
  padding: 18px 0 30px;
  text-align:center;
  color: rgba(15,23,42,.65);
  border-top: 1px solid rgba(15,23,42,.10);
  background: transparent;
}


/* ===================== 5) Composants ===================== */

/* ----- 5.1 Cards / Sections ----- */
.hero{
  /* Marge externe autour de la section */
  margin: 3%;
}

.card, .auth-card{
  /* Bloc type “carte” */
  background:#fff;
  border:1px solid var(--border);
  border-radius: 10px;
  padding:1.5rem;

  /* Ombre légère */
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

/* Nettoyage marges titres dans les cards */
.card h1, .card h2,
.auth-card h1, .auth-card h2{
  margin-top:0;
}

/* Espacement entre cards successives */
.card + .card{ margin-top:1rem; }


/* ----- 5.2 Buttons (✅ boutons un peu plus grands) ----- */
.btn{
  /* Bouton/lien */
  display:inline-block;

  /* ✅ Taille un peu plus grande */
  font-size:1.05rem;         /* avant: 1rem */
  font-weight:800;
  line-height:1.25;

  /* ✅ Plus de padding (bouton plus “gros”) */
  padding:.78rem 1.35rem;    /* avant: .65rem 1.1rem */

  /* Style */
  border:1px solid transparent;
  border-radius: 999px;
  text-align:center;
  text-decoration:none;
  cursor:pointer;

  /* Animations */
  transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;

  /* Couleurs */
  color:#fff;
  background: var(--primary-blue);
}

.btn:hover{
  /* Petit lift + ombre */
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(0,0,0,.12);

  /* Couleur hover */
  background-color: #1f3646;
}

.btn:active{
  /* Repose au clic */
  transform: translateY(0);
}

.btn:focus{
  /* Accessibilité focus */
  outline:none;
  box-shadow: 0 0 0 .22rem rgba(41,72,90,.25);
}

/* Bouton secondaire (outline) */
.btn-secondary{
  background:#fff;
  color: var(--primary-blue);
  border:1px solid var(--primary-blue);
}

.btn-secondary:hover{
  background:#e9ecef;
  color: var(--primary-blue);
}

/* Bouton petit (on garde plus compact) */
.btn-small{
  font-size:.875rem;
  padding:.35rem .6rem;
}

/* Bouton danger */
.btn-danger{
  background: var(--primary-red);
  border-color: var(--primary-red);
}

.btn-danger:hover{
  background:#c82333;
}


/* ----- 5.3 Forms ----- */
.form-grid{
  /* Grille de champs */
  display:grid;
  gap:1rem;
}

.field{
  /* Bloc champ */
  display:block;
  margin-bottom:1rem;
}

.field label{
  display:block;
  margin-bottom:.2rem;
  color:var(--text);
  font-weight:700;
}

input, select, textarea{
  /* Inputs cohérents */
  font: inherit;
  padding:.65rem .75rem;
  border:1px solid #ced4da;
  border-radius:10px;
  width:100%;
  background:#fff;
  color:var(--text);
}

input:focus, select:focus, textarea:focus{
  outline:none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 .2rem rgba(41,72,90,.20);
}

textarea{
  resize:vertical;
}

/* =========================================================
   Textareas plus compactes + responsive
   ========================================================= */

/* ✅ Par défaut : plus petit */
textarea{
  min-height: 90px;      /* plus compact */
}

/* ✅ Sur grand écran : un peu plus grand (confort) */
@media (min-width: 900px){
  textarea{
    min-height: 110px;
  }
}

/* ✅ Optionnel : Adresse encore plus compacte */
#adresse{
  min-height: 80px;
}


/* ✅ Checkbox global : on évite le scale (ça décale souvent) */
input[type="checkbox"]{
  margin: 0 .4em 0 0;
  accent-color: var(--primary-blue);
}

.actions{
  /* Zone de boutons (centrée) */
  display:flex;
  align-items:center;
  justify-content:center;
  gap:.6rem;
  flex-wrap:wrap;

  /* Espacement vertical */
  margin-top:15px;
}

/* Utilitaires de largeur */
.max-180{ max-width:180px; }
.max-260{ max-width:260px; }


/* ----- 5.4 Alerts ----- */
.alert{
  padding:.75rem 1rem;
  border:1px solid #ffeeba;
  background:#fff3cd;
  border-radius:10px;
  color:#856404;
  margin:.5rem 0;
}

.alert div{
  margin:.25rem 0;
}

.alert-success{
  padding:.75rem 1rem;
  border:1px solid #c3e6cb;
  background:#d4edda;
  color:#155724;
  border-radius:10px;
  margin:.5rem 0;
}

.alert-success a{
  color:#155724;
  text-decoration:underline;
}


/* ----- 5.5 Tables ----- */
.table-wrap{
  overflow-x:auto;
}

.table{
  width:100%;
  border-collapse: collapse;
}

.table th, .table td{
  padding:.5rem;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:middle;

  /* ✅ Empêche les emails/longues valeurs de casser le layout */
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 300px;
}

.table thead th{
  background:#f1f1f1;
  font-weight:800;
}


/* ----- 5.6 Badges ----- */
.badge{
  display:inline-block;
  padding:.25em .5em;
  font-size:.875em;
  font-weight:800;
  border-radius:999px;
  white-space: nowrap;
}

.badge.ok  { background: var(--primary-green); color:#fff; }
.badge.ko  { background: var(--primary-red);   color:#fff; }
.badge.wait{ background: #007bff;              color:#fff; }


/* ===================== 6) Pages (overrides) ===================== */

/* ----- 6.1 HOME (index.html) ----- */
.page-home main.container{
  /* Centre le contenu principal */
  display:grid;
  place-items:center;
}

.page-home .hero{
  /* Card centrale */
  width: min(860px, 92vw);
  text-align:center;

  /* Padding respirant */
  padding: 5%;

  /* Style premium */
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 18px 50px rgba(2,6,23,.14);

  /* Animation d’entrée */
  animation: homePop .55s ease-out both;
}

/* Animation d’apparition */
@keyframes homePop{
  from{ opacity:0; transform: translateY(12px) scale(.985); }
  to  { opacity:1; transform: translateY(0) scale(1); }
}

.page-home .hero h1{
  font-size: clamp(24px, 5vw, 38px);
  line-height:1.12;
}

.page-home .hero p{
  font-size:16px;
  color: rgba(15,23,42,.75);
}

/* Image centrée + hover */
.page-home .hero-media{
  margin: 12px 0 4px;
  display:flex;
  justify-content:center;
  align-items:center;
}

.page-home .hero-media img{
  width: min(240px, 60vw);
  height:auto;
  display:block;
  border-radius: 0;
  box-shadow: none;

  /* Animation douce */
  transition: transform .20s ease, filter .25s ease, box-shadow .25s ease;
  will-change: transform;
}

.page-home .hero-media img:hover{
  /* Léger lift au hover */
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 14px 30px rgba(0,0,0,.18);
  filter: saturate(1.05) contrast(1.05);
}

/* Désactive le hover sur mobile (évite effets bizarres) */
@media (hover: none){
  .page-home .hero-media img:hover{
    transform: none;
    box-shadow: none;
    filter: none;
  }
}

/* Boutons : shine + soulignage */
.page-home .btn{
  position:relative;
  overflow:hidden;
}

.page-home .btn::after{
  content:"";
  position:absolute;
  inset:0;
  transform: translateX(-120%) skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transition: transform .55s ease;
}

.page-home .btn:hover::after{
  transform: translateX(120%) skewX(-20deg);
}

.page-home .btn:hover{
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 3px;
}



/* =========================================================
   CROP (user.js) — Styles indispensables pour le recadrage
   - Le JS calcule des coordonnées => il faut des dimensions stables
   ========================================================= */

/* (Optionnel) Motif Hors PDC : caché par défaut, le JS le montre */
#wrap_motif{
  display: none;
}

/* ---------- Modale (fond + centrage) ---------- */
.crop-modal{
  position: fixed;
  inset: 0;
  z-index: 1000;

  /* Le JS ouvre/ferme */
  display: none;

  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,.70);
  padding: 14px;
}

/* ✅ Ta logique JS : modal.classList.add('open') + aria-hidden=false */
.crop-modal.open{
  display: flex;
}

/* (Bonus sécurité) si tu préfères aussi via aria-hidden */
.crop-modal[aria-hidden="false"]{
  display: flex;
}

/* ---------- Boîte modale ---------- */
.crop-dialog{
  background: #fff;
  color: var(--text);

  width: min(980px, 96vw);
  border-radius: 12px;
  padding: 14px;

  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

/* Header modale */
.crop-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

/* ---------- Zone “stage” (CRUCIAL pour le JS) ---------- */
#stage{
  position: relative;          /* ✅ OBLIGATOIRE (cadre absolute dedans) */
  width: 100%;
  height: clamp(320px, 62vh, 560px);  /* ✅ OBLIGATOIRE (sinon 0px => JS faux) */

  overflow: hidden;            /* ✅ OBLIGATOIRE (cache ce qui dépasse) */
  border-radius: 12px;
  background: #111;

  border: 1px solid rgba(0,0,0,.15);
  user-select: none;
  touch-action: none;          /* ✅ pour le drag tactile */
}

/* L’image preview centrée dans le stage */
#imgPreview{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* ---------- Cadre de sélection (fixSel) ---------- */
#fixedSel{
  position: absolute;          /* ✅ OBLIGATOIRE */
  border: 2px solid var(--primary-blue);
  border-radius: 8px;

  /* Overlay sombre autour (pratique visuellement) */
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
  cursor: move;
}

/* Poignées de resize */
#fixedSel .handle{
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--primary-blue);
  border: 2px solid #fff;
  border-radius: 4px;
}

#fixedSel .handle.nw{ top: -7px; left: -7px; cursor: nwse-resize; }
#fixedSel .handle.ne{ top: -7px; right: -7px; cursor: nesw-resize; }
#fixedSel .handle.se{ bottom: -7px; right: -7px; cursor: nwse-resize; }
#fixedSel .handle.sw{ bottom: -7px; left: -7px; cursor: nesw-resize; }


/* =========================================================
   Checkbox texte -> case à droite (collée sur la même ligne)
   ========================================================= */

.checkline{
  display: inline-flex;     /* texte + checkbox en ligne */
  align-items: center;      /* bien aligné verticalement */
  gap: 8px;                 /* petit espace entre texte et case */
  cursor: pointer;
  user-select: none;
}

/* ✅ Variante : checkbox à droite, collée */
.checkline-right{
  justify-content: flex-start;
}

/* Checkbox propre */
.checkline input[type="checkbox"]{
  width: 18px;
  height: 18px;
  margin: 0;               /* enlève les marges par défaut */
  transform: none;         /* annule le scale si tu l’avais */
  accent-color: var(--primary-blue);
}

/* ✅ Alignement parfait : évite que la case soit plus haute/basse que le texte */
.checkline{
  line-height: 1.2;            /* stabilise la hauteur de ligne */
}

/* ✅ Micro-ajustement visuel (change 1px si nécessaire) */
.checkline input[type="checkbox"]{
  vertical-align: middle;      /* aide certains navigateurs */
  flex: 0 0 auto;              /* empêche la case de se déformer */
  transform: translateY(1px);  /* 🔧 ajuste l’alignement (0px, 1px, 2px...) */
}


/* =========================================================
   CARTE (carte.php) — Mise en page carte d’accès + impression
   ========================================================= */

/* Conteneur global */
.carte-wrap{
  width: min(980px, 94vw);
  margin: 24px auto;
  padding: 16px;
}

/* Carte principale */
.carte-card{
  display: grid;
  grid-template-columns: 175px 1fr 220px; /* photo | infos | QR */
  gap: 18px;

  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;

  box-shadow: 0 14px 35px rgba(0,0,0,.10);
}

/* Photo (ratio 7:9 => 350x450) */
.carte-photo{
  width: 175px;
  height: calc(175px * 9 / 7);
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  border: 1px solid rgba(0,0,0,.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.carte-photo img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Zone infos */
.carte-meta h1{
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.25;
  color: var(--primary-blue);
}

.carte-row{
  margin-top: 10px;
  font-size: 14.5px;
}

.carte-muted{
  color: var(--muted);
}

/* Badge VALIDÉE */
.carte-badge{
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  background: rgba(40,167,69,.12);
  border: 1px solid rgba(40,167,69,.35);
  color: #1f7a35;
}

/* Petit “sceau” mairie */
.carte-seal{
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 10px;

  padding: 8px 10px;
  border-radius: 10px;
  background: #f6f7f9;
  border: 1px dashed rgba(0,0,0,.18);
}

.carte-seal-dot{
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-green);
}

/* Zone QR */
.carte-qr{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  background: #f8fafc;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 12px;
  padding: 12px;

  text-align: center;
}

.carte-qr small{
  margin-top: 8px;
  color: var(--muted);
}

/* Bouton imprimer */
.carte-actions{
  margin-top: 14px;
}

.carte-btn-print{
  /* on garde ton style .btn, juste un petit plus */
  width: 100%;
}

/* Talon (stub) */
.carte-stub{
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(0,0,0,.25);
  font-size: 13.5px;
  color: var(--dark-gray);
}

/* ===================== Responsive ===================== */
@media (max-width: 860px){
  .carte-card{
    grid-template-columns: 1fr; /* tout en colonne */
  }

  .carte-photo{
    width: 140px;
    height: calc(140px * 9 / 7);
    margin: 0 auto;
  }

  .carte-qr{
    width: 100%;
  }
}

/* ===================== Impression ===================== */
@media print{
  body{
    background: #fff !important;
  }

  .carte-wrap{
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .carte-card{
    box-shadow: none;
    border: 1px solid #000;
    border-radius: 0;
    grid-template-columns: 1fr 175px; /* infos | photo */
    grid-template-rows: auto auto;
    gap: 12px;
  }

  /* infos à gauche sur 2 lignes */
  .carte-meta{
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  /* photo à droite en haut */
  .carte-photo{
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    border: 1px solid #000;
  }

  /* QR à droite en bas */
  .carte-qr{
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    background: none;
    border: 1px solid #000;
  }

  /* cacher le bouton imprimer */
  .carte-actions{
    display: none !important;
  }

  /* talon ok en print */
  .carte-stub{
    border-top: 1px dashed #000;
  }
}

/* =========================================================
   VERIFY (verify.php) — Page de contrôle (QR)
   ========================================================= */

/* Page centrée */
.verify-wrap{
  min-height: calc(100vh - 64px); /* laisse respirer si header existe ailleurs */
  display: grid;
  place-items: center;
  padding: 16px;
}

/* Carte principale */
.verify-card{
  width: min(920px, 94vw);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(0,0,0,.12);
  overflow: hidden; /* évite que les coins dépassent */
}

/* Bandeau statut (haut) */
.verify-status{
  padding: 18px 14px;
  text-align: center;
  color: #fff; /* texte blanc sur bandeau coloré */
}

.verify-status h1{
  margin: 0;
  font-size: clamp(22px, 4.8vw, 34px);
  font-weight: 900;
  letter-spacing: .4px;
}

/* Grille photo + infos */
.verify-grid{
  display: grid;
  gap: 14px;
  padding: 16px;
  grid-template-columns: 1fr;
}

/* Photo */
.verify-photo{
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  border: 1px solid rgba(0,0,0,.12);

  /* ratio proche de ta photo (7:9) */
  aspect-ratio: 7 / 9;
}

.verify-photo img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Infos */
.verify-info{
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 10px;
  font-size: 15px;
  color: var(--text);
}

/* petits labels */
.verify-info strong{
  color: var(--primary-blue);
}

/* Barre bas (retour) */
.verify-backbar{
  display: flex;
  justify-content: flex-end;
  padding: 14px 16px;
  border-top: 1px solid rgba(0,0,0,.08);
  background: #fff;
}

/* bouton retour */
.verify-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: .70rem 1.1rem;
  border-radius: 999px;

  text-decoration: none;
  font-weight: 900;

  border: 1px solid rgba(0,0,0,.12);
  background: #f1f5f9;
  color: var(--primary-blue);

  transition: transform .12s ease, box-shadow .2s ease, background-color .2s ease;
}

.verify-btn:hover{
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(0,0,0,.10);
  background: #e9ecef;
}

.verify-btn:active{
  transform: translateY(0);
}

/* ===================== Responsive desktop ===================== */
@media (min-width: 780px){
  .verify-grid{
    grid-template-columns: 260px 1fr;
    align-items: start;
  }

  .verify-photo{
    margin: 0;         /* plus centré, aligné à gauche */
    max-width: 260px;
  }

  .verify-info{
    font-size: 16px;
    padding: 16px;
  }
}

/* ===================== Couleurs par statut ===================== */
/* ✅ body a déjà class="verify-valid" etc dans ton PHP */

.verify-valid   .verify-status{ background: #16a34a; } /* vert */
.verify-refuse  .verify-status{ background: #dc2626; } /* rouge */
.verify-wait    .verify-status{ background: #2563eb; } /* bleu */
.verify-unknown .verify-status{ background: #6b7280; } /* gris */

/* (Optionnel) petite bordure colorée sur la carte */
.verify-valid   .verify-card{ border-top: 6px solid #16a34a; }
.verify-refuse  .verify-card{ border-top: 6px solid #dc2626; }
.verify-wait    .verify-card{ border-top: 6px solid #2563eb; }
.verify-unknown .verify-card{ border-top: 6px solid #6b7280; }


/* =========================================================
   ✅ RESPONSIVE USER PAGE
   - Header top bar propre sur mobile
   - Mes demandes : tableau -> cartes sur mobile
   ========================================================= */

/* ===== 1) Header responsive (barre du haut) ===== */
.page-user header .header-inner{
  gap: 10px;
}

.page-user .brand{
  flex: 1 1 auto;
  min-width: 180px;
}

.page-user .top-actions{
  flex: 0 0 auto;
  display:flex;
  align-items:center;
  gap:10px;
}

/* Sur mobile : on empile proprement */
@media (max-width: 560px){
  .page-user header .header-inner{
    flex-direction: column;
    align-items: stretch;
  }

  .page-user .brand{
    justify-content: center;
  }

  .page-user .top-actions{
    width: 100%;
    justify-content: center;
  }

  .page-user .top-actions .btn{
    width: 100%;
    max-width: 320px;
  }
}

/* ===== 2) Mes demandes : tableau lisible sur mobile ===== */
/* Desktop = table normale (ton style actuel) */

/* Mobile : on transforme chaque ligne du tableau en "card" */
@media (max-width: 900px){

  .page-user .table{
    border-collapse: separate;
    border-spacing: 0 12px; /* espace entre les “cartes” */
  }

  .page-user .table thead{
    display:none; /* cache le header table (inutile sur mobile) */
  }

  .page-user .table tr{
    display:block;
    background:#fff;
    border:1px solid var(--border);
    border-radius:12px;
    padding:12px;
    box-shadow: 0 10px 25px rgba(0,0,0,.06);
  }

  .page-user .table td{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;

    padding:8px 0;
    border-bottom:1px dashed rgba(0,0,0,.10);
  }

  .page-user .table td:last-child{
    border-bottom:none;
    padding-bottom:0;
  }

  /* Le label vient de data-label */
  .page-user .table td::before{
    content: attr(data-label);
    font-weight: 900;
    color: var(--primary-blue);
    flex: 0 0 42%;
  }

  /* Valeur à droite */
  .page-user .table td{
    flex-wrap: wrap;
  }

  .page-user .table td > *{
    flex: 1 1 auto;
  }

  /* Bouton action (voir carte) : full width propre */
  .page-user .table td[data-label="Actions"] a.btn{
    width: 100%;
    max-width: 280px;
  }
}

/* Encore plus petit : labels au-dessus */
@media (max-width: 420px){
  .page-user .table td{
    flex-direction: column;
    align-items:flex-start;
  }

  .page-user .table td::before{
    flex: 0 0 auto;
  }

  .page-user .table td[data-label="Actions"] a.btn{
    max-width: 100%;
  }
}


/* =========================================================
   ✅ RESPONSIVE GLOBAL — Toutes pages
   ========================================================= */

/* ----- Inputs : font-size 16px (évite le zoom iOS) ----- */
input, select, textarea{
  font-size: 16px;
}

/* ----- Boutons : hauteur tactile min 44px ----- */
.btn, button{
  min-height: 44px;
}

/* ----- Header responsive ----- */
@media (max-width: 480px){
  .header-inner{
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 8px;
  }

  .brand{
    justify-content: center;
  }

  .top-actions{
    justify-content: center;
  }
}

/* ----- Footer responsive ----- */
@media (max-width: 480px){
  footer, .site-footer{
    font-size: .8rem;
    padding: .5rem .8rem;
  }
}

/* ----- Container padding mobile ----- */
@media (max-width: 480px){
  .container{
    padding: 0 .6rem;
  }

  .hero{
    margin: 2% 0;
  }

  .form-grid{
    gap: .75rem;
  }
}


/* =========================================================
   ✅ AUTH PAGES (connexion.php / inscription.php)
   ========================================================= */
.hero.auth-card{
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 480px){
  .hero.auth-card{
    padding: 1.2rem 1rem;
    margin: 1rem 0;
    border-radius: 10px;
  }

  .hero.auth-card h1{
    font-size: 1.3rem;
  }

  .hero.auth-card .actions{
    flex-direction: column;
  }

  .hero.auth-card .actions .btn{
    width: 100%;
  }
}


/* =========================================================
   ✅ RESPONSIVE CONTROLEUR / MAIRE — Tables → Cartes mobile
   ========================================================= */
@media (max-width: 900px){
  .table{
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .table thead{
    display: none;
  }

  .table tr{
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,.06);
  }

  .table td{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(0,0,0,.08);
  }

  .table td:last-child{
    border-bottom: none;
    padding-bottom: 0;
  }

  .table td::before{
    content: attr(data-label);
    font-weight: 900;
    color: var(--primary-blue);
    flex: 0 0 40%;
    font-size: .85rem;
  }
}

/* Sur très petit écran : labels au-dessus */
@media (max-width: 480px){
  .table td{
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .table td::before{
    flex: 0 0 auto;
    font-size: .8rem;
  }

  /* Formulaires d'action dans les cellules */
  .table td form{
    width: 100%;
  }

  .table td form .btn{
    width: 100%;
  }
}


/* =========================================================
   ✅ RESPONSIVE STATS (stats.php)
   ========================================================= */

/* Filtres empilés sur mobile */
@media (max-width: 560px){
  .filters{
    flex-direction: column;
    align-items: stretch;
  }

  .filters > div{
    width: 100%;
  }

  .filters input[type="date"]{
    width: 100%;
  }

  .quick-range{
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  /* Stats grid en colonne */
  .stats-grid{
    grid-template-columns: 1fr !important;
  }

  /* Canvas responsive */
  canvas{
    max-width: 100%;
    height: auto !important;
  }
}


/* =========================================================
   ✅ RESPONSIVE AGENT (agent.php)
   ========================================================= */
@media (max-width: 480px){
  .mode-tabs{
    flex-direction: column;
  }

  .mode-tab{
    font-size: .9rem;
    padding: .7rem .8rem;
    text-align: center;
  }

  .scan-icon{
    font-size: 3.5rem;
  }

  .scan-label{
    font-size: 1.1rem;
  }
}


/* =========================================================
   ✅ RESPONSIVE VERIFY (verify.php) — vérification 375px
   ========================================================= */
@media (max-width: 560px){
  .verify-grid{
    grid-template-columns: 1fr;
    text-align: center;
  }

  .verify-photo{
    max-width: 160px;
    margin: 0 auto;
  }

  .verify-backbar{
    flex-direction: column;
    align-items: center;
    gap: .6rem;
  }
}


/* =========================================================
   ✅ CLASSES MANQUANTES — agent.php, stats.php
   ========================================================= */

/* Ligne inline input + bouton (agent.php Mode Recherche) */
.row-inline{
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

@media (max-width: 480px){
  .row-inline{
    flex-direction: column;
    align-items: stretch;
  }

  .row-inline input,
  .row-inline button{
    width: 100%;
    max-width: 100%;
  }

  /* Overrides des contraintes fixes sur mobile */
  .max-180,
  .max-260{
    max-width: 100%;
  }
}

/* Carte du panneau recherche (agent.php) */
.scan-card{
  max-width: 640px;
  margin: 0 auto;
}

/* Zone résultats de recherche (select + message vide) */
.result-wrap{
  margin-top: .6rem;
  position: relative;
}

.result-wrap select{
  width: 100%;
  min-height: 120px;
  font-size: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: .4rem;
}

.result-wrap #findEmpty{
  display: none;
  padding: .5rem 0;
  font-style: italic;
}

/* Texte d'aide sous les champs */
.hint{
  display: block;
  font-size: .85rem;
  color: var(--muted);
  margin-top: .35rem;
}

/* Raccourcis de période (stats.php) */
.quick-range{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
}

.quick-btn{
  display: inline-block;
  padding: .35rem .8rem;
  border-radius: 8px;
  background: var(--primary-blue);
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
  min-height: 36px;
  line-height: 1.6;
}

.quick-btn:hover{
  background: #1f3646;
}


/* =========================================================
   ✅ INPUT ACTION — inputs dans les tableaux (controleur/maire)
   ========================================================= */
.input-action{
  font: inherit;
  font-size: 16px;
  padding: .5rem .75rem;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.15);
  background: #fff;
  color: var(--text);
  width: 100%;
  max-width: 200px;
}

/* In flex form rows (refus/action inputs next to a button) */
.table td form div .input-action {
  flex: 1;
  min-width: 0;
  width: auto;
  max-width: none;
}
.table td form div .btn,
.table td form div button {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 900px){
  .input-action{
    max-width: 100%;
  }
}


/* =========================================================
   ✅ TABLE-WRAP — overflow horizontal sécurisé
   ========================================================= */
.table-wrap{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}


/* =========================================================
   ✅ IMAGES — max-width global
   ========================================================= */
img{
  max-width: 100%;
  height: auto;
}

/* Exceptions : QR code et photo carte gardent leurs dims */
.carte-photo img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* =========================================================
   ✅ CARTE.PHP — responsive grille carte
   ========================================================= */
@media (max-width: 600px){
  .carte-card{
    grid-template-columns: 1fr;
  }

  .carte-photo{
    width: 120px;
    height: calc(120px * 9 / 7);
    margin: 0 auto;
  }

  .carte-qr img{
    width: min(160px, 60vw);
  }

  .carte-wrap{
    padding: 8px;
    margin: 12px auto;
  }
}


/* =========================================================
   ✅ STATS.PHP — canvas responsive
   ========================================================= */
#chartScans{
  width: 100% !important;
  height: auto !important;
  max-height: 300px;
}


/* =========================================================
   ✅ SCAN.PHP — icône mobile
   ========================================================= */
@media (max-width: 480px){
  .scan-icon{
    font-size: 3.5rem;
  }

  .scan-label{
    font-size: 1.1rem;
  }

  .scan-sub{
    font-size: .85rem;
  }
}
