/* ============ SIG Saint-Jean-Cap-Ferrat ============ */

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

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
}

/* ---------- Bandeau d'erreur BDD ---------- */
.bandeau-erreur {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 3000;
    background: #c0392b;
    color: #fff;
    padding: 10px 16px;
    font-size: 14px;
}

/* ---------- Carte ---------- */
#map {
    position: fixed;
    inset: 0;
    z-index: 1;
}

/* ---------- Boutons flottants ---------- */
#btn-menu, #btn-retour {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 2000;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 10px;
    background: #2c3e50;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
    transition: background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
#btn-menu:hover, #btn-retour:hover { background: #1a252f; }

#btn-panneau {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 2000;
    height: 48px;
    padding: 0 18px;
    border: none;
    border-radius: 10px;
    background: #2c3e50;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
#btn-panneau:hover { background: #1a252f; }

/* Décale le zoom Leaflet sous les boutons */
.leaflet-top.leaflet-left { top: 72px; }

/* ---------- Menu coulissant (carte publique) ---------- */
#menu {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 300px;
    max-width: 85vw;
    z-index: 2100;
    background: #fff;
    padding: 76px 20px 20px;
    box-shadow: 4px 0 16px rgba(0,0,0,.25);
    transform: translateX(-105%);
    transition: transform .3s ease;
    overflow-y: auto;
}
#menu.ouvert { transform: translateX(0); }

#menu h2, #panneau h3 {
    font-size: 17px;
    margin-bottom: 14px;
    color: #2c3e50;
}
#menu hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 10px 0;
}

.ligne {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
}
.ligne:hover { background: #f2f5f7; }
.ligne input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #2c3e50;
    cursor: pointer;
}
.ligne-tout { font-weight: 600; }
.ligne .puce, .point-ligne .puce {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}
.ligne .nb {
    margin-left: auto;
    font-size: 12px;
    color: #7f8c8d;
}

.compteur-total { font-size: 13px; color: #7f8c8d; text-align: center; }
.chargement, .erreur { font-size: 14px; color: #7f8c8d; }
.erreur { color: #c0392b; }

/* ---------- Option déplacement ---------- */
.ligne-edition input[type="checkbox"] { accent-color: #e67e22; }
.ligne-edition { background: #fdf3e7; }
.ligne-edition:hover { background: #fbe9d2; }

.aide-edition {
    font-size: 12.5px;
    color: #8a5220;
    background: #fdf3e7;
    border-left: 3px solid #e67e22;
    border-radius: 0 8px 8px 0;
    padding: 8px 10px;
    margin-top: 6px;
    line-height: 1.5;
}
.aide-edition #nb-modifs { display: block; font-weight: 600; margin-top: 4px; }

/* ---------- Marqueurs ---------- */
.marqueur { background: none; border: none; }
.pin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.45);
    cursor: pointer;
    transition: transform .15s;
}
.pin:hover { transform: rotate(-45deg) scale(1.15); }
.pin .emo { transform: rotate(45deg); font-size: 15px; color: #fff; line-height: 1; }

/* Repère temporaire (admin) */
.temporaire .pin {
    border-style: dashed;
    animation: pulsation 1.4s infinite;
}

/* Mode déplacement (carte publique) */
#map.edition .pin {
    cursor: grab;
    outline: 3px solid rgba(230, 126, 34, .7);
    outline-offset: 2px;
    animation: pulsation 1.4s infinite;
}
@keyframes pulsation {
    0%, 100% { outline-color: rgba(230, 126, 34, .7); }
    50%      { outline-color: rgba(230, 126, 34, .2); }
}

/* ---------- Toast ---------- */
#toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translate(-50%, 80px);
    z-index: 2500;
    background: #2c3e50;
    color: #fff;
    padding: 12px 22px;
    border-radius: 24px;
    font-size: 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
    opacity: 0;
    transition: transform .3s ease, opacity .3s ease;
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
}
#toast.visible { transform: translate(-50%, 0); opacity: 1; }
#toast.ok   { background: #27ae60; }
#toast.ko   { background: #c0392b; }
#toast.info { background: #2c3e50; }

/* ---------- Fiche overlay (carte publique) ---------- */
#fiche {
    position: fixed;
    top: 80px;
    right: -420px;
    width: 380px;
    max-width: 90vw;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    z-index: 2200;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0,0,0,.35);
    padding: 20px;
    transition: right .3s ease;
}
#fiche.visible { right: 16px; }

#fiche .badge {
    display: inline-block;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
}
#fiche h3 { font-size: 19px; color: #2c3e50; margin-bottom: 10px; padding-right: 26px; }
#fiche img { width: 100%; border-radius: 10px; margin-bottom: 10px; }
#fiche p { font-size: 14px; color: #444; margin-bottom: 8px; line-height: 1.5; }
#fiche .meta, #panneau .meta { font-size: 12.5px; color: #7f8c8d; }
#btn-fermer-fiche {
    position: absolute;
    top: 12px; right: 12px;
    border: none;
    background: #ecf0f1;
    color: #2c3e50;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
}
#btn-fermer-fiche:hover { background: #bdc3c7; }

