/* Styles complémentaires pour la carte — chargés uniquement quand le shortcode est utilisé */

/* Correction z-index Leaflet dans Elementor/Astra */
.leaflet-pane,
.leaflet-top,
.leaflet-bottom {
    z-index: 400;
}

/* Popup plus aérée */
.leaflet-popup-content {
    margin: 14px 16px;
}

/* Attribution */
.leaflet-control-attribution {
    font-size: 10px;
}

/* =========================================
   Toolbar (légende + toggle)
   ========================================= */
.pel-map-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Bouton toggle points d'intérêt */
.pel-btn-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 6px 14px;
    border: 2px solid #005380;
    border-radius: 4px;
    background: #005380;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.pel-btn-toggle:hover {
    background: #00324d;
    border-color: #00324d;
}
.pel-btn-toggle.pel-pois-hidden {
    background: #fff;
    color: #005380;
}
.pel-btn-toggle.pel-pois-hidden:hover {
    background: #f0f5fa;
}

/* =========================================
   Section tronçons
   ========================================= */
.pel-troncons-section {
    margin-top: 2rem;
}
.pel-troncons-heading {
    font-size: 1rem;
    font-weight: 700;
    color: #005380;
    margin: 0 0 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pel-troncons-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.pel-troncons-table th {
    text-align: left;
    padding: 6px 10px;
    border-bottom: 2px solid #e5e7eb;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.pel-troncons-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.pel-troncon-num {
    width: 1%;
    white-space: nowrap;
    padding-right: 6px !important;
}
.pel-troncon-num > * {
    vertical-align: middle;
}
.pel-troncon-num-val {
    font-variant-numeric: tabular-nums;
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Bouton œil — afficher/masquer un tronçon sur la carte */
.pel-btn-eye {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: #005380;
    padding: 2px 4px 2px 0;
    opacity: 1;
    transition: opacity .15s, color .15s;
    vertical-align: middle;
}
.pel-btn-eye:hover {
    opacity: 0.7;
}
.pel-btn-eye.pel-eye-off {
    color: #9ca3af;
}
.pel-troncon-row[data-available="1"] {
    cursor: pointer;
}
.pel-troncon-row[data-available="1"]:hover td {
    background: #f0f5fa;
}
.pel-troncon-row[data-available="1"]:focus-visible {
    outline: 2px solid #005380;
    outline-offset: -2px;
}
.pel-troncon-row.pel-troncon-active td {
    background: #dbeafe;
}
.pel-troncon-unavailable td {
    color: #9ca3af;
    font-style: italic;
}
.pel-troncon-totals td {
    padding: 8px 10px;
    border-top: 2px solid #e5e7eb;
    font-weight: 700;
    font-size: 0.875rem;
}
.pel-totals-label {
    color: #374151;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}
.pel-stat {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.pel-stat-loading {
    color: #d1d5db;
}

/* =========================================
   Panneau profil de dénivelé
   ========================================= */
.pel-elevation-panel {
    margin-top: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}
.pel-elevation-hidden {
    display: none;
}
.pel-elevation-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 12px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}
.pel-elevation-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #111827;
    flex: 1;
}
.pel-elevation-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: #6b7280;
    padding: 2px 8px;
    line-height: 1;
    border-radius: 3px;
}
.pel-elevation-close:hover {
    background: #e5e7eb;
    color: #111;
}
.pel-elevation-chart {
    padding: 0.75rem 0.75rem 0.25rem;
}
.pel-elevation-chart svg {
    display: block;
    width: 100%;
    height: auto;
}
.pel-chart-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
    font-size: 0.8rem;
    color: #374151;
    padding: 0.5rem 0 0.25rem;
}
.pel-chart-stats strong {
    font-weight: 700;
}
.pel-chart-msg {
    color: #9ca3af;
    font-style: italic;
    font-size: 0.875rem;
    padding: 0.5rem 0;
    margin: 0;
}
.pel-chart-error {
    color: #b91c1c;
}

/* Bouton / lien téléchargement GPX */
.pel-btn-gpx {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 3px 9px;
    border: 1.5px solid #005380;
    border-radius: 4px;
    background: #fff;
    color: #005380;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, color .15s;
    line-height: 1.4;
}
.pel-btn-gpx:hover {
    background: #005380;
    color: #fff;
}
.pel-troncon-dl {
    width: 1%;
    white-space: nowrap;
    padding-right: 12px !important;
}
.pel-troncon-dl-na {
    color: #9ca3af;
}
/* Bouton GPX dans l'en-tête du panneau de profil */
.pel-elevation-dl {
    flex-shrink: 0;
}

/* Vignette cliquable dans le popup */
.pel-popup-thumb {
    cursor: zoom-in;
    transition: opacity .15s;
    display: block;
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}
.pel-popup-thumb:hover {
    opacity: .88;
}

/* =========================================
   Lightbox
   ========================================= */
#pel-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}
#pel-lightbox.pel-lb-visible {
    display: flex;
}

.pel-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .88);
    cursor: zoom-out;
}

.pel-lb-content {
    position: relative;
    z-index: 1;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pel-lb-img {
    max-width: 92vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    display: block;
    object-fit: contain;
}

.pel-lb-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    opacity: .8;
    transition: opacity .15s;
}
.pel-lb-close:hover {
    opacity: 1;
}
