/* =====================================================================
   style.css — Suivi des puits
   Concu pour le telephone d'abord : champs hauts, boutons larges.
   ===================================================================== */

:root {
    --bleu:        #1e5f74;
    --bleu-fonce:  #133b48;
    --bleu-clair:  #e8f1f4;
    --gris-texte:  #2b3a3f;
    --gris-doux:   #6b7c82;
    --bordure:     #d6e0e4;
    --fond:        #f7f9fa;
    --blanc:       #ffffff;
    --rouge:       #b3261e;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--fond);
    color: var(--gris-texte);
    line-height: 1.5;
}

/* ---------- En-tete ---------- */

header {
    background: var(--bleu-fonce);
    padding: 1rem 1.25rem;
}

header h1 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--blanc);
    font-weight: 600;
}

/* ---------- Les trois onglets ---------- */

.onglets {
    display: flex;
    background: var(--bleu);
    position: sticky;
    top: 0;
    z-index: 10;
}

.onglets a {
    flex: 1;
    padding: 0.9rem 0.5rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.95rem;
    border-bottom: 3px solid transparent;
}

.onglets a.actif {
    color: var(--blanc);
    font-weight: 600;
    border-bottom-color: var(--blanc);
    background: rgba(255, 255, 255, 0.1);
}

/* ---------- Contenu ---------- */

main {
    padding: 1.25rem;
    max-width: 900px;
    margin: 0 auto;
}

h2 { font-size: 1.3rem; margin: 0 0 1rem 0; }
h3 { font-size: 1.1rem; margin: 1.75rem 0 0.75rem 0; }

