/* =====================================================================
   Vigie — styles personnalisés
   Surcharge Bootstrap 5 avec l'identité visuelle de la commune.

   Les noms de variables (--mairie-*) sont ceux de la plateforme de
   réservation : le balisage recyclé (toasts, empty states, timeline)
   fonctionne sans retouche.
   ===================================================================== */

:root {
  /* Palette officielle de la commune d'Ancy-Dornot (deux couleurs) */
  --mairie-primary:   #312783;   /* bleu foncé officiel (institutionnel) */
  --mairie-primary-2: #63b9e9;   /* bleu clair officiel (mise en lumière) */
  --mairie-accent:    #63b9e9;
  --mairie-accent-2:  #82c8ed;
  --mairie-bg:        #f8f9fb;
  --mairie-surface:   #ffffff;
  --mairie-text:      #1a202c;
  --mairie-muted:     #6c757d;

  /* États d'un bien */
  --etat-neuf:         #0d9488;
  --etat-bon:          #16a34a;
  --etat-correct:      #65a30d;
  --etat-surveiller:   #f59e0b;
  --etat-hors_service: #dc2626;
  --etat-reforme:      #6b7280;

  /* Échéances */
  --ech-ok:      #16a34a;
  --ech-proche:  #f59e0b;
  --ech-retard:  #dc2626;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow:    0 1px 3px 0 rgba(0,0,0,0.08), 0 1px 2px -1px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
}

