:root {
    --vert: #2d6a4f;
    --vert-fonce: #1b4332;
    --beige: #f4f1ea;
    --texte: #26302b;
}

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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    color: var(--texte);
    background: var(--beige);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: var(--vert-fonce);
    color: #fff;
}
.nav-zone {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.brand {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
}
nav { display: flex; gap: 1rem; flex-wrap: wrap; }
nav a { color: #d8f5e3; text-decoration: none; padding: .3rem .5rem; border-radius: 4px; }
nav a:hover { background: var(--vert); color: #fff; }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1.5rem;
    flex: 1;
}

h1 { color: var(--vert-fonce); margin-bottom: 1rem; }
h2 { color: var(--vert-fonce); margin-bottom: .8rem; }

.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    margin-bottom: 1.5rem;
}

/* tables des listes */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .2rem; text-align: left; border-bottom: 1px solid #ddd; }
th { background: var(--vert); color: #fff; }
tr:hover td { background: #f0f7f3; }
tr.ligne-cliquable { cursor: pointer; }

/* forms */
form label { display: block; margin-bottom: .2rem; font-weight: 600; }
form input, form select {
    width: 100%;
    padding: .2rem;
    margin-bottom: .8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
}
form select option { font-family: inherit; font-size: inherit; }
form select option.titre { font-weight: 700; }

/* Champ mot de passe avec bouton Afficher / Masquer */
.champ-mdp { position: relative; }
.champ-mdp input {
    padding-right: 5.4rem;
    margin-bottom: 0;
}
.btn-mdp {
    position: absolute;
    right: .3rem;
    top: 50%;
    transform: translateY(-50%);
    background: #e9e9e9;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: .15rem .5rem;
    font-size: .8rem;
    color: var(--texte);
    cursor: pointer;
}
.btn-mdp:hover { background: #dcdcdc; color: var(--texte); }

form.inline input { width: auto; }

button, .btn {
    background: var(--vert);
    color: #fff;
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-family: inherit;
    /* font-size: 1rem; */
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
button:hover, .btn:hover { background: var(--vert-fonce); }
.btn-dark { background: var(--vert-fonce); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: .85rem; }
.btn-suppr { background: #b23a48; }
.btn-suppr:hover { background: #8e2c38; }

.alerte {
    padding: .8rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}
.alerte.erreur { background: #fde8e8; color: #8e2c38; }
.alerte.succes { background: #e6f4ea; color: var(--vert-fonce); }

.badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .8rem;
    background: #e0e0e0;
}
.badge.admin { background: var(--vert); color: #fff; }
.badge.actif { background: #e6f4ea; color: var(--vert-fonce); }
.badge.inactif { background: #fadadd; color: #8e2c38; }

.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grille .champ-large { grid-column: 1 / -1; }
@media (max-width: 700px) { .grille { grid-template-columns: 1fr; } }

footer {
    background: var(--vert-fonce);
    color: #d8f5e3;
    text-align: center;
    padding: 1rem;
    margin-top: 2rem;
}

/* Page plan du cimetière */
.barre-plans {
    display: flex;
    gap: .8rem;
    margin-bottom: 1rem;
}
.btn-plan {
    background: #e9e9e9;
    color: var(--texte);
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: .5rem 1rem;
    text-decoration: none;
    font-size: .95rem;
}
.btn-plan:hover { background: #dcdcdc; }
.btn-plan.actif {
    background: var(--vert);
    border-color: var(--vert);
    color: #fff;
}
.plan-svg {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Cartouche de légende des types de concession */
.cartouche {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    padding: .8rem 1.2rem;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}
.legende-item { white-space: nowrap; }
.pastille {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: 1px solid #666;
    vertical-align: -2px;
    margin-right: .35rem;
}
.legende-note {
    margin-left: auto;
    font-style: italic;
    color: #555;
}

/* Plan SVG affiché en ligne dans la page */
.conteneur-plan svg {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}
/* Concessions cliquables : pointer-events=all garde toute la surface
   cliquable même sans remplissage (zone sans type reconnu). */
.conteneur-plan polygon.concession { cursor: pointer; pointer-events: all; }
/* Les étiquettes (numéro, nom) ne captent pas la souris : le curseur
   main et le clic restent ceux du polygone situé en dessous. */
.conteneur-plan svg text { pointer-events: none; }
.conteneur-plan polygon.concession:hover {
    stroke: #000 !important;
    stroke-width: 3 !important;
    filter: brightness(1.15);
}

/* Bulle des informations d'une concession */
.popin-concession img { display: block; max-width: 220px; margin-top: .4rem; border-radius: 4px; }
.popin-concession {
    position: fixed;
    z-index: 1000;
    background: #fff;
    border: 2px solid var(--vert);
    border-radius: 6px;
    padding: .6rem .9rem;
    font-size: .95rem;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    max-width: 280px;
}

/* Liens de compte (Mon compte / Déconnexion / Connexion) poussés à droite */
nav .nav-compte { margin-left: auto; display: flex; gap: 1rem; }

/* Menu déroulant « Administration » : ouvert au clic (<details open>),
   au survol (:hover) ou au focus clavier (:focus-within). */
nav .dropdown { position: relative; }
nav .dropdown summary {
    color: #d8f5e3;
    padding: .3rem .5rem;
    border-radius: 4px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
nav .dropdown summary::-webkit-details-marker { display: none; }
nav .dropdown summary::after { content: " ▾"; }
nav .dropdown summary:hover,
nav .dropdown[open] summary { background: var(--vert); color: #fff; }
nav .dropdown .sous-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 210px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    padding: .4rem 0;
    z-index: 100;
}
nav .dropdown[open] .sous-menu,
nav .dropdown:hover .sous-menu,
nav .dropdown:focus-within .sous-menu { display: block; }
nav .dropdown .sous-menu a {
    display: block;
    color: var(--texte);
    padding: .5rem 1rem;
    text-decoration: none;
}
nav .dropdown .sous-menu a:hover { background: var(--vert); color: #fff; }

/* Formulaire de recherche (page Gestion des concessions) */
form.recherche { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
form.recherche input[type=text] { flex: 1; min-width: 220px; width: auto; margin-bottom: 0; }
form.recherche select { width: auto; margin-bottom: 0; }

/* Ligne de la concession ouverte dans la liste */
tr.ligne-actuelle td { background: #e6f4ea; }

/* Liste déroulante des résultats de recherche (5 lignes visibles) */
form.liste-resultats { display: flex; gap: .8rem; align-items: flex-start; }
form.liste-resultats select { width: 100%; font-size: 1rem; padding: .3rem; }

/* Modale d'ajout (inhumé, tiers, document) : ouverte par le bouton du titre du pavé */
dialog.modale { margin: auto; /* le reset * { margin: 0 } casse le centrage UA du dialog : on le rétablit */ border: none; border-radius: 8px; padding: 1.5rem; width: min(720px, calc(100% - 2rem)); max-height: calc(100vh - 3rem); overflow: auto; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
dialog.modale::backdrop { background: rgba(0,0,0,.45); }
dialog.modale .modale-titre { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; }
dialog.modale .modale-titre h3 { color: var(--vert-fonce); margin: 0; }
dialog.modale .ligne-aktion { display: flex; margin: .3rem 0; }
h2 .btn { vertical-align: middle; }

/* Photo de la tombe : miniature dans le titre de la fiche, grand format dans la modale */
img.miniature { height: 42px; width: auto; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; vertical-align: middle; }
img.photo-grand { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; }

/* Actions sur une ligne d'inhumé (déplacer / supprimer) */
form.ligne-aktion { display: inline-flex; gap: .3rem; align-items: center; margin: .1rem .3rem .1rem 0; }
form.ligne-aktion input[type=text] { width: 120px; margin-bottom: 0; padding: .3rem .5rem; }

/* Filtre nom/prénom au-dessus de la liste des tiers existants */
form.recherche-liste-tiers { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
form.recherche-liste-tiers input[type=text] { width: auto; min-width: 240px; margin-bottom: 0; }