/* ============ Page d'administration ============ */

#panneau {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 420px;
    max-width: 94vw;
    z-index: 2300;
    background: #fff;
    box-shadow: -4px 0 16px rgba(0,0,0,.25);
    transform: translateX(105%);
    transition: transform .3s ease;
    display: flex;
    flex-direction: column;
}
#panneau.ouvert { transform: none; }

.onglets {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid #eee;
}
.onglet {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: #ecf0f1;
    color: #2c3e50;
    font-size: 14px;
    cursor: pointer;
}
.onglet.actif { background: #2c3e50; color: #fff; }
#btn-fermer-panneau {
    width: 40px;
    border: none;
    border-radius: 8px;
    background: #ecf0f1;
    cursor: pointer;
    font-size: 15px;
}
#btn-fermer-panneau:hover { background: #bdc3c7; }

.vue { display: none; flex: 1; overflow-y: auto; padding: 16px; }
.vue.actif { display: block; }

/* Bloc position choisie */
.position {
    background: #f7f9fa;
    border: 1px dashed #bdc3c7;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
}
.position p:first-child { font-size: 13.5px; color: #555; line-height: 1.5; margin-bottom: 8px; }

/* Formulaire */
#form-point input,
#form-point select,
#form-point textarea,
#recherche {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid #d5dbdb;
    border-radius: 8px;
    font-size: 14.5px;
    font-family: inherit;
}
#form-point input:focus,
#form-point select:focus,
#form-point textarea:focus,
#recherche:focus {
    outline: 2px solid #2980b9;
    border-color: transparent;
}
#form-point textarea { resize: vertical; }

.actions-form { display: flex; gap: 8px; }

.btn {
    border: none;
    border-radius: 8px;
    padding: 11px 16px;
    font-size: 14.5px;
    cursor: pointer;
    color: #fff;
}
.btn-gps     { background: #e67e22; width: 100%; }
.btn-gps:hover { background: #ca6f1e; }
.btn-valider { background: #27ae60; flex: 1; }
.btn-valider:hover { background: #1e8449; }
.btn-annuler { background: #95a5a6; }
.btn-annuler:hover { background: #7f8c8d; }

/* Liste des points */
.point-ligne {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-bottom: 1px solid #f0f0f0;
}
.point-ligne:hover { background: #f7f9fa; }
.point-ligne .infos { flex: 1; min-width: 0; }
.point-ligne .infos strong {
    display: block;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.point-ligne .infos small { color: #7f8c8d; font-size: 11.5px; }
.actions-ligne { display: flex; gap: 4px; }
.mini {
    width: 34px; height: 34px;
    border: none;
    border-radius: 8px;
    background: #ecf0f1;
    cursor: pointer;
    font-size: 15px;
}
.mini:hover { background: #d5dbdb; }
.mini.danger:hover { background: #f5b7b1; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
    #fiche {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0 !important;
        width: 100%;
        max-width: none;
        max-height: 55vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(110%);
        transition: transform .3s ease;
    }
    #fiche.visible { transform: translateY(0); }

    #panneau {
        top: auto;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: none;
        height: 72vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(105%);
    }
    #panneau.ouvert { transform: none; }
}