/* ----- Base ----- */
html, body { height: 100%; }
body {
  background-color: var(--mairie-bg);
  color: var(--mairie-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
main.main-container {
  flex: 1 0 auto;
  padding-top: 80px;
  padding-bottom: 3rem;
}

/* ----- Navbar ----- */
.navbar-mairie { background-color: var(--mairie-primary); box-shadow: var(--shadow-md); }
.navbar-mairie .navbar-brand { font-weight: 700; letter-spacing: 0.5px; color: #fff; }
/* v1.6.0 : la barre de la réservation, des démarches et de Cap — logo blanc
   de la commune, trait fin, petit logo de l'appli (jumelles, v1.7.0), titre
   sur deux lignes. Sans logo de la commune : les jumelles et le titre seuls. */
.navbar-mairie .navbar-brand .brand-logo-horizontal { height: 34px; width: auto; }
.navbar-mairie .navbar-brand .brand-titre { flex-direction: column; line-height: 1.2; letter-spacing: 0; }
.navbar-mairie .navbar-brand .brand-titre-1 { font-size: 0.98rem; font-weight: 700; }
.navbar-mairie .navbar-brand .brand-titre-2 { font-size: 0.8rem; font-weight: 400; color: #b8c8ee; }
.navbar-mairie .navbar-brand .brand-appli {
  display: flex; align-items: center; gap: 0.6rem;
  margin-left: 0.9rem; padding-left: 0.9rem;
  border-left: 1px solid rgba(255,255,255,0.45);
}
.navbar-mairie .navbar-brand .brand-appli-seul { margin-left: 0; padding-left: 0; border-left: 0; }
.navbar-mairie .navbar-brand .brand-picto { width: 30px; height: 30px; flex-shrink: 0; }
@media (max-width: 380px) {
  .navbar-mairie .navbar-brand .brand-logo-horizontal { height: 28px; }
  .navbar-mairie .navbar-brand .brand-appli { margin-left: 0.6rem; padding-left: 0.6rem; }
  .navbar-mairie .navbar-brand .brand-appli-seul { margin-left: 0; padding-left: 0; }
  .navbar-mairie .navbar-brand .brand-picto { width: 26px; height: 26px; }
}
.navbar-mairie .nav-link { color: rgba(255,255,255,0.85) !important; font-weight: 500; position: relative; }
.navbar-mairie .nav-link:hover,
.navbar-mairie .nav-link.active { color: #fff !important; }
.navbar-mairie .nav-link.active::after {
  content: ''; position: absolute; bottom: -2px; left: 0.5rem; right: 0.5rem;
  height: 2px; background: var(--mairie-accent); border-radius: 2px;
}
.navbar-mairie .dropdown-menu { border: none; box-shadow: var(--shadow-lg); border-radius: 0.5rem; }
.navbar-role-badge {
  display: inline-block; font-size: 0.7rem; padding: 0.18rem 0.5rem;
  border-radius: 999px; background: var(--mairie-accent); color: var(--mairie-primary);
  font-weight: 600; letter-spacing: 0.3px; margin-left: 0.4rem;
}
.nav-taches-badge {
  display: inline-block; background: #dc2626; color: #fff;
  font-weight: 700; font-size: 0.7rem; line-height: 1;
  padding: 3px 6px; border-radius: 999px; margin-left: 0.3rem; vertical-align: middle;
}
.nav-divider { width: 1px; height: 24px; background: rgba(255,255,255,0.2); margin: 0 0.6rem; }

/* ----- Cloche « ce qui m'attend » ----- */
.cloche-badge {
  position: absolute; top: 2px; right: -2px;
  background: #dc2626; color: #fff;
  font-size: 0.62rem; font-weight: 700; line-height: 1;
  padding: 3px 5px; border-radius: 999px;
  box-shadow: 0 0 0 2px var(--mairie-primary);
}
@media (max-width: 1199px) {
  /* Menu déplié : la pastille rejoint le texte au lieu de flotter. */
  .cloche-badge { position: static; margin-left: 0.4rem; box-shadow: none; }
}

/* ----- Cards / sections ----- */
.section-card {
  background: var(--mairie-surface);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.section-card h1, .section-card h2, .section-card h3 { margin-top: 0; }
.section-title { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.25rem; }
.section-title .icon-bubble {
  width: 48px; height: 48px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--mairie-primary), var(--mairie-primary-2));
  color: #fff; font-size: 1.4rem; flex-shrink: 0;
}
.section-subtitle { color: var(--mairie-muted); font-size: 0.95rem; margin-bottom: 1rem; }

/* ----- Boutons ----- */
.btn-mairie { background-color: var(--mairie-primary); border-color: var(--mairie-primary); color: #fff; }
.btn-mairie:hover, .btn-mairie:focus {
  background-color: var(--mairie-primary-2); border-color: var(--mairie-primary-2); color: #fff;
}
.btn-accent {
  background-color: var(--mairie-accent); border-color: var(--mairie-accent);
  color: var(--mairie-primary); font-weight: 600;
}
.btn-accent:hover, .btn-accent:focus {
  background-color: var(--mairie-accent-2); border-color: var(--mairie-accent-2); color: var(--mairie-primary);
}

/* ----- Tuiles de compteurs (tableau de bord) ----- */
.tuile {
  display: block; background: var(--mairie-surface); border-radius: 0.75rem;
  box-shadow: var(--shadow); padding: 1.1rem 1.25rem; height: 100%;
  text-decoration: none; color: inherit;
  border-left: 4px solid var(--mairie-primary);
  transition: transform .12s ease, box-shadow .12s ease;
}
a.tuile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.tuile-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--mairie-muted); font-weight: 700; display: block; margin-bottom: 0.35rem;
}
.tuile-valeur { font-size: 1.9rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tuile-sub { font-size: 0.78rem; color: var(--mairie-muted); display: block; margin-top: 0.35rem; }
.tuile-danger  { border-left-color: var(--ech-retard); }
.tuile-danger  .tuile-valeur { color: var(--ech-retard); }
.tuile-warning { border-left-color: var(--ech-proche); }
.tuile-warning .tuile-valeur { color: #b45309; }
.tuile-accent  { border-left-color: var(--mairie-primary-2); }

/* ----- Badges d'état d'un bien ----- */
.badge-etat, .badge-statut {
  font-size: 0.72rem; padding: 0.35em 0.7em; border-radius: 999px;
  font-weight: 600; letter-spacing: 0.2px; white-space: nowrap;
}
.etat-neuf         { background: #ccfbf1; color: #115e59; }
.etat-bon          { background: #d1fae5; color: #065f46; }
.etat-correct      { background: #ecfccb; color: #3f6212; }
.etat-a_surveiller { background: #fef3c7; color: #92400e; }
.etat-hors_service { background: #fee2e2; color: #991b1b; }
.etat-reforme      { background: #e5e7eb; color: #374151; }

.statut-en_service    { background: #e0e7ff; color: #3730a3; }
.statut-stocke        { background: #f1f5f9; color: #334155; }
.statut-en_reparation { background: #ffedd5; color: #9a3412; }
.statut-en_pret       { background: #dbeafe; color: #1e40af; }
.statut-reforme       { background: #e5e7eb; color: #374151; }

/* ----- Échéances ----- */
.badge-echeance { font-size: 0.72rem; padding: 0.35em 0.7em; border-radius: 999px; font-weight: 600; }
.ech-ok     { background: #d1fae5; color: #065f46; }
.ech-proche { background: #fef3c7; color: #92400e; }
.ech-retard { background: #fee2e2; color: #991b1b; }

/* ----- Tableau de l'inventaire ----- */
.table-inventaire { font-size: 0.9rem; }
.table-inventaire thead th {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--mairie-muted); border-bottom: 2px solid #e5e7eb; white-space: nowrap;
}
.table-inventaire td { vertical-align: middle; }
.table-inventaire tbody tr:hover { background: #f4f3fb; }
.table-inventaire .ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem; color: var(--mairie-primary); font-weight: 600; white-space: nowrap;
}
.table-inventaire .vignette {
  width: 42px; height: 42px; object-fit: cover; border-radius: 6px; background: #e2e8f0;
}
.table-inventaire .vignette-vide {
  width: 42px; height: 42px; border-radius: 6px; background: #eef0f7;
  display: inline-flex; align-items: center; justify-content: center; color: #b8bed4;
}

/* ----- Barre de filtres ----- */
.filtres {
  background: var(--mairie-surface); border-radius: 0.75rem;
  box-shadow: var(--shadow); padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.filtres .form-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mairie-muted); font-weight: 700; margin-bottom: 0.25rem; }
.filtre-actif {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: #f4f3fb; color: var(--mairie-primary);
  border: 1px solid rgba(49,39,131,.18); border-radius: 999px;
  padding: 0.15rem 0.6rem; font-size: 0.8rem; text-decoration: none;
}
.filtre-actif:hover { background: #e8e6f6; color: var(--mairie-primary); }

/* ----- Fiche d'un bien ----- */
.fiche-entete { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: flex-start; }
.fiche-photo {
  width: 190px; height: 190px; object-fit: cover; border-radius: 0.75rem;
  background: #e2e8f0; flex-shrink: 0;
}
.fiche-photo-vide {
  width: 190px; height: 190px; border-radius: 0.75rem; flex-shrink: 0;
  background: linear-gradient(135deg, var(--mairie-primary), var(--mairie-primary-2));
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.45); font-size: 3rem;
}
.fiche-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.06em; color: var(--mairie-primary-2);
}
.fiche-champs { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.25rem; font-size: 0.92rem; }
.fiche-champs dt {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--mairie-muted); font-weight: 700; padding-top: 0.2rem; white-space: nowrap;
}
.fiche-champs dd { margin: 0; }
.fiche-champs dd.vide { color: #b8bed4; font-style: italic; }

/* ----- Liste de documents ----- */
.doc-ligne {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0; border-bottom: 1px solid #eef0f7;
}
.doc-ligne:last-child { border-bottom: 0; }
.doc-icone {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: #f4f3fb; color: var(--mairie-primary);
  display: inline-flex; align-items: center; justify-content: center;
}
.doc-meta { font-size: 0.78rem; color: var(--mairie-muted); }

/* ----- Timeline historique (reprise de la plateforme) ----- */
.timeline-historique { margin: 0.5rem 0 0; padding-left: 0; list-style: none; }
.timeline-historique li { display: flex; gap: 0.7rem; padding-bottom: 0.85rem; position: relative; }
.timeline-historique li:not(:last-child)::before {
  content: ""; position: absolute; left: 13px; top: 28px; bottom: 0;
  width: 2px; background: #e5e7eb;
}
.timeline-historique .hist-icon {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--mairie-primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.85rem; z-index: 1;
}
.timeline-historique .hist-corps { padding-top: 3px; font-size: 0.9rem; }

/* ----- Toasts (repris) ----- */
.toast-container-fixed { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 1080; }

/* ----- Empty states (repris) ----- */
.empty-state-v2 { text-align: center; padding: 2.5rem 1rem; }
.empty-state-illu {
  width: 78px; height: 78px; border-radius: 50%; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center; font-size: 2.2rem;
}
.empty-state-illu-primary   { background: #ede9fe; color: var(--mairie-primary); }
.empty-state-illu-success   { background: #d1fae5; color: #065f46; }
.empty-state-illu-warning   { background: #fef3c7; color: #92400e; }
.empty-state-illu-danger    { background: #fee2e2; color: #991b1b; }
.empty-state-illu-info      { background: #dbeafe; color: #1e40af; }
.empty-state-illu-secondary { background: #f1f5f9; color: #475569; }
.empty-state-title { font-size: 1.15rem; font-weight: 600; margin-bottom: 0.4rem; }
.empty-state-desc { color: var(--mairie-muted); max-width: 48ch; margin: 0 auto 1.25rem; }
.empty-state-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; }

/* ----- Footer ----- */
footer.footer {
  flex-shrink: 0; background-color: var(--mairie-primary);
  color: rgba(255,255,255,0.8); padding: 1.5rem 0; margin-top: 3rem;
  text-align: center; font-size: 0.9rem;
}
footer.footer a { color: var(--mairie-accent); }
/* v1.6.0 : comme la réservation — les blasons au-dessus du texte, le badge
   BETA qui pulse doucement */
.footer-blasons { margin-bottom: 0.9rem; }
.footer-blasons img { height: 52px; width: auto; }
footer.footer .badge { vertical-align: middle; animation: pulse-beta 2s ease-in-out infinite; }
@keyframes pulse-beta { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* ----- Fiche du terrain (téléphone) ----- */
.terrain-tete { text-align: center; }
.terrain-photo {
  width: 100%; max-height: 220px; object-fit: cover;
  border-radius: 0.5rem; margin-bottom: 1rem; background: #e2e8f0;
}
.terrain-tete .fiche-champs { text-align: left; display: inline-grid; }
.terrain-actions {
  display: grid; grid-template-columns: 1fr; gap: 0.6rem; margin-bottom: 1rem;
}
@media (min-width: 480px) { .terrain-actions { grid-template-columns: 1fr 1fr; } }
.btn-terrain {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.35rem; padding: 1rem 0.75rem; font-weight: 600; border-width: 2px;
}
.btn-terrain i { font-size: 1.6rem; }
.btn-terrain span { font-size: 0.9rem; line-height: 1.2; text-align: center; }

/* ----- Planche d'étiquettes ----- */
/* Format visé : A4, 3 colonnes × 8 lignes de 70 × 37 mm (planche courante). */
.planche-etiquettes {
  display: grid;
  grid-template-columns: repeat(3, 70mm);
  grid-auto-rows: 37mm;
  gap: 0;
  background: #fff;
}
.etiquette {
  display: flex; align-items: center; gap: 3mm;
  padding: 3mm; overflow: hidden;
  border: 1px dashed #cbd5e1;          /* repère de découpe, retiré à l'impression */
  box-sizing: border-box;
}
.etiquette-qr { width: 26mm; height: 26mm; flex: none; }
.etiquette-qr svg { width: 100%; height: 100%; display: block; }
.etiquette-texte { min-width: 0; flex: 1; color: #1a202c; }
.etiquette-commune {
  font-size: 6pt; letter-spacing: 0.06em; text-transform: uppercase;
  color: #312783; font-weight: 700; line-height: 1.2;
}
.etiquette-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10pt; font-weight: 700; letter-spacing: 0.04em; margin: 0.6mm 0;
}
.etiquette-nom {
  font-size: 7.5pt; line-height: 1.15; margin-bottom: 0.6mm;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.etiquette-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 6.5pt; color: #6c757d; letter-spacing: 0.08em;
}

@media print {
  @page { size: A4; margin: 0; }

  /* 3 colonnes de 70 mm font exactement 210 mm, soit la largeur d'une A4 :
     il ne reste pas un millimètre pour une marge. Le padding du conteneur
     Bootstrap suffirait à faire passer la troisième colonne à la ligne et à
     gâcher la planche. On le neutralise donc explicitement. */
  main.main-container { padding: 0 !important; }
  .main-container > .container,
  .container { max-width: none !important; width: auto !important;
               padding: 0 !important; margin: 0 !important; }

  .planche-etiquettes { gap: 0; width: 210mm; margin: 0; }
  .etiquette { border: none; break-inside: avoid; }
}

/* ----- Impression ----- */
@media print {
  .navbar-mairie, footer.footer, .no-print, .toast-container-fixed { display: none !important; }
  main.main-container { padding-top: 0; }
  .section-card { box-shadow: none; border: 1px solid #d1d5db; break-inside: avoid; }
  a[href]::after { content: ""; }
  body { background: #fff; }
}

/* ============================================================
   Page de connexion — LA MÊME dans les quatre applis de la mairie
   (réservation v2.115.7, Cap v0.6.4, Vigie v1.7.2, démarches v1.2.2) :
   celle de la réservation, choisie par Loric le 10/11/2026. Le logo de la
   commune au-dessus de la carte, juste dessous le picto et le nom de
   l'appli (proposition B : le picto au trait blanc dans un rond bleu
   foncé, le nom sur deux lignes comme dans la barre) ; dans la carte, la
   bulle « Connexion » (.section-title et .icon-bubble, déjà les mêmes
   partout), les champs, « Mot de passe oublié ? » à droite, les boutons,
   une note.
   Bloc identique dans les quatre style.css : le recopier s'il change.
   ============================================================ */
.connexion-logo { text-align: center; margin-bottom: 0.75rem; }
.connexion-logo img { width: auto; height: auto; max-width: 200px; max-height: 150px; }
.connexion-appli { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.connexion-appli-rond {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 50px; height: 50px; border-radius: 50%; background: var(--mairie-primary);
}
.connexion-appli-rond img { width: 32px; height: 32px; }
.connexion-appli-nom { font-size: 1.3rem; font-weight: 800; line-height: 1.15; color: var(--mairie-primary); }
.connexion-appli-ligne2 { font-size: 0.9rem; line-height: 1.25; color: var(--mairie-muted, #6c757d); }
.connexion-oubli { text-align: right; margin-bottom: 1rem; font-size: 0.875rem; }
.connexion-oubli a { color: var(--bs-link-color, #0d6efd); text-decoration: none; }
.connexion-oubli a:hover, .connexion-oubli a:focus { text-decoration: underline; }
.connexion-note { margin: 1rem 0 0; text-align: center; font-size: 0.875rem; color: var(--mairie-muted, #6c757d); }
/* Edge ajoute son propre œil dans les champs de mot de passe : masqué là où
   l'appli a déjà le sien (bouton bi-eye dans le même .input-group), sinon il y
   en a deux côte à côte. Ailleurs, celui d'Edge reste. */
.input-group:has(.bi-eye, .bi-eye-slash) input::-ms-reveal { display: none; }

/* ---------- Connexion par MyAD (v1.8.0) ---------- */
/* Le trait « ou » entre le bouton MyAD et le formulaire habituel */
.connexion-ou { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 1rem; font-size: 0.8rem; color: var(--mairie-muted, #6c757d); }
.connexion-ou::before, .connexion-ou::after { content: ""; flex: 1; border-top: 1px solid #dee2e6; }

/* ----- Pages légales (inc/ui/page_legale.php) et leurs liens du pied de page.
   Bloc identique dans les cinq applis de la mairie. ----- */
.footer-legal {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 1.4rem;
  margin-top: 0.9rem; font-size: 0.85rem;
}
footer.footer .footer-legal a { color: rgba(255,255,255,0.85); }
footer.footer .footer-legal a:hover { color: #fff; }
.page-legale { max-width: 48rem; margin: 0 auto; padding: 1rem 0 2rem; }
.page-legale-rubrique {
  margin: 0 0 0.3rem; font-size: 0.85rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: #5b6478;
}
.page-legale h1 { font-size: 1.9rem; font-weight: 700; color: var(--mairie-primary); margin-bottom: 1rem; }
.page-legale h2 { font-size: 1.2rem; font-weight: 700; color: var(--mairie-primary); margin: 2rem 0 0.5rem; }
.page-legale .lead { font-size: 1.1rem; }
.page-legale a { color: var(--mairie-primary); }
.page-legale-tableau { font-size: 0.92rem; }
.page-legale-tableau th { font-weight: 600; }
.page-legale-tableau tbody th { width: 36%; }
.page-legale-tableau td:last-child { width: 28%; }
.page-legale-voir { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid #dde3ee; }
