/**
 * Météo Centre - Frontend Carte CSS
 * @version 3.1.0 - Nettoyage: suppression styles popup obsolètes
 *
 * Contenu : Map container, Contrôles, Popup Leaflet (minimaliste), Légende
 * Chargé : Uniquement si bloc mcpg/carte-meteo présent
 *
 * CHANGEMENTS v3.1:
 * - ✅ Suppression des styles .mcpg-popup-main, .mcpg-popup-desc, .mcpg-popup-details, etc.
 * - ✅ La popup réutilise maintenant .mcpg-hour-card (core.css)
 * - ✅ Conservation uniquement du wrapper Leaflet et du bouton
 */

/* ========================================================================
 * WRAPPER CARTE
 * ======================================================================== */

.mcpg-carte-wrapper {
    background: #fff;
    border-radius: var(--mcpg-radius);
    box-shadow: var(--mcpg-shadow);
    overflow: hidden;
    position: relative;
}

.alignfull .mcpg-carte-wrapper {
    border-radius: 0;
}

/* ========================================================================
 * MAP CONTAINER
 * ======================================================================== */

.mcpg-map-container {
    width: 100%;
    min-height: 400px;
    position: relative;
    z-index: 1;
}

/* ========================================================================
 * CONTRÔLES FLOTTANTS
 * ======================================================================== */

.mcpg-floating-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--mcpg-radius-sm);
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    width: auto;
    max-width: 280px;
    transition: var(--mcpg-transition);
}

.mcpg-control-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    white-space: nowrap;
}

.mcpg-control-row:last-child {
    margin-bottom: 0;
}

.mcpg-control-row label {
    font-size: 10px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 35px;
    flex-shrink: 0;
}

.mcpg-control-buttons {
    display: flex;
    gap: 3px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.mcpg-control-prev,
.mcpg-control-next {
    width: 26px;
    height: 26px;
    padding: 0;
    background: #fff;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    user-select: none;
}

.mcpg-control-prev:hover,
.mcpg-control-next:hover {
    background: #f4f4f4;
    border-color: rgba(0, 0, 0, 0.3);
}

.mcpg-control-prev:active,
.mcpg-control-next:active {
    background: #e8e8e8;
    transform: scale(0.95);
}

.mcpg-control-prev:disabled,
.mcpg-control-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #fafafa;
}

.mcpg-floating-controls select {
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mcpg-floating-controls select:focus {
    outline: none;
    border-color: var(--mcpg-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Container des contrôles en loading */
.mcpg-floating-controls.is-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Select en loading - effet shimmer */
.mcpg-floating-controls select.is-loading {
    cursor: wait;
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    color: transparent;
}

/* Animation shimmer */
@keyframes loading-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Boutons désactivés pendant le loading */
.mcpg-floating-controls button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #fafafa;
}

/* Alternative : spinner sur le container */
.mcpg-floating-controls.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top-color: var(--mcpg-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Hover désactivé pendant le loading */
.mcpg-floating-controls.is-loading select:hover,
.mcpg-floating-controls.is-loading button:hover {
    border-color: rgba(0, 0, 0, 0.2);
    background: #f0f0f0;
    transform: none;
}

/* ========================================================================
 * POPUP LEAFLET (Styles minimalistes)
 * La popup réutilise maintenant .mcpg-hour-card (défini dans core.css)
 * ======================================================================== */

.leaflet-popup-pane {
    z-index: 700;
}

.mcpg-popup .leaflet-popup-content-wrapper {
    border-radius: var(--mcpg-radius);
    padding: 0;
}

.mcpg-popup .leaflet-popup-content {
    margin: 0;
    width: 20em !important; /* 320px en fluide */
    max-width: 90vw; /* Ne jamais dépasser 90% de l'écran */
}

.leaflet-bottom {
    padding-bottom: 10px;
}

/* Container de la popup */
.mcpg-popup-content {
    padding: 20px;
}

.mcpg-popup-content h3 {
    margin: 0 0 15px;
    color: var(--mcpg-dark);
    text-align: center;
}

/* ✅ La card horaire s'affiche dans la popup */
.mcpg-popup-content .mcpg-hour-card {
    margin-bottom: 15px;
    /* Hérite tous les styles de core.css */
}

/* Bouton "Voir les prévisions 7 jours" */
.mcpg-btn-details {
    width: 100%;
    padding: 10px;
    background: var(--mcpg-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--mcpg-transition);
}

.mcpg-btn-details:hover {
    background: var(--mcpg-primary-dark);
}

/* ========================================================================
 * LÉGENDE / CRÉDITS
 * ======================================================================== */

.mcpg-map-legend {
    padding: 12px 20px;
    background: var(--mcpg-light);
    border-top: 1px solid var(--mcpg-border);
    text-align: center;
}

.mcpg-legend-credits {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}

.mcpg-legend-credits a {
    color: var(--mcpg-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--mcpg-transition);
}

.mcpg-legend-credits a:hover {
    color: var(--mcpg-primary-dark);
    text-decoration: underline;
}

.mcpg-legend-separator {
    color: #ccc;
    font-weight: bold;
}

/* ========================================================================
 * MARQUEURS
 * ======================================================================== */

.mcpg-marker {
    background: transparent !important;
    border: none !important;
}
