/* CONTENU COMPLET ET CORRIGÉ POUR : public/style.css */

:root {
    --select-arrow-fill: #6c757d;
    --list-max-height: 400px;
    
    /* Couleurs */
    --header-bg: #007bff; 
    --header-text: #ffffff;
    --tab-active-border: #007bff;
    
    --bg-color: #eef; --text-color: #212529; --sidebar-bg: #f8f9fa; --sidebar-text: #333;
    --sidebar-border: #eee; --sidebar-shadow: rgba(0,0,0,0.2); --button-bg: white;
    --button-text: #333; --button-border: #ccc; --button-hover-bg: #e9ecef;
    --button-primary-bg: #007bff; --button-primary-text: white; --button-primary-border: #007bff;
    --button-primary-hover-bg: #0056b3; --button-primary-hover-border: #0056b3;
    --button-logout-bg: #dc3545; --button-logout-hover-bg: #c82333;
    --filter-btn-bg: #f1f1f1; --filter-btn-text: #333; --filter-btn-border: #ddd;
    --filter-btn-active-bg: #007bff; --filter-btn-active-text: white; --filter-btn-active-border: #0056b3;
    --list-bg: #fff; --list-border: #eee; --list-item-hover-bg: #e3f2fd; --list-item-border-top: #f5f5f5;
    --popup-bg: white; --popup-border: #eee; --popup-shadow: rgba(0,0,0,0.5);
    --popup-header-text: #007bff; --popup-text-strong: #555; --popup-text-meta: #6c757d;
    --popup-history-border: #eee; --popup-history-meta: #aaa; --search-bg: white;
    --search-border: #ccc; --search-btn-bg: #f8f9fa; --search-btn-hover-bg: #e2e6ea;
    --icon-color: #6c757d; --cluster-text-color: #333;
}