.ligne-titre {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ligne-titre h2,
.ligne-titre h3 { margin: 0; }

/* ---------- Cartes ---------- */

.carte,
.carte-visite,
.bloc {
    display: block;
    background: var(--blanc);
    border: 1px solid var(--bordure);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.85rem;
    text-decoration: none;
    color: inherit;
}

.carte:active { background: var(--bleu-clair); }

.carte-entete {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.4rem;
}

.carte-titre { font-weight: 600; font-size: 1.05rem; }
.date-visite { font-weight: 600; }

.carte-info { margin: 0.25rem 0; }

.carte-meta {
    margin: 0.4rem 0 0 0;
    font-size: 0.85rem;
    color: var(--gris-doux);
}

/* ---------- Badges d'etat ---------- */

.badge {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.etat-bon           { background: #d8f0dd; color: #1c5c2c; }
.etat-a-surveiller  { background: #fdf0cd; color: #7a5800; }
.etat-defectueux    { background: #fbdcda; color: #96241c; }
.etat-hors-service  { background: #e2e5e7; color: #40484c; }
.etat-aucun         { background: #eef1f2; color: var(--gris-doux); }

/* ---------- Formulaires ---------- */

label {
    display: block;
    margin: 1rem 0 0.35rem 0;
    font-weight: 600;
    font-size: 0.92rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;          /* 16px minimum : evite le zoom sur iPhone */
    font-family: inherit;
    border: 1px solid var(--bordure);
    border-radius: 8px;
    background: var(--blanc);
    color: var(--gris-texte);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--bleu);
    outline-offset: 1px;
}

textarea { resize: vertical; }

/* Cases a cocher */

.cases {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.case {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-height: 44px;         /* toute la ligne est cliquable */
    margin: 0;
    padding: 0.4rem 0.25rem;
    font-weight: 400;
    cursor: pointer;
}

.case input[type="checkbox"] {
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
}

/* ---------- Boutons ---------- */

.bouton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;         /* cible tactile confortable */
    padding: 0.6rem 1rem;
    background: var(--bleu);
    color: var(--blanc);
    border: none;
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.bouton-large {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.9rem;
    background: var(--bleu);
    color: var(--blanc);
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

.lien-retour {
    display: inline-block;
    margin: 0.5rem 0;
    color: var(--bleu);
    text-decoration: none;
    font-size: 0.92rem;
}

/* ---------- Actions et zones de danger ---------- */

.actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--bordure);
}

.actions a {
    display: inline-block;
    padding: 0.4rem 0;
    color: var(--bleu);
    text-decoration: none;
    font-size: 0.88rem;
}

.actions form { margin: 0; }

.lien-danger {
    background: none;
    border: none;
    padding: 0;
    color: var(--rouge);
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
}

.zone-danger {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--bordure);
}

.bouton-danger {
    width: 100%;
    padding: 0.75rem;
    background: var(--blanc);
    color: var(--rouge);
    border: 1px solid var(--rouge);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
}

/* ---------- Filtres ---------- */

.filtres {
    background: var(--blanc);
    border: 1px solid var(--bordure);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.filtre-champ label { margin-top: 0.5rem; }
.filtres .bouton { margin-top: 1rem; }

.compteur {
    color: var(--gris-doux);
    font-size: 0.88rem;
    margin: 0 0 0.75rem 0;
}

/* ---------- Tableaux ---------- */

.tableau-infos {
    width: 100%;
    border-collapse: collapse;
}

.tableau-infos th,
.tableau-infos td {
    padding: 0.55rem 0;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--bordure);
}

.tableau-infos th {
    width: 42%;
    color: var(--gris-doux);
    font-weight: 600;
    font-size: 0.9rem;
}

.tableau-infos tr:last-child th,
.tableau-infos tr:last-child td { border-bottom: none; }

.tableau-donnees {
    display: none;            /* masque sur telephone */
    width: 100%;
    border-collapse: collapse;
    background: var(--blanc);
    border: 1px solid var(--bordure);
    border-radius: 10px;
    overflow: hidden;
}

.tableau-donnees th {
    background: var(--bleu-clair);
    padding: 0.7rem;
    text-align: left;
    font-size: 0.88rem;
}

.tableau-donnees td {
    padding: 0.7rem;
    border-top: 1px solid var(--bordure);
    font-size: 0.92rem;
    vertical-align: top;
}

.tableau-donnees a { color: var(--bleu); }

.vide {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--gris-doux);
    background: var(--blanc);
    border: 1px dashed var(--bordure);
    border-radius: 10px;
}

/* =====================================================================
   Grand ecran : on montre le tableau et on cache les cartes.
   ===================================================================== */

@media (min-width: 700px) {

    .tableau-donnees { display: table; }
    .cartes-mobile   { display: none; }

    .filtres {
        display: flex;
        align-items: flex-end;
        gap: 1rem;
    }

    .filtre-champ { flex: 1; }
    .filtre-champ label { margin-top: 0; }
    .filtres .bouton { margin-top: 0; }

    .bouton-large {
        width: auto;
        min-width: 220px;
    }
}

/* =====================================================================
   Ajouts pour la structure du rapport de maintenance
   ===================================================================== */

/* ---------- Recherche ---------- */

.recherche {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.recherche input {
    flex: 1;
    min-width: 0;
}

/* ---------- Bandeau de statistiques ---------- */

.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    background: var(--blanc);
    border: 1px solid var(--bordure);
    border-radius: 10px;
    font-size: 0.92rem;
    color: var(--gris-doux);
}

.stats strong {
    color: var(--bleu);
    font-size: 1.1rem;
}

.alerte-stat strong { color: #96241c; }

/* ---------- Notes sous forme de barres ---------- */

.notes {
    margin: 0.75rem 0 0.5rem 0;
    padding: 0.65rem 0;
    border-top: 1px solid var(--bordure);
}

.note {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.note-libelle {
    flex: 0 0 42%;
    color: var(--gris-doux);
}

.note-barre {
    flex: 1;
    height: 8px;
    background: #e8edef;
    border-radius: 999px;
    overflow: hidden;
}

.note-remplie {
    display: block;
    height: 100%;
    background: var(--bleu);
    border-radius: 999px;
}

.note-valeur {
    flex: 0 0 3.2rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--gris-texte);
}

.note-moyenne {
    margin: 0.55rem 0 0 0;
    font-size: 0.88rem;
    color: var(--gris-doux);
}

.note-moyenne strong { color: var(--bleu); }

/* ---------- Divers ---------- */

.sans-date {
    color: var(--gris-doux);
    font-weight: 400;
    font-style: italic;
}

.prochaine {
    padding: 0.5rem 0.65rem;
    background: #fdf6e3;
    border-radius: 6px;
}

/* Les sous-titres dans les formulaires longs */
form h3 {
    margin: 1.75rem 0 0.25rem 0;
    padding-bottom: 0.35rem;
    font-size: 1rem;
    color: var(--bleu);
    border-bottom: 1px solid var(--bordure);
}

@media (min-width: 700px) {
    .note-libelle { flex: 0 0 30%; }
}

/* =====================================================================
   Position GPS et distances
   ===================================================================== */

.tri {
    margin: -0.5rem 0 1rem 0;
    font-size: 0.88rem;
    color: var(--gris-doux);
}

.tri a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-left: 0.4rem;
    padding: 0.3rem 0.9rem;
    color: var(--bleu);
    text-decoration: none;
    border: 1px solid var(--bordure);
    border-radius: 999px;
}

.tri a.tri-actif {
    background: var(--bleu);
    border-color: var(--bleu);
    color: var(--blanc);
    font-weight: 600;
}

.aide {
    margin: 0.35rem 0 0 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--gris-doux);
}

.details-gps {
    margin-top: 0.9rem;
    padding: 0.6rem 0.8rem;
    background: var(--fond);
    border: 1px solid var(--bordure);
    border-radius: 8px;
}

.details-gps summary {
    font-size: 0.88rem;
    color: var(--bleu);
    cursor: pointer;
}

.details-gps label { margin-top: 0.75rem; }

.precision {
    font-size: 0.8rem;
    color: var(--gris-doux);
}

.manquant {
    color: var(--gris-doux);
    font-style: italic;
}

.lien-carte {
    display: inline-block;
    margin-top: 0.35rem;
    min-height: 30px;
    color: var(--bleu);
    font-size: 0.88rem;
}

/* =====================================================================
   Interventions (cases cochées affichées en étiquettes)
   ===================================================================== */

.tag {
    display: inline-block;
    margin: 0.15rem 0.2rem 0.15rem 0;
    padding: 0.2rem 0.6rem;
    background: var(--bleu-clair);
    color: var(--bleu-fonce);
    border-radius: 999px;
    font-size: 0.8rem;
}

.tag-prochaine {
    background: #fdf6e3;
    color: #7a5800;
}

.case-rien {
    font-weight: 600;
    color: var(--bleu);
    border-bottom: 1px solid var(--bordure);
    margin-bottom: 0.25rem;
    padding-bottom: 0.55rem;
}
