body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f9;
}

header {
    background-color: #003366;
    color: white;
    padding: 15px;
    text-align: center;
}

.search-container {
    max-width: 800px;
    margin: 20px auto 10px auto;
    padding: 0 15px;
    box-sizing: border-box;
}

#search-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #ffffff;
    color: #333333;
}

#search-input:focus {
    border-color: #003366;
    box-shadow: 0 0 6px rgba(0, 51, 102, 0.25);
}

.hidden {
    display: none !important;
}

#alert-banner {
    background-color: #ff4c4c;
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 15px;
    margin-bottom: 20px;
}

main {
    padding: 15px;
    max-width: 800px;
    margin: 0 auto;
}

section {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

h2 {
    color: #003366;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
}

/* --- Sections pliables / dépliables de la page principale --- */
/* Fonctionne comme les sous-sections du Plan de Rangement :    */
/* un clic sur le titre replie la liste du matériel.            */
h2.section-title {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    transition: color 0.2s;
}

h2.section-title:hover {
    color: #dc3545;
}

h2.section-title::after {
    content: '▾';
    font-size: 0.75em;
    margin-left: auto;
    color: #003366;
    transition: transform 0.2s;
}

h2.section-title:hover::after {
    color: #dc3545;
}

h2.section-title.collapsed::after {
    content: '▸';
}

.materiel-card {
    border-left: 5px solid #4CAF50;
    padding: 15px;
    margin-bottom: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.materiel-card.danger {
    border-left-color: #ff4c4c;
    background-color: #fff0f0;
}

.materiel-card.warning {
    border-left-color: #fd7e14;
    background-color: #fff8f0;
}

.badge.badge-expired {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.badge.badge-warning {
    background-color: #fd7e14;
    color: white;
    border-color: #fd7e14;
}

.badges-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.badge {
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 0.85em;
    color: #444;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-action {
    background-color: #003366;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-action:hover {
    background-color: #004a94;
}

.materiel-nom {
    font-weight: bold;
    font-size: 1.1em;
}

.materiel-details {
    font-size: 0.9em;
    color: #555;
    margin-top: 5px;
}

.localisation-badge {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
}

/* --- Mode Inventaire --- */
.inventory-toggle-container {
    text-align: center;
    margin: 15px auto 0 auto;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-inventory-mode {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: background-color 0.2s;
}

.btn-inventory-mode:hover {
    background-color: #218838;
}

.btn-inventory-mode.active {
    background-color: #dc3545;
}

.btn-export {
    background-color: transparent;
    color: #003366;
    border: 2px solid #003366;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.btn-export:hover {
    background-color: #003366;
    color: white;
}

/* Le bouton Modifier reste disponible en mode inventaire : il permet de
   corriger un élément (ex. mettre à jour une date de péremption) après
   l'avoir jugé conforme malgré une date dépassée. */
body.inventory-mode-active .btn-action {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Actions du mode inventaire (masquées par défaut) */
.inventory-actions {
    display: none;
    gap: 10px;
}

body.inventory-mode-active .inventory-actions {
    display: flex;
}

.btn-conforme, .btn-anomalie {
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    color: white;
    transition: background-color 0.2s, opacity 0.2s;
}

.btn-conforme {
    background-color: #28a745;
}

.btn-conforme:hover {
    background-color: #218838;
}

.btn-anomalie {
    background-color: #dc3545;
}

.btn-anomalie:hover {
    background-color: #c82333;
}

/* Etat contrôlé (visuel temporaire) */
.materiel-card.controlled {
    opacity: 0.6;
    background-color: #e8f5e9;
    border-left-color: #28a745 !important;
}

/* --- Verrouillage du Scroll Arrière-plan & Modales --- */
body.modal-open {
    overflow: hidden !important;
}

/* --- Modale d'édition et modales générales --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overscroll-behavior: contain;
}

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overscroll-behavior: contain;
}

.modal-content h3 {
    margin-top: 0;
    color: #003366;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.form-group input, .form-group select {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.form-group small {
    color: #666;
    margin-top: 4px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.btn-cancel:hover {
    background-color: #5a6268;
}

.btn-save {
    background-color: #003366;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.btn-save:hover {
    background-color: #004a94;
}

/* --- Header & Utilisateur --- */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

#vehicule-info {
    text-align: left;
}

#user-info-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9em;
}

.btn-logout {
    background-color: transparent;
    color: white;
    border: 1px solid white;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background-color 0.2s, color 0.2s;
}

.btn-logout:hover {
    background-color: white;
    color: #003366;
}

/* --- Bouton Historique --- */
.btn-history {
    background-color: transparent;
    color: #6c757d;
    border: 2px solid #6c757d;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.btn-history:hover {
    background-color: #6c757d;
    color: white;
}

/* --- Modale Historique --- */
.history-content {
    max-width: 780px;
    width: 92%;
}

.history-list {
    max-height: 62vh;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 15px;
    background-color: #f9f9f9;
}

.history-day {
    margin-bottom: 14px;
}

.history-day-title {
    font-weight: bold;
    color: #003366;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 10px;
    background: #e8eef5;
    border-radius: 6px;
    margin-bottom: 6px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.history-item {
    /* Disposition en tableau : colonnes de largeur FIXE, donc alignées
       verticalement pour toutes les lignes (heure | badge | auteur | action | copier) */
    display: grid;
    grid-template-columns: 46px 104px 112px 1fr 30px;
    align-items: center;
    column-gap: 10px;
    padding: 7px 10px;
    border-bottom: 1px solid #eef2f6;
    font-size: 0.88em;
    color: #444;
    line-height: 1.45;
}

.history-item:last-child {
    border-bottom: none;
}

.history-time {
    font-variant-numeric: tabular-nums;
    color: #8899aa;
    font-size: 0.92em;
    white-space: nowrap;
}

.history-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.78em;
    font-weight: bold;
    white-space: nowrap;
}

.history-badge.ok { background: #d4edda; color: #155724; }
.history-badge.warn { background: #f8d7da; color: #721c24; }
.history-badge.edit { background: #d1ecf1; color: #0c5460; }
.history-badge.add { background: #d4edda; color: #155724; }
.history-badge.del { background: #f8d7da; color: #721c24; }
.history-badge.cancel { background: #e2e3e5; color: #383d41; }
.history-badge.info { background: #e2e3e5; color: #383d41; }

.history-user {
    font-weight: bold;
    color: #003366;
    white-space: nowrap;
}

.history-user.me {
    color: #fff;
    background: #003366;
    padding: 1px 8px;
    border-radius: 10px;
}

.history-action { line-height: 1.5; min-width: 0; word-break: break-word; }

/* Nom du matériel cité dans une action : mis en gras */
.history-item-name {
    color: #003366;
    font-weight: bold;
}

/* --- Indicateur de synchronisation (en-tête) --- */
/* Le symbole de chaque état est DESSINÉ en CSS (aucun emoji) ; le texte
   complet n'apparaît qu'au survol, via l'infobulle (attribut title). */
.sync-status {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    cursor: help;
    border: 1px solid transparent;
    transition: background 0.3s, border-color 0.3s;
}

.sync-status::before,
.sync-status::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Fonds colorés selon l'état */
.sync-status.local    { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.25); }
.sync-status.inactive { background: rgba(253,126,20,0.18);  border-color: rgba(253,126,20,0.5); }
.sync-status.syncing  { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.25); }
.sync-status.ok       { background: rgba(40,167,69,0.22);   border-color: rgba(40,167,69,0.55); }
.sync-status.error,
.sync-status.expired  { background: rgba(220,53,69,0.22);   border-color: rgba(220,53,69,0.6); }

/* local : anneau creux */
.sync-status.local::before {
    width: 12px; height: 12px; box-sizing: border-box;
    border-radius: 50%; border: 3px solid #cfd9e3;
}

/* inactive : triangle d'alerte */
.sync-status.inactive::before {
    width: 0; height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 13px solid #ffc98a;
}

/* syncing : arc rotatif */
.sync-status.syncing::before {
    width: 16px; height: 16px; box-sizing: border-box;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.25);
    border-top-color: #ffffff;
    animation: sync-spin 0.9s linear infinite;
}
@keyframes sync-spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ok : point vert pulsant */
.sync-status.ok::before {
    width: 13px; height: 13px; border-radius: 50%; background: #8ef0a8;
}
.sync-status.ok::after {
    width: 13px; height: 13px; border-radius: 50%; background: #8ef0a8;
    animation: sync-ring 1.8s ease-out infinite;
}
@keyframes sync-ring {
    from { transform: translate(-50%, -50%) scale(1);   opacity: 0.8; }
    to   { transform: translate(-50%, -50%) scale(2.4); opacity: 0; }
}

/* error : point d'exclamation */
.sync-status.error::before {
    width: 4px; height: 11px; border-radius: 2px; background: #ff9aa6;
    top: calc(50% - 3px);
}
.sync-status.error::after {
    width: 4px; height: 4px; border-radius: 50%; background: #ff9aa6;
    top: calc(50% + 7px);
}

/* expired : cercle barré */
.sync-status.expired::before {
    width: 16px; height: 16px; box-sizing: border-box;
    border-radius: 50%; border: 3px solid #ff9aa6;
}
.sync-status.expired::after {
    width: 20px; height: 3px; border-radius: 2px; background: #ff9aa6;
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* --- Menu hamburger (en-tête, à droite) --- */
.menu-container {
    position: relative;
    margin-left: 10px;
}

.btn-menu {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    padding: 8px 9px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-menu:hover { background: rgba(255, 255, 255, 0.22); }

.menu-bar {
    display: block;
    height: 3px;
    border-radius: 2px;
    background-color: #fff;
    transition: transform 0.25s, opacity 0.25s;
}

/* Transformation en croix quand le menu est ouvert */
.btn-menu.open .menu-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.btn-menu.open .menu-bar:nth-child(2) { opacity: 0; }
.btn-menu.open .menu-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 250px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    padding: 6px;
    z-index: 1000;
}

.menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 11px 14px;
    border: none;
    background: none;
    color: #333;
    font-size: 0.95em;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.menu-item:hover { background: #e8eef5; color: #003366; }

.menu-sep {
    height: 1px;
    background: #e5e9ee;
    margin: 6px 10px;
}

.menu-advanced-toggle { font-weight: bold; color: #003366; }
.menu-chevron { float: right; transition: transform 0.2s; }
.menu-advanced-toggle[aria-expanded="true"] .menu-chevron { transform: rotate(90deg); }

.menu-advanced-panel { padding-left: 12px; }

.menu-sub { font-size: 0.88em; color: #555; }
.menu-danger { color: #dc3545; }
.menu-danger:hover { background: #f8d7da; color: #a71d2a; }

/* --- Modale Contacts --- */
.contact-card {
    border: 1px solid #e0e6ec;
    border-left: 4px solid #003366;
    border-radius: 8px;
    padding: 14px 16px;
    margin: 12px 0;
    background: #f8fafc;
}

.contact-role {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #fd7e14;
    font-weight: bold;
    margin-bottom: 4px;
}

.contact-name { font-weight: bold; color: #003366; }

.contact-mail {
    display: inline-block;
    margin-top: 4px;
    color: #0055aa;
    text-decoration: none;
    font-size: 0.9em;
    word-break: break-all;
}

.contact-mail:hover { text-decoration: underline; }

/* --- Modale FAQ --- */
.faq-content { max-width: 560px; }

.faq-item {
    border: 1px solid #e0e6ec;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
    overflow: hidden;
}

.faq-item summary {
    cursor: pointer;
    padding: 12px 14px;
    font-weight: bold;
    color: #003366;
    font-size: 0.92em;
    list-style-position: inside;
}

.faq-item summary:hover { background: #e8eef5; }

.faq-item p {
    padding: 0 14px 12px 14px;
    color: #444;
    font-size: 0.88em;
    line-height: 1.5;
}

/* --- Section spéciale : éléments non contrôlés (Mode Inventaire) --- */
.non-inventaire-section {
    opacity: 0.9;
    filter: grayscale(0.55);
    background: #f4f6f8;
    border: 1px dashed #b9c4cf;
    border-radius: 10px;
    padding: 0 14px;
    margin-top: 26px;
}

.non-inventaire-section .section-title {
    color: #6b7885;
    cursor: pointer;
    font-size: 1.02em;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.non-inventaire-section .section-title::before {
    content: '▸';
    transition: transform 0.2s ease;
    font-size: 0.9em;
}

.non-inventaire-section.open .section-title::before {
    transform: rotate(90deg);
}

.non-inventaire-count {
    font-size: 0.82em;
    color: #8a97a3;
    font-weight: normal;
}

/* Liste repliée par défaut */
.non-inventaire-section .materiaux-liste {
    display: none;
}

.non-inventaire-section.open .materiaux-liste {
    display: block;
    padding-bottom: 10px;
}

.non-inventaire-card {
    opacity: 0.8;
    background: #eef1f4;
    border-left: 4px solid #b9c4cf;
}

.non-inventaire-card .materiel-nom {
    color: #5a6672;
    font-weight: normal;
}

/* --- Historique : grade + date du jour --- */
.history-grade {
    display: inline-block;
    padding: 0 6px;
    border-radius: 8px;
    background: #e8eef5;
    color: #003366;
    font-size: 0.82em;
    font-weight: bold;
    white-space: nowrap;
}

.history-who {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-day-date {
    font-weight: normal;
    color: #7a8896;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 6px;
}

/* --- Sélecteur de liste (Mode Inventaire) --- */
.liste-switcher {
    display: flex;
    gap: 0;
    max-width: 720px;
    margin: 0 auto 16px;
    background: #e8eef5;
    border-radius: 10px;
    padding: 4px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

.switch-btn {
    flex: 1;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: #003366;
    font-size: 0.95em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.switch-btn:hover { background: rgba(255,255,255,0.6); }

.switch-btn.active {
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

#switch-noninv-count {
    color: #fd7e14;
    font-size: 0.9em;
}

/* --- Groupe de boutons d'une carte (Modifier + actions d'inventaire) --- */
/* Modifier est placé dans le même groupe que Conforme/Anomalie afin d'être
   aligné verticalement avec eux, sur une seule rangée. */
.materiel-info {
    flex: 1;
    min-width: 0;
}

.card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.card-actions .inventory-actions {
    align-items: center;
}

/* --- Historique : recherche + bouton copier --- */
.history-search-container {
    margin-bottom: 12px;
}

#history-search {
    width: 100%;
    padding: 9px 12px;
    border: 2px solid #d0dbe5;
    border-radius: 8px;
    font-size: 0.92em;
    background: #f8fafc;
}

#history-search:focus {
    outline: none;
    border-color: #003366;
    background: white;
}

.history-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid #d0dbe5;
    border-radius: 6px;
    background: white;
    color: #5a6672;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.history-copy:hover {
    background: #e8eef5;
    color: #003366;
    border-color: #003366;
}

.history-copy.copied {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

/* --- Compteurs et animation sur les filtres --- */
.filter-count {
    display: inline-block;
    min-width: 18px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.12);
    font-size: 0.8em;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
}

.filter-pill.active .filter-count {
    background: rgba(255, 255, 255, 0.35);
}

/* Animation légère : attire l'œil quand des éléments sont à surveiller/en anomalie */
.filter-pill.pulse {
    animation: filter-pulse 1.8s ease-in-out infinite;
}

@keyframes filter-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(253, 126, 20, 0.0); }
    50%      { box-shadow: 0 0 0 5px rgba(253, 126, 20, 0.28); }
}

/* --- Bouton Photo sur la carte --- */
.btn-photo {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
    opacity: 0.7;
    transition: opacity 0.2s;
    vertical-align: middle;
}

.btn-photo:hover {
    opacity: 1;
}

/* --- Plan de Rangement (Grille) --- */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.plan-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    background-color: #f9f9f9;
    transition: box-shadow 0.2s, transform 0.2s;
}

.plan-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.plan-card p {
    margin: 10px 0 0 0;
    font-weight: bold;
    color: #333;
}

/* Style des images cliquables dans le plan */
.plan-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    cursor: pointer;
    display: block;
}

/* --- Zones pliables du Plan de Rangement --- */
.plan-zone {
    margin-bottom: 20px;
}

.plan-zone-title {
    color: #003366;
    font-size: 1.1em;
    cursor: pointer;
    padding: 10px 15px;
    background-color: #e8eef5;
    border-radius: 8px;
    margin: 0 0 10px 0;
    user-select: none;
    transition: background-color 0.2s;
}

.plan-zone-title:hover {
    background-color: #d0dde8;
}

.plan-zone-title.collapsed::after {
    content: ' ▸';
}

.plan-zone-content {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.plan-zone-content.collapsed {
    display: none;
}

/* --- Modale Plan de Rangement Ergonomique & Fixe --- */
.plan-content {
    max-width: 960px;
    width: 95%;
    max-height: 88vh;
    height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    overflow: hidden;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #ffffff;
    border-bottom: 2px solid #e2e8f0;
    flex-shrink: 0;
    z-index: 10;
}

.plan-main-title {
    margin: 0;
    padding: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #003366;
    border: none;
}

.plan-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 24px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.plan-footer {
    background: #ffffff;
    padding: 14px 24px;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    z-index: 10;
}

.btn-close-plan {
    padding: 10px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #003366;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 6px rgba(0, 51, 102, 0.2);
}

.btn-close-plan:hover {
    background-color: #002244;
    transform: translateY(-1px);
}

.btn-close-plan:active {
    transform: translateY(1px);
}

@media (max-width: 600px) {
    .plan-content {
        width: 96%;
        height: 92vh;
        max-height: 92vh;
        border-radius: 10px;
    }
    .plan-header {
        padding: 12px 16px;
    }
    .plan-main-title {
        font-size: 1.15rem;
    }
    .plan-body {
        padding: 14px 12px;
    }
    .plan-footer {
        padding: 12px 16px;
    }
    .btn-close-plan {
        width: 100%;
        text-align: center;
        padding: 12px;
    }
}

/* --- Bouton Fermer Modale (X) --- */
.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #333;
    cursor: pointer;
    line-height: 1;
}

.btn-close-photo {
    position: fixed;
    top: 20px;
    right: 25px;
    background: rgba(220, 53, 69, 0.9);
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1200;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: background-color 0.2s, transform 0.2s;
    line-height: 1;
    padding: 0;
}

.btn-close-photo:hover {
    background: #dc3545;
    transform: scale(1.1);
}

/* --- Barre de Progression --- */
.progress-container {
    max-width: 800px;
    margin: 15px auto 0 auto;
    text-align: center;
}

.progress-text {
    font-size: 0.9em;
    font-weight: bold;
    color: #003366;
    margin-bottom: 5px;
}

.progress-bar-bg {
    background-color: #e0e0e0;
    border-radius: 10px;
    height: 12px;
    width: 100%;
    overflow: hidden;
}

.progress-bar-fill {
    background-color: #28a745;
    height: 100%;
    transition: width 0.3s ease;
}

/* --- Filtres Rapides (Pilules) --- */
.filters-container {
    max-width: 800px;
    margin: 10px auto 20px auto;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-pill {
    background-color: white;
    color: #555;
    border: 1px solid #ccc;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.filter-pill:hover {
    background-color: #f1f1f1;
}

.filter-pill.active {
    background-color: #003366;
    color: white;
    border-color: #003366;
}


#vehicule-selector {
    margin-top: 10px;
    padding: 5px 10px;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #ccc;
    background: #fff;
    color: #003366;
    font-weight: bold;
    cursor: pointer;
}



.img-container {
    width: 100%;
    height: 150px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}


/* --- Sous-catégories du Plan de Rangement --- */
.plan-sub-section {
    margin-bottom: 25px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.plan-sub-title {
    margin: 0;
    padding: 14px 20px;
    min-height: 52px;
    box-sizing: border-box;
    font-size: 1.15rem;
    font-weight: 600;
    color: #003366;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-left: 6px solid #003366;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
}

.plan-sub-title:hover {
    background: #edf2f7;
}

.plan-sub-title:active {
    background: #e2e8f0;
}

/* Flèche / Chevron tactile agrandie (24px / 1.5rem) avec zone circulaire bien visible */
.plan-sub-title::after {
    content: "▾";
    font-size: 1.5rem; /* ~24px */
    line-height: 1;
    color: #003366;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 51, 102, 0.06);
    flex-shrink: 0;
    margin-left: 10px;
    transform-origin: center center;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease;
}

.plan-sub-title:hover::after {
    background: rgba(0, 51, 102, 0.12);
}

.plan-sub-title.collapsed::after {
    transform: rotate(-90deg);
}

.plan-sub-content {
    padding: 15px;
}

/* --- Points Interactifs (Hotspots) sur Photos Agrandies --- */
.photo-interactive-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 80vh;
    line-height: 0;
    user-select: none;
}

.photo-enlarged {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.6);
    display: block;
    object-fit: contain;
}

.hotspot-pin {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    /* Fond semi-transparent : le matériel situé derrière le point
       reste visible. La bordure blanche maintient la lisibilité. */
    background-color: rgba(220, 53, 69, 0.30);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 20;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    line-height: normal;
}

/* Radar pulse au repos */
.hotspot-pin::before {
    content: "";
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.12); /* halo très léger, discret */
    z-index: -1;
    animation: hotspot-radar 2.5s infinite ease-out;
}

@keyframes hotspot-radar {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    70% {
        transform: scale(2.2);
        opacity: 0;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Cœur blanc du point */
.hotspot-pin::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #ffffff;
    transition: transform 0.2s ease;
}

/* Survol et état actif */
.hotspot-pin:hover,
.hotspot-pin.active {
    transform: translate(-50%, -50%) scale(1.25);
    /* Survol : plus opaque mais toujours translucide */
    background-color: rgba(255, 59, 78, 0.55);
    z-index: 30;
}

.hotspot-pin:hover::after,
.hotspot-pin.active::after {
    transform: scale(1.2);
}

/* Infobulle / Étiquette (Tooltip) */
.hotspot-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background-color: #003366; /* Bleu secours */
    color: #ffffff;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.25);
    z-index: 40;
}

/* Flèche directionnelle vers le point */
.hotspot-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #003366 transparent transparent transparent;
}

/* Affichage de l'infobulle au survol sur PC ou au clic/tap */
.hotspot-pin:hover .hotspot-tooltip,
.hotspot-pin.active .hotspot-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Variations de position de l'infobulle */
.hotspot-pin.tooltip-bottom .hotspot-tooltip {
    bottom: auto;
    top: calc(100% + 10px);
    transform: translateX(-50%) translateY(-6px);
}
.hotspot-pin.tooltip-bottom .hotspot-tooltip::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent #003366 transparent;
}
.hotspot-pin.tooltip-bottom:hover .hotspot-tooltip,
.hotspot-pin.tooltip-bottom.active .hotspot-tooltip {
    transform: translateX(-50%) translateY(0);
}

.hotspot-pin.tooltip-left .hotspot-tooltip {
    left: 0;
    transform: translateX(0) translateY(6px);
}
.hotspot-pin.tooltip-left .hotspot-tooltip::after {
    left: 12px;
    transform: none;
}
.hotspot-pin.tooltip-left:hover .hotspot-tooltip,
.hotspot-pin.tooltip-left.active .hotspot-tooltip {
    transform: translateX(0) translateY(0);
}

.hotspot-pin.tooltip-right .hotspot-tooltip {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(6px);
}
.hotspot-pin.tooltip-right .hotspot-tooltip::after {
    left: auto;
    right: 12px;
    transform: none;
}
.hotspot-pin.tooltip-right:hover .hotspot-tooltip,
.hotspot-pin.tooltip-right.active .hotspot-tooltip {
    transform: translateX(0) translateY(0);
}

/* Toast informatif pour le mode calibrage */
.calibration-toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: rgba(0, 51, 102, 0.95);
    color: #ffffff;
    padding: 10px 22px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.calibration-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Barre d'Outils et Mode Annotation / Étalonnage --- */
.photo-modal-toolbar {
    position: fixed;
    top: 20px;
    left: 25px;
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 1200;
}

/* Bouton roue crantée discret / toggleable */
.btn-toolbar-gear {
    background: rgba(0, 51, 102, 0.75);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    user-select: none;
}

.btn-toolbar-gear:hover,
.btn-toolbar-gear.active {
    background: rgba(0, 51, 102, 1);
    border-color: #ffffff;
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

/* Panneau déroulant d'outils */
.photo-modal-tools-panel {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(0, 34, 68, 0.88);
    padding: 5px 10px;
    border-radius: 25px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    animation: panelFadeIn 0.2s ease-out;
}

@keyframes panelFadeIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.btn-toolbar-annotation,
.btn-toolbar-export,
.btn-toolbar-reset {
    background: rgba(0, 51, 102, 0.88);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.btn-toolbar-reset {
    background: rgba(108, 117, 125, 0.85);
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-toolbar-annotation:hover,
.btn-toolbar-export:hover,
.btn-toolbar-reset:hover {
    background: rgba(0, 51, 102, 1);
    border-color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.btn-toolbar-reset:hover {
    background: rgba(73, 80, 87, 1);
}

/* État actif quand le Mode Annotation est enclenché */
.btn-toolbar-annotation.active {
    background: #ffc107;
    color: #002244;
    border-color: #ffffff;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(255, 193, 7, 0.6);
    animation: annotation-pulse 1.8s infinite;
}

@keyframes annotation-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* Bannière d'instruction en mode annotation */
.annotation-banner {
    position: fixed;
    top: 75px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 51, 102, 0.95);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.5);
    padding: 8px 22px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 1200;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    text-align: center;
}

/* Curseur viseur sur l'image en mode annotation */
.photo-interactive-wrapper.annotation-mode img {
    cursor: crosshair !important;
}

/* Boîte de dialogue stylisée pour ajouter un point */
.hotspot-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1300;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.hotspot-dialog-box {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: left;
    border-top: 5px solid #003366;
    animation: dialogAppear 0.2s ease-out;
}

@keyframes dialogAppear {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hotspot-dialog-box h4 {
    margin: 0 0 6px 0;
    color: #003366;
    font-size: 1.25rem;
}

.hotspot-dialog-coords {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 15px 0;
}

.hotspot-dialog-coords span {
    font-weight: bold;
    color: #dc3545;
}

.hotspot-dialog-box input {
    width: 100%;
    padding: 11px 14px;
    font-size: 1rem;
    border: 2px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    margin-bottom: 20px;
    outline: none;
    transition: border-color 0.2s;
}

.hotspot-dialog-box input:focus {
    border-color: #003366;
}

.hotspot-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-dialog-cancel {
    background: #e2e8f0;
    color: #333;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-dialog-cancel:hover {
    background: #cbd5e1;
}

.btn-dialog-confirm {
    background: #003366;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-dialog-confirm:hover {
    background: #002244;
}

@media (max-width: 650px) {
    .photo-modal-toolbar {
        top: 15px;
        left: 15px;
        gap: 6px;
    }
    .photo-modal-tools-panel {
        flex-wrap: wrap;
        max-width: calc(100vw - 90px);
        padding: 4px 8px;
        gap: 5px;
    }
    .btn-toolbar-gear {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }
    .btn-toolbar-annotation,
    .btn-toolbar-export,
    .btn-toolbar-reset {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    .annotation-banner {
        top: 60px;
        font-size: 0.75rem;
        padding: 6px 14px;
        width: 90%;
    }
    /* Infobulles mobiles compactes et sans débordement */
    .hotspot-tooltip {
        max-width: 200px;
        white-space: normal;
        text-align: center;        font-size: 0.78rem;
        padding: 6px 10px;
        line-height: 1.25;
    }
}

/* --- Mode Inventaire : bouton Masquer les contrôlés --- */
.progress-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.btn-all-conforme {
    background-color: transparent;
    color: #28a745;
    border: 2px solid #28a745;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-all-conforme:hover {
    background-color: #28a745;
    color: white;
}

.btn-export-report {
    background-color: transparent;
    color: #003366;
    border: 2px solid #003366;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-export-report:hover {
    background-color: #003366;
    color: white;
}

/* --- Mode Inventaire : pastille de progression par section --- */
.section-progress-badge {
    display: none;
    font-size: 0.65em;
    font-weight: bold;
    background-color: #e0e0e0;
    color: #003366;
    padding: 3px 10px;
    border-radius: 12px;
    margin-left: 8px;
    vertical-align: middle;
    transition: background-color 0.2s, color 0.2s;
}

body.inventory-mode-active .section-progress-badge {
    display: inline-block;
}

.section-progress-badge.complete {
    background-color: #28a745;
    color: white;
}

.btn-hide-controlled {
    background-color: transparent;
    color: #003366;
    border: 2px solid #003366;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    font-weight: bold;
    margin-top: 8px;
    transition: all 0.2s;
}

.btn-hide-controlled:hover {
    background-color: #003366;
    color: white;
}

.btn-hide-controlled.active {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

/* --- Mode Inventaire : bouton Annuler le contrôle --- */
.btn-undo {
    background-color: transparent;
    color: #6c757d;
    border: 2px solid #6c757d;
    padding: 8px 12px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    background-color: #6c757d;
    transition: background-color 0.2s, opacity 0.2s;
    white-space: nowrap;
}

.btn-undo:hover {
    background-color: #5a6268;
}

/* Boutons Conforme/Anomalie désactivés une fois l'item contrôlé */
.btn-conforme:disabled, .btn-anomalie:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* --- Mode Inventaire : modale de motif d'anomalie --- */
.anomalie-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-anomalie-choice {
    background-color: white;
    border: 2px solid #dc3545;
    color: #dc3545;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.btn-anomalie-choice:hover {
    background-color: #dc3545;
    color: white;
}