/* === THEME SOMBRE === */
body.theme-dark, body.dark-mode {
    --bg-color: #121212; --text-color: #e0e0e0; --sidebar-bg: #1e1e1e; --sidebar-text: #f5f5f5;
    --sidebar-border: #333; --sidebar-shadow: rgba(0,0,0,0.5); --button-bg: #2c2c2c;
    --button-text: #f5f5f5; --button-border: #444; --button-hover-bg: #3a3a3a;
    --filter-btn-bg: #2c2c2c; --filter-btn-text: #f5f5f5; --filter-btn-border: #444;
    --list-bg: #1e1e1e; --list-border: #333; --list-item-hover-bg: #2a2a2a; --list-item-border-top: #333;
    --popup-bg: #1e1e1e; --popup-border: #333; --popup-shadow: rgba(0,0,0,0.8);
    --popup-header-text: #4dabf7; --popup-text-strong: #e0e0e0; --popup-text-meta: #aaa;
    --search-bg: #2c2c2c; --search-border: #444; --search-btn-bg: #3a3a3a; --search-btn-hover-bg: #4a4a4a;
    --icon-color: #adb5bd;
}
body.theme-dark .popup-section-header { background-color: #2c2c2c; color: #fff; }
body.theme-dark .popup-section-header:hover { background-color: #3a3a3a; }
body.theme-dark .popup-section-content { background-color: #1e1e1e; }
body.theme-dark .popup-meta { background-color: #252525; border-bottom-color: #333; }
body.theme-dark .popup-tabs { background-color: #1e1e1e; border-bottom-color: #333; }
body.theme-dark .popup-tab:hover { background-color: #2a2a2a; }
body.theme-dark .materiel-list { background-color: #252525; border-color: #333; }
body.theme-dark .editor-header { background-color: #252525; border-bottom-color: #333; }
body.theme-dark #global-editor { background-color: #121212; color: #e0e0e0; }

/* === 1. STYLE UNIFIÉ DES BOUTONS SIDEBAR (ALIGNEMENT GAUCHE SERRÉ) === */

.sidebar-button,
.filter-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important; /* FORCE L'ALIGNEMENT A GAUCHE */
    
    width: 100%;
    min-height: 42px;
    flex-shrink: 0;
    box-sizing: border-box;
    
    /* MODIFICATION : Padding réduit pour coller au bord gauche */
    padding: 10px 5px 10px 5px !important; 
    margin: 0 0 5px 0;
    
    border: 1px solid var(--button-border);
    border-radius: 6px;
    background-color: var(--button-bg);
    color: var(--button-text);
    
    font-size: 0.95em;
    line-height: 1.3;
    text-align: left !important; /* FORCE LE TEXTE A GAUCHE */
    cursor: pointer;
}

/* Zone Icône/Pastille (à gauche) */
.sidebar-button .icon, 
.sidebar-button > .sidebar-icon,
.filter-btn .icon { 
    flex: 0 0 20px; /* Largeur réduite pour l'icône (était 26px) */
    width: 20px;
    display: flex; 
    justify-content: center; 
    align-items: center;
    
    /* MODIFICATION : On réduit la marge entre l'icône et le texte */
    margin-right: 5px !important; 
    margin-left: 0 !important;
}

/* Checkbox (adaptation pour coller au style serré) */
.sidebar-button input[type="checkbox"] {
    flex: 0 0 20px; 
    width: 16px; height: 16px; 
    margin: 0 5px 0 0; 
    cursor: pointer;
    display: flex; justify-content: center;
}

/* ZONE ACTIVE (Style Point Plein) */
.zone-indicator {
    flex: none !important;
    width: 14px !important; min-width: 14px !important;
    height: 14px !important; min-height: 14px !important;
    border-radius: 50%;
    
    background-color: #dc3545; 
    border: 1px solid #a71d2a; 
    
    /* Marges ajustées pour le mode "serré" */
    margin: 0 5px 0 0 !important; 
    
    transition: all 0.3s;
    display: inline-block;
    box-sizing: border-box;
}

.zone-indicator.active {
    background-color: #28a745; 
    border-color: #1e7e34;
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.4); 
}

/* Le texte prend toute la place restante */
.sidebar-button span, 
.sidebar-button .label-text,
.filter-btn span:not(.point-count) {
    flex-grow: 1;
    text-align: left;
    margin: 0;
    padding: 0;
    padding-left: 0 !important; /* Sûreté : pas de marge à gauche du texte */
}

/* Le compteur (le petit chiffre à droite) */
.filter-btn .point-count {
    margin-left: auto; /* Pousse le compteur tout à droite */
    padding-left: 4px;
    font-size: 0.85em;
    opacity: 0.8;
    flex-shrink: 0;
}

/* Effets au survol/actif */
.sidebar-button:hover, .filter-btn:hover {
    background-color: var(--button-hover-bg);
    border-color: #bbb;
}

.filter-btn.active, .sidebar-button.active {
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border-color: var(--button-primary-border);
}

/* BOUTONS D'ACTION FILTRES */
.filter-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px; 
    margin-bottom: 10px;
}
.filter-actions button {
    flex: 1; 
    padding: 8px;
    background-color: #6c757d; 
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    text-align: center;
    transition: background-color 0.2s;
}
.filter-actions button:hover { background-color: #5a6268; }

/* === 2. GESTION DU REPLI (CORRIGÉ FLEX) === */

.sidebar-buttons, .filter-group {
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease, margin 0.3s ease;
    overflow: hidden; 
    opacity: 1;
    padding: 10px 5px 15px 5px;
    margin-bottom: 15px;
    border-top: 1px solid var(--sidebar-border);
    box-sizing: border-box;
    display: flex; 
    flex-direction: column;
}

.sidebar-buttons.collapsed, .filter-group.collapsed {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    opacity: 0;
    border-top: none;
    visibility: hidden;
    pointer-events: none;
}

/* === 3. RESTE DU CSS === */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; margin: 0; height: 100vh; overflow: hidden; background-color: var(--bg-color); color: var(--text-color); }
#map { position: relative; width: calc(100% - 280px); height: 100%; margin-left: 280px; transition: width 0.35s, margin-left 0.35s; }
body.sidebar-hidden #map { margin-left: 0; width: 100%; }
#sidebar { width: 280px; height: 100%; background-color: var(--sidebar-bg); box-shadow: 2px 0 5px rgba(0,0,0,0.1); position: fixed; top: 0; left: 0; z-index: 1001; display: flex; flex-direction: column; transition: transform 0.35s; }
body.sidebar-hidden #sidebar { transform: translateX(-100%); }

.sidebar-content { 
    padding: 10px; 
    padding-bottom: 50px; 
    flex-grow: 1; 
    overflow-y: auto; 
    overflow-x: hidden; 
}
.sidebar-footer { padding: 10px; border-top: 1px solid var(--sidebar-border); background: var(--sidebar-bg); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* Version badge (sidebar & dashboard nav) */
.version-badge {
  display: inline-block;
  font-size: .7em;
  font-weight: 600;
  color: var(--sidebar-text);
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 10px;
  padding: 3px 10px;
  letter-spacing: .03em;
  cursor: default;
  user-select: none;
  opacity: .65;
  transition: opacity .2s;
  white-space: nowrap;
}
.version-badge:hover { opacity: 1; }
.version-badge-nav { font-size: .73em; }

h2 { font-size: 1.1em; color: var(--sidebar-text); margin-top: 15px; margin-bottom: 5px; cursor: pointer; display: flex; align-items: center; }
h2 .title-arrow { margin-left: auto; transition: transform 0.3s; width: 0.8em; height: 0.8em; background-color: var(--icon-color); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 16.5L6 10.5L7.41 9.09L12 13.67L16.59 9.09L18 10.5L12 16.5Z' fill='currentColor'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 16.5L6 10.5L7.41 9.09L12 13.67L16.59 9.09L18 10.5L12 16.5Z' fill='currentColor'/%3E%3C/svg%3E"); mask-repeat: no-repeat; -webkit-mask-repeat: no-repeat; mask-position: center; -webkit-mask-position: center; }
h2.collapsed .title-arrow { transform: rotate(-90deg); }

.sidebar-toggle { position: fixed; top: 10px; left: 220px; z-index: 1002; background: white; border: 1px solid #ccc; padding: 5px 10px; border-radius: 4px; cursor: pointer; transition: top 0.35s, left 0.35s; }
body.sidebar-hidden .sidebar-toggle { left: 10px; top: 85px; }

/* Listes déroulantes (SANS PUCES) */
.point-list { 
    list-style: none !important; /* Suppression puces */
    padding: 0 !important; 
    margin: 0; 
    max-height: 0; 
    overflow: hidden; 
    transition: max-height 0.3s ease; 
    background: white; 
    border-radius: 0 0 4px 4px; 
    width: 100%; 
    box-sizing: border-box; 
}
.point-list.visible { max-height: 400px; overflow-y: auto; border: 1px solid #ddd; border-top: none; margin-top: -5px; margin-bottom: 5px; }
/* Cas spécial pour les listes déroulantes (si "18 Fonderie" est dedans) */
.point-list li {
    padding: 8px 5px 8px 25px !important; /* Indentation ajustée */
    border-bottom: 1px solid #eee;
    cursor: pointer;
    font-size: 0.9em;
    list-style-type: none !important;
    text-align: left;
}
.point-list li:hover { background: #f1f1f1; }

/* Popup */
.draggable-popup { position: fixed; z-index: 10000; width: 380px; max-width: 90vw; background-color: var(--popup-bg); border-radius: 8px; box-shadow: 0 5px 15px var(--popup-shadow); display: flex; flex-direction: column; overflow: hidden; font-family: 'Segoe UI', sans-serif; }
.popup-header { background-color: var(--header-bg); color: var(--header-text); padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; cursor: move; }
.popup-title { margin: 0; font-size: 1.15rem; font-weight: 600; color: white !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup-header-actions button { background: none; border: none; color: white; font-size: 1.2rem; cursor: pointer; opacity: 0.8; margin-left: 8px; padding: 0; }
.popup-header-actions button:hover { opacity: 1; }
.popup-meta { background-color: #f8f9fa; padding: 8px 15px; border-bottom: 1px solid #e9ecef; color: #495057; font-size: 0.95em; display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.popup-tabs { display: flex; background: white; border-bottom: 1px solid #dee2e6; }
.popup-tab { flex: 1; padding: 12px 0; border: none; background: none; cursor: pointer; color: #6c757d; font-weight: 500; border-bottom: 3px solid transparent; transition: all 0.2s; }
.popup-tab:hover { background-color: #f8f9fa; }
.popup-tab.active { color: var(--tab-active-border); border-bottom-color: var(--tab-active-border); }
.popup-body { padding: 15px; overflow-y: auto; max-height: 60vh; background: white; }
.popup-tab-content { display: none; }
.popup-tab-content.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.popup-field-group { margin-bottom: 15px; }
.popup-field-group label { display: block; font-size: 0.85em; color: #6c757d; margin-bottom: 4px; font-weight: 600; text-transform: uppercase; }
.address-row { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.materiel-list { background: #f8f9fa; padding: 8px; border-radius: 4px; font-size: 0.95em; border: 1px solid #e9ecef; }
.popup-actions-row { display: flex; gap: 15px; margin-bottom: 15px; }
.action-item { flex: 1; }
.action-item select, .action-item input { width: 100%; padding: 8px; border: 1px solid #ced4da; border-radius: 4px; font-size: 0.95em; box-sizing: border-box; }
.popup-status-row { display: flex; gap: 10px; margin-bottom: 15px; }
.status-label { display: flex; align-items: center; justify-content: center; padding: 8px 12px; border-radius: 4px; font-size: 0.9em; font-weight: 600; cursor: pointer; flex: 1; text-align: center; border: 1px solid transparent; transition: 0.2s; }
.status-label.planifie { background: #e8f5e9; color: #28a745; border-color: #c3e6cb; }
.status-label.fait { background: #e2e3e5; color: #383d41; border-color: #d6d8db; }
input:checked + .status-label.planifie { background-color: #28a745; color: white; border-color: #28a745; }
input:checked + .status-label.fait { background-color: #545b62; color: white; border-color: #545b62; }
.status-checkbox input { display: none; } 
.status-checkbox { flex: 1; }
.popup-button { display: inline-block; width: 100%; padding: 10px; border: none; border-radius: 4px; font-size: 1em; font-weight: 600; cursor: pointer; text-align: center; transition: 0.2s; }
.btn-add-tour { background-color: #007bff; color: white; }
.btn-add-tour:hover { background-color: #0056b3; }
.btn-remove-tour { background-color: #dc3545; color: white; }
.btn-remove-tour:hover { background-color: #bd2130; }
.btn-icon { background: white; border: 1px solid #ced4da; padding: 5px 10px; border-radius: 4px; cursor: pointer; }
.btn-icon:hover { background: #f1f1f1; }
.popup-tags-input { padding: 8px; border: 1px solid #ced4da; border-radius: 4px; width: 100%; box-sizing: border-box; }
.btn-preview-pdf { background: none; border: none; color: #007bff; cursor: pointer; padding: 5px 0; text-decoration: underline; font-size: 0.95em; display: flex; align-items: center; gap: 5px; }
.btn-preview-pdf:hover { color: #0056b3; }

/* Modales & Editeur */
.modal-container { background: white; width: 90%; max-width: 800px; max-height: 90vh; display: flex; flex-direction: column; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
#settings-modal, #tour-modal, #global-editor-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 12000; display: none; justify-content: center; align-items: center; }

#settings-modal .settings-header.collapsible {
    cursor: pointer; border-bottom: none; padding: 10px 15px; margin: 0;
    display: flex; align-items: center; gap: 8px; position: relative; font-size: 1.1em; user-select: none;
    transition: background-color 0.2s;
}
#settings-modal .settings-header.collapsible:hover { background-color: var(--button-hover-bg); }
#settings-modal .settings-header .title-arrow {
    margin-left: auto; display: inline-block; width: 0.8em; height: 0.8em;
    background-color: var(--icon-color); transition: transform 0.3s ease-out;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 16.5L6 10.5L7.41 9.09L12 13.67L16.59 9.09L18 10.5L12 16.5Z' fill='currentColor'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 16.5L6 10.5L7.41 9.09L12 13.67L16.59 9.09L18 10.5L12 16.5Z' fill='currentColor'/%3E%3C/svg%3E"); mask-repeat: no-repeat; -webkit-mask-repeat: no-repeat; mask-position: center; -webkit-mask-position: center;
}
#settings-modal .settings-header.collapsible.collapsed .title-arrow { transform: rotate(-90deg); }

/* Zone Contenu Paramètres */
#settings-modal .settings-group-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out, padding 0.3s ease, border-top-width 0.3s ease;
    padding: 10px 15px; 
    border-top: 1px solid var(--sidebar-border);
    background-color: var(--bg-color);
    opacity: 1;
    display: block;
}

/* État Fermé : Display none !important pour forcer le masquage */
#settings-modal .settings-group-content.collapsed {
    max-height: 0 !important;
    padding-top: 0 !important; padding-bottom: 0 !important;
    border-top-width: 0; opacity: 0;
    display: none !important;
}

/* Barre recherche */
#search-container { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; transition: opacity 0.3s ease-in-out; }
#searchBox { padding: 8px; border: 1px solid var(--search-border); background-color: var(--search-bg); color: var(--text-color); border-radius: 4px 0 0 4px; border-right: none; padding-right: 30px; width: 200px; }
#searchBtn { padding: 8px 12px; border: 1px solid var(--search-border); border-left: none; background-color: var(--search-btn-bg); color: var(--text-color); border-radius: 0 4px 4px 0; cursor: pointer; }
#searchBtn:hover { background-color: var(--search-btn-hover-bg); }
.clear-search-btn { position: absolute; right: 50px; top: 50%; transform: translateY(-50%); cursor: pointer; color: #dc3545; font-size: 1.6em; line-height: 1; display: none; padding: 0 5px; user-select: none; z-index: 1001; }
#search-container.search-has-text .clear-search-btn { display: block; }
.popup-open #search-container { opacity: 0.5; pointer-events: none; }

/* Partage */
#qrOverlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); z-index: 10005; display: flex; justify-content: center; align-items: center; }
#qrOverlay.hidden { display: none !important; }
#qrBox { background: var(--popup-bg); padding: 25px; border-radius: 8px; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.3); color: var(--text-color); }
#qrCanvas { margin-bottom: 20px; background-color: white; padding: 10px; display: inline-block; border-radius: 4px; }
#qrActions { display: flex; flex-direction: column; gap: 10px; }

/* Tournée Modal - Design amélioré */
.tour-modal-container {
    background: white;
    width: 92%;
    max-width: 960px;
    height: 88vh;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    backdrop-filter: blur(20px);
}
.tour-modal-header {
    padding: 14px 18px;
    background: linear-gradient(135deg, #f8f9fa 0%, #eef1f5 100%);
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.tour-modal-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
}
.tour-modal-body {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}
.tour-modal-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e7eb;
    padding: 10px;
    overflow-y: auto;
}
.tour-modal-column:last-child {
    border-right: none;
}
.tour-modal-col-title {
    font-size: 0.88em;
    font-weight: 700;
    color: #374151;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tour-modal-col-content {
    flex-grow: 1;
    overflow-y: auto;
}
.tour-modal-col-header {
    margin-bottom: 8px;
}
.tour-modal-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.btn-load-tour {
    background: #f0f4ff;
    border: 1px solid #d0d7ff;
    color: #4f8ef7;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}
.btn-load-tour:hover {
    background: #e4ecff;
    border-color: #4f8ef7;
}
.tour-saved-list {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    margin-top: 6px;
}
.tour-saved-item {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}
.tour-saved-item:last-child {
    border-bottom: none;
}
.tour-saved-item:hover {
    background: #f0f4ff;
}
.tour-saved-item .tour-saved-date {
    font-size: 0.82em;
    color: #9ca3af;
    flex-shrink: 0;
}
.tour-saved-item .tour-saved-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #374151;
    font-weight: 500;
}
.tour-saved-loading {
    padding: 14px;
    text-align: center;
    font-size: 0.85em;
    color: #9ca3af;
}
@media (max-width: 768px) {
    .tour-modal-body { flex-direction: column; }
    .tour-modal-column { border-right: none; border-bottom: 1px solid #e5e7eb; max-height: 35%; }
    .tour-modal-column:last-child { border-bottom: none; }
}

/* Animation de pulsation pour les marqueurs de tournée */
@keyframes tourMarkerPulse {
    0%, 100% { box-shadow: 0 3px 12px rgba(0,0,0,0.3), inset 0 -2px 4px rgba(0,0,0,0.15); }
    50% { box-shadow: 0 3px 18px rgba(0,0,0,0.4), 0 0 0 6px rgba(79,142,247,0.15), inset 0 -2px 4px rgba(0,0,0,0.15); }
}

/* --- STYLE CORRIGÉ POUR L'ÉDITEUR GLOBAL --- */

#global-editor {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: white !important; /* Fond blanc forcé */
    z-index: 20000 !important; /* Au-dessus de tout */
    display: none; /* Caché par défaut, géré par JS */
    flex-direction: column;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    color: #333;
}

.editor-header {
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    height: 60px;
    box-sizing: border-box;
}

.editor-content {
    flex-grow: 1;
    overflow: auto;
    padding: 20px;
    width: 100%;
    height: calc(100% - 60px);
    box-sizing: border-box;
    background-color: white;
}

.editor-header .close-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.editor-header .close-btn:hover {
    background: #cc0000;
}

/* Force le tableau à prendre toute la largeur */
#globalPointsTable {
    width: 100% !important;
}

/* Autres */
.theme-select-container { position: relative; z-index: 1; padding: 0 !important; align-items: center; }
.theme-select-container label { padding: 10px 5px 10px 10px; display: flex; align-items: center; gap: 8px; color: var(--button-text); margin: 0; pointer-events: none; z-index: 1; width: auto; flex-shrink: 0; }
.theme-select-container select { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; z-index: 2; cursor: pointer; }
.theme-select-container:has(select[value="custom"]) { background-color: var(--button-primary-bg); border-color: var(--button-primary-border); }
.theme-select-container:has(select[value="custom"]) label { color: var(--button-primary-text); }

#tour-breaks-list { max-height: 150px; overflow-y: auto; }
#tour-breaks-list:empty { border: none !important; padding: 0 !important; margin-bottom: 0 !important; }

body.dark-mode #global-editor { background-color: #2c2c2c; color: #e0e0e0; }
body.dark-mode .editor-header { background-color: #383838; border-bottom-color: #555; }
#custom-theme-modal { z-index: 20000 !important; }

/* === GLASSMORPHISM NAVBAR (main map page) === */
#sidebar { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); background-color: rgba(248, 249, 250, 0.88); }
body.dark-mode #sidebar, body.theme-dark #sidebar { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); background-color: rgba(30, 30, 30, 0.88); }

/* === PULSATING MAP MARKERS (urgent/retard ODMs) === */
@keyframes marker-pulse-retard {
  0%, 100% { filter: drop-shadow(0 0 2px #000000) drop-shadow(0 0 0px transparent) brightness(1); }
  50% { filter: drop-shadow(0 0 10px #111111) drop-shadow(0 0 20px #00000044) drop-shadow(0 0 4px #888888) brightness(0.9); }
}
@keyframes marker-pulse-urgent {
  0%, 100% { filter: drop-shadow(0 0 2px #fbbf24) drop-shadow(0 0 0px transparent) brightness(1); }
  50% { filter: drop-shadow(0 0 10px #f59e0b) drop-shadow(0 0 20px #fbbf2444) drop-shadow(0 0 4px white) brightness(1.15); }
}
.custom-div-icon.marker-retard .base-marker-icon {
  animation: marker-pulse-retard 1.8s ease-in-out infinite;
  will-change: filter;
}
.custom-div-icon.marker-urgent .base-marker-icon {
  animation: marker-pulse-urgent 2s ease-in-out infinite;
  will-change: filter;
}
/* Reduce animations for performance on mobile */
@media (max-width: 768px) {
  .custom-div-icon.marker-retard .base-marker-icon,
  .custom-div-icon.marker-urgent .base-marker-icon {
    animation-duration: 2.5s;
    will-change: auto;
  }
}

/* --- STYLE DES MARQUEURS SUR LA CARTE (Mis à jour) --- */

/* Conteneur global du marqueur */
.marker-container {
    position: relative; /* Important pour le positionnement absolu des icônes */
    width: 22px !important; /* Largeur fixe égale à l'image du marqueur */
    height: 36px !important;
    overflow: visible !important; /* Laisse dépasser les icônes */
}

/* L'image du marqueur (épingle) */
.base-marker-icon {
    width: 22px !important;
    height: 36px !important;
    object-fit: contain;
    display: block;
}

/* Conteneur des indicateurs (Notes/Photos) */
.map-indicator-wrapper {
    display: flex !important;
    flex-direction: row !important; /* Force l'alignement horizontal */
    gap: 0px; /* Icones collées */
    justify-content: center;
    align-items: center;
    
    /* Positionnement Magique pour centrer parfaitement sous le marqueur */
    position: absolute;
    top: 28px; /* Juste en dessous de la tête du marqueur */
    left: 50%;
    transform: translateX(-50%); /* Centre horizontalement peu importe la largeur */
    
    z-index: 20;
    width: max-content; /* S'adapte à la largeur du contenu (1 ou 2 icônes) */
    pointer-events: none; /* Evite de bloquer le clic sur le marqueur */
}

/* Les indicateurs eux-mêmes (📝 📷) */
.map-indicator.map-note-indicator,
.map-indicator.map-photo-indicator {
    font-size: 2.0em !important; /* Taille ajustée pour être gros mais alignés */
    line-height: 1;
    text-shadow: 0 0 3px white, 0 0 3px white; /* Contour blanc */
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

/* Cache l'ombre par défaut */
.marker-shadow {
    display: none !important;
}

/* --- CORRECTION : Styles pour la galerie photo --- */

/* Le conteneur principal (au lieu de .photos-list-container) */
.existing-photos { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    padding: 10px 0; 
}

/* Chaque bloc photo (au lieu de .photo-item) */
.photo-wrapper { 
    position: relative; 
    width: 100px; 
    height: 100px; 
    border: 1px solid var(--popup-border); 
    border-radius: 4px; 
    /* Important : permet au bouton de suppression absolu de se placer par rapport à la photo */
    overflow: visible !important; 
    transition: filter 0.2s ease; 
    margin-top: 5px; /* Un peu d'espace pour le bouton croix qui dépasse */
    margin-right: 5px;
}

/* L'image à l'intérieur */
.photo-wrapper img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    display: block; 
    border-radius: 4px;
}

.photo-wrapper:hover { 
    filter: brightness(90%); 
    cursor: pointer; 
}

.photo-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    color: white;
    font-weight: bold;
    text-shadow: 0 0 4px black;
    opacity: 0;
    transition: opacity 0.2s;
    background: rgba(0,0,0,0.2);
}

.photo-wrapper:hover .photo-overlay {
    opacity: 1;
}

/* Bouton suppression (géré en partie par le JS en inline, on ajoute un hover) */
.btn-delete-photo-internal:hover {
    background-color: darkred !important;
    transform: scale(1.1);
}

/* --- CORRECTIF Z-INDEX TUTORIEL (À AJOUTER À LA FIN DE STYLE.CSS) --- */
.shepherd-element, 
.shepherd-modal-overlay-container {
    z-index: 22000 !important; /* Force le tuto au-dessus de l'éditeur (20000) */
}

/* Rend les boutons du tutoriel bien cliquables */
.shepherd-footer .shepherd-button {
    cursor: pointer;
}

/* Theme toggle button for sidebar/navbar */
.theme-toggle-btn { background: var(--button-bg); border: 1px solid var(--button-border); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 1.1em; display: flex; align-items: center; justify-content: center; margin: 0 auto; transition: all .2s; padding: 0; line-height: 1; flex-shrink: 0; }
.theme-toggle-btn:hover { background: var(--button-hover-bg); border-color: var(--accent, #4f8ef7); }

#network-status {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 99999;
    text-align: center;
    padding: 12px;
    font-weight: bold;
    font-family: 'Segoe UI', sans-serif;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
    
    /* [AJOUT IMPORTANT] Cache la barre par défaut */
    display: none; 
}

/* --- TUTORIEL : STYLE SPÉCIAL MOBILE --- */
@media (max-width: 768px) {
    /* On force la bulle à s'afficher comme une "carte" en bas de l'écran */
    .shepherd-element {
        position: fixed !important;
        bottom: 20px !important;
        top: auto !important; /* Annule le positionnement automatique */
        left: 50% !important;
        transform: translateX(-50%) !important; /* Centre horizontalement */
        width: 90% !important;
        max-width: 400px !important;
        border-radius: 12px !important;
        margin: 0 !important;
        z-index: 22000 !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
    }

    /* On cache la petite flèche qui pointe vers l'élément (souvent buggée sur mobile) */
    .shepherd-arrow {
        display: none !important;
    }

    /* Titre plus gros pour le doigt */
    .shepherd-header .shepherd-title {
        font-size: 1.2rem !important;
        padding-right: 20px; /* Place pour la croix */
    }

    /* Boutons plus gros et faciles à toucher */
    .shepherd-footer .shepherd-button {
        padding: 12px 20px !important;
        font-size: 1rem !important;
        flex: 1; /* Les boutons prennent toute la largeur */
        text-align: center;
        justify-content: center;
    }

    /* La croix de fermeture bien visible */
    .shepherd-cancel-icon {
        font-size: 1.5rem !important;
        padding: 10px !important;
        color: #999;
    }
}

/* En mode Mobile (écran < 768px) */
@media (max-width: 768px) {
    

    /* Le bouton Déconnexion prend toute la place */
    #btn-logout {
        flex-grow: 1; 
        width: auto !important; 
        margin: 0 !important; 
        justify-content: center; 
    }
}

/* --- UI AUTHENTIFICATION & CHARGEMENT --- */

/* 1. Écran de chargement (Splash Screen) */
#app-loader {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: var(--bg-color);
    z-index: 99999; /* Au-dessus de tout */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid var(--button-primary-bg);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loader-text {
    font-family: 'Segoe UI', sans-serif;
    color: var(--text-color);
    font-size: 1.1em;
    font-weight: 500;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 2. Conteneur de Connexion (Design Carte) */
#login-container {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Fond sombre semi-transparent */
    backdrop-filter: blur(5px); /* Effet de flou moderne */
    z-index: 99990;
    display: flex; /* Géré par JS (flex/none) */
    flex-direction: column;
    justify-content: center; /* Centre verticalement */
    align-items: center;     /* Centre horizontalement */
    animation: fadeIn 0.4s ease-out;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;

    /* --- CENTRAGE PARFAIT --- */
    display: flex;
    flex-direction: column;
    align-items: center; /* Centre les blocs (Bouton Google, Logo) */
    text-align: center;  /* Centre le texte */
}

.login-logo { font-size: 3em; margin-bottom: 15px; display: block; }
.login-card h2 { margin-top: 0; color: #333; font-size: 1.5rem; }
.login-card p { color: #666; margin-bottom: 30px; line-height: 1.5; }

/* Correction pour le bouton Google qui peut être capricieux */
.g_id_signin {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

/* Bouton natif Google (Capacitor) */
.google-native-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
    margin-top: 10px;
    background: white;
    border: 1px solid #dadce0;
    border-radius: 8px;
    color: #3c4043;
    font-family: 'Google Sans', 'Roboto', 'Segoe UI', sans-serif;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: background .2s, box-shadow .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    letter-spacing: .01em;
    line-height: 1.4;
}
.google-native-btn:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.google-native-btn:active {
    background: #e8eaed;
}
.google-native-btn svg {
    flex-shrink: 0;
}

/* Dark mode pour le bouton natif Google */
body.dark-mode .google-native-btn {
    background: #131314;
    border-color: #3c4043;
    color: #e8eaed;
}
body.dark-mode .google-native-btn:hover {
    background: #1f1f1f;
    box-shadow: 0 2px 8px rgba(255,255,255,.1);
}
body.dark-mode .google-native-btn:active {
    background: #2c2c2c;
}

/* Bouton de fallback Google OAuth */
.btn-google-fallback:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2) !important;
}
.btn-google-fallback:active {
    transform: translateY(0) !important;
}

/* Dark mode support */
body.dark-mode #app-loader { background-color: #121212; }
body.dark-mode .login-card { background-color: #1e1e1e; color: #e0e0e0; }
body.dark-mode .login-card h2 { color: white; }
body.dark-mode .login-card p { color: #aaa; }
body.dark-mode .gsi-fallback { border-top-color: #444 !important; }
body.dark-mode .btn-google-fallback { background: #2c2c2c !important; color: #f5f5f5 !important; box-shadow: 0 2px 8px rgba(0,0,0,0.3) !important; }

/* ================================================================
   TOAST NOTIFICATION SYSTEM
   ================================================================ */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
  width: auto;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #1a1d27;
  border: 1px solid #2e3350;
  color: #e2e8f0;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  font-size: .88em;
  line-height: 1.4;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity .3s ease, transform .3s ease;
  cursor: pointer;
  max-width: 100%;
  word-break: break-word;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-icon {
  flex-shrink: 0;
  font-size: 1.2em;
}

.toast-message {
  flex: 1;
  min-width: 0;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #8892b0;
  font-size: 1.2em;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: .6;
  transition: opacity .15s;
}
.toast-close:hover { opacity: 1; }

/* Toast variants */
.toast-success { border-left: 3px solid #22c55e; }
.toast-error   { border-left: 3px solid #ef4444; }
.toast-warning { border-left: 3px solid #f59e0b; }
.toast-info    { border-left: 3px solid #4f8ef7; }

@media (max-width: 768px) {
  #toast-container {
    top: 8px;
    right: 8px;
    left: 8px;
    max-width: none;
  }
  .toast {
    transform: translateY(-20px);
  }
  .toast.toast-visible {
    transform: translateY(0);
  }
}

/* ================================================================
   CONFIRMATION / PROMPT MODAL
   ================================================================ */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .25s ease;
}

.confirm-overlay.confirm-visible {
  opacity: 1;
}

.confirm-box {
  background: #1a1d27;
  border: 1px solid #2e3350;
  border-radius: 14px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  overflow: hidden;
  transform: scale(.95);
  transition: transform .25s ease;
}

.confirm-visible .confirm-box {
  transform: scale(1);
}

.confirm-header {
  padding: 18px 22px 0;
}

.confirm-title {
  margin: 0;
  font-size: 1.05em;
  font-weight: 700;
  color: #e2e8f0;
}

.confirm-body {
  padding: 14px 22px 20px;
}

.confirm-message {
  margin: 0;
  font-size: .92em;
  color: #8892b0;
  line-height: 1.5;
  white-space: pre-line;
}

.confirm-input {
  width: 100%;
  padding: 9px 12px;
  background: #22263a;
  border: 1px solid #2e3350;
  border-radius: 7px;
  color: #e2e8f0;
  font-size: .92em;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.confirm-input:focus {
  border-color: #4f8ef7;
}
.confirm-textarea {
  resize: vertical;
  min-height: 70px;
}

.confirm-footer {
  padding: 14px 22px;
  border-top: 1px solid #2e3350;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.confirm-btn {
  padding: 9px 20px;
  border-radius: 7px;
  font-size: .88em;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
}

.confirm-btn-cancel {
  background: transparent;
  border: 1px solid #2e3350;
  color: #8892b0;
}
.confirm-btn-cancel:hover {
  background: #22263a;
  color: #e2e8f0;
}

.confirm-btn-primary {
  background: #4f8ef7;
  color: white;
}
.confirm-btn-primary:hover {
  background: #3b7de6;
}

.confirm-btn-danger {
  background: #dc3545;
  color: white;
}
.confirm-btn-danger:hover {
  background: #bb2d3b;
}

.confirm-btn-warning {
  background: #f59e0b;
  color: #1a1d27;
}
.confirm-btn-warning:hover {
  background: #d97706;
}

/* ================================================================
   KEYBOARD SHORTCUTS HELP MODAL
   ================================================================ */
.kbd-help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .2s ease;
}
.kbd-help-overlay.kbd-visible {
  opacity: 1;
}
.kbd-help-box {
  background: #1a1d27;
  border: 1px solid #2e3350;
  border-radius: 14px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  overflow: hidden;
  transform: scale(.95);
  transition: transform .2s ease;
}
.kbd-visible .kbd-help-box {
  transform: scale(1);
}
.kbd-help-header {
  padding: 18px 22px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kbd-help-header h3 {
  margin: 0;
  font-size: 1.05em;
  font-weight: 700;
  color: #e2e8f0;
  cursor: default;
}
.kbd-help-close {
  background: none;
  border: none;
  color: #8892b0;
  font-size: 1.4em;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color .15s;
}
.kbd-help-close:hover { color: #e2e8f0; }
.kbd-help-body {
  padding: 14px 22px 20px;
}
.kbd-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #1e2240;
}
.kbd-row:last-of-type {
  border-bottom: none;
}
kbd.kbd-key {
  display: inline-block;
  background: #22263a;
  border: 1px solid #3b4a6b;
  border-radius: 6px;
  padding: 4px 10px;
  font-family: 'Segoe UI', monospace;
  font-size: .85em;
  color: #93c5fd;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: .02em;
  min-width: 80px;
  text-align: center;
}
.kbd-desc {
  font-size: .88em;
  color: #8892b0;
}
.kbd-help-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #2e3350;
  font-size: .78em;
  color: #556080;
  text-align: center;
}
.kbd-help-footer kbd {
  display: inline;
  font-size: .9em;
  padding: 1px 6px;
  min-width: auto;
}

/* ================================================================
   LÉGENDE SUR LA CARTE (bouton flottant + panneau)
   ================================================================ */
#map-legend-btn {
  position: fixed;
  bottom: 24px;
  left: 296px;
  z-index: 1002;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: white;
  border: 1px solid #ccc;
  cursor: pointer;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  transition: left .35s, background .2s, border-color .2s, transform .2s;
  line-height: 1;
  padding: 0;
}
#map-legend-btn:hover { background: #f0f0f0; border-color: #999; transform: scale(1.05); }
body.theme-dark #map-legend-btn, body.dark-mode #map-legend-btn {
  background: #2c2c2c; border-color: #444; color: #f5f5f5;
}
body.theme-dark #map-legend-btn:hover, body.dark-mode #map-legend-btn:hover {
  background: #3a3a3a;
}
body.sidebar-hidden #map-legend-btn { left: 24px; }

#map-legend-panel {
  position: fixed;
  bottom: 72px;
  left: 296px;
  z-index: 1002;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  min-width: 200px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: left .35s, opacity .2s ease, transform .2s ease;
}
#map-legend-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
body.sidebar-hidden #map-legend-panel { left: 24px; }
body.theme-dark #map-legend-panel, body.dark-mode #map-legend-panel {
  background: #2c2c2c; border-color: #444; color: #f5f5f5;
}
#map-legend-panel .legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
  font-size: .82em;
}

/* ================================================================
   LÉGENDE COULEURS (SIDEBAR) — conservé pour la page dashboard
   ================================================================ */
.legend-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--dot-color, #2b7ce9);
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.3);
  box-shadow: 0 0 6px rgba(0,0,0,.25);
}
.legend-dot.legend-pulsate {
  animation: legend-pulse 1.5s ease-in-out infinite;
}
/* Légende dashboard (barre horizontale) */
.dash-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78em;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: help;
}
@keyframes legend-pulse {
  0%, 100% { box-shadow: 0 0 4px var(--dot-color), 0 0 0px transparent; }
  50% { box-shadow: 0 0 10px var(--dot-color), 0 0 20px var(--dot-color); }
}

/* ================================================================
   PHOTO LIGHTBOX (PLEIN ÉCRAN + SWIPE)
   ================================================================ */
#photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
#photo-lightbox.plb-open {
  opacity: 1;
  pointer-events: auto;
}
#photo-lightbox .plb-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.92);
  cursor: pointer;
}
#photo-lightbox .plb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  font-size: 1.6em;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  line-height: 1;
  padding: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#photo-lightbox .plb-close:hover {
  background: rgba(255,255,255,.25);
}
#photo-lightbox .plb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  font-size: 2.4em;
  width: 50px;
  height: 64px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, opacity .2s;
  padding: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  user-select: none;
  -webkit-user-select: none;
}
#photo-lightbox .plb-nav:hover {
  background: rgba(255,255,255,.28);
}
#photo-lightbox .plb-prev { left: 16px; }
#photo-lightbox .plb-next { right: 16px; }
#photo-lightbox .plb-counter {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(0,0,0,.55);
  color: #fff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: .85em;
  font-weight: 600;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  letter-spacing: .04em;
}
#photo-lightbox .plb-img-wrap {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 85vh;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
#photo-lightbox .plb-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 40px rgba(0,0,0,.5);
  transition: transform .25s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
#photo-lightbox .plb-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(0,0,0,.55);
  color: #fff;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: .88em;
  max-width: 60vw;
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
/* Mobile : cacher nav buttons, agrandir close */
/* Offline tile layer (striped background for missing tiles) */
.leaflet-tile {
  /* seamless fallback pour tuiles non disponibles */
}
@media (max-width: 768px) {
  #photo-lightbox .plb-nav { display: none; }
  #photo-lightbox .plb-close { top: 10px; right: 10px; width: 38px; height: 38px; font-size: 1.3em; }
  #photo-lightbox .plb-counter { top: 10px; font-size: .78em; padding: 4px 12px; }
  #photo-lightbox .plb-img { max-width: 96vw; max-height: 80vh; }
}