/**
 * CC Map Info Réseau - Frontend Styles
 *
 * @package CC_Map_Info_Reseau
 */

/* Map Container */
.cc-map-info-reseau-wrapper {
    position: relative;
    width: 100%;
}

.cc-map-info-reseau-container {
    width: 100%;
    height: 600px;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* Ensure Leaflet controls are visible */
.cc-map-info-reseau-container .leaflet-control-zoom {
    z-index: 1000;
}

.cc-map-info-reseau-container .leaflet-control-attribution {
    z-index: 1000;
}

/* Custom Markers */
.cc-map-marker {
    transition: transform 0.2s ease;
}

.cc-map-marker:hover {
    transform: scale(1.1);
    z-index: 1000 !important;
}

/* Popup Styles */
.cc-map-popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    min-width: 200px;
    max-width: 300px;
}

.cc-map-popup-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.cc-map-popup-description {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.cc-map-popup-status {
    margin: 10px 0 0 0;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 14px;
}

.cc-map-popup-status strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
}

.cc-map-popup-status-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 5px;
}

.cc-map-popup-status-name {
    font-weight: 500;
    vertical-align: middle;
}

/* Status-specific colors */
.cc-map-status-en-attente,
.cc-map-marker-en-attente {
    color: #ff9800;
}

.cc-map-status-en-cours,
.cc-map-marker-en-cours {
    color: #2196f3;
}

.cc-map-status-resolu,
.cc-map-marker-resolu {
    color: #4caf50;
}

.cc-map-status-urgent,
.cc-map-marker-urgent {
    color: #f44336;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-content {
    margin: 15px;
}

.leaflet-popup-tip {
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
}

/* Loading State */
.cc-map-info-reseau-container.loading {
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-map-info-reseau-container.loading::before {
    content: "Chargement de la carte...";
    color: #666;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .cc-map-info-reseau-container {
        height: 400px;
    }
    
    .cc-map-popup {
        max-width: 250px;
    }
    
    .cc-map-popup-title {
        font-size: 14px;
    }
    
    .cc-map-popup-description {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .cc-map-info-reseau-container {
        height: 300px;
    }
    
    .cc-map-popup {
        max-width: 200px;
    }
}

/* Accessibility */
.cc-map-info-reseau-container:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* ── Zone d'impact : popup enrichi ──────────────────────────────────────── */

.cc-zone-popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    min-width: 220px;
    max-width: 310px;
}

.cc-zone-popup-title {
    font-size: 14px;
    font-weight: 700;
    color: #222;
    margin: 0 0 8px 0;
    border-bottom: 2px solid #ff8000;
    padding-bottom: 6px;
}

.cc-zone-popup-zone,
.cc-zone-popup-periode,
.cc-zone-popup-type {
    margin: 4px 0;
    color: #444;
    font-size: 12px;
}

.cc-zone-popup-icon {
    margin-right: 4px;
}

.cc-zone-popup-desc {
    margin: 8px 0;
    color: #555;
    font-size: 12px;
    font-style: italic;
    border-left: 3px solid #eee;
    padding-left: 8px;
}

.cc-popup-actions {
    margin-top: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Boutons Bootstrap-like auto-portés (pas de dépendance Bootstrap) */
.cc-btn {
    display: inline-block;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    border: 1px solid transparent;
    border-radius: 4px;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .15s ease-in-out, border-color .15s ease-in-out;
    box-sizing: border-box;
}

.cc-btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff !important;
}

.cc-btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    color: #fff !important;
}

.cc-btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: #fff !important;
}

.cc-btn-secondary:hover {
    background-color: #5c636a;
    border-color: #565e64;
    color: #fff !important;
}

/* ── Indicateur CTRL+scroll ──────────────────────────────────────────────── */

.cc-map-scroll-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .72);
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    transition: opacity .4s ease;
    opacity: 1;
}

.cc-map-scroll-hint--hide {
    opacity: 0;
}

.cc-map-scroll-hint kbd {
    display: inline-block;
    padding: 1px 6px;
    background: rgba(255,255,255,.2);
    border: 1px solid rgba(255,255,255,.4);
    border-radius: 3px;
    font-family: inherit;
    font-size: 12px;
}

.cc-zone-popup-wrapper .leaflet-popup-content-wrapper {
    border-radius: 6px;
}

/* Badge incident/normal sur les popups installations */
.cc-map-popup-incident-badge {
    margin-top: 8px;
    padding: 4px 8px;
    background: #fff3cd;
    color: #856404;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.cc-map-popup-normal-badge {
    margin-top: 8px;
    padding: 4px 8px;
    background: #d4edda;
    color: #155724;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* ── Tooltip de zone (fallback sans infos post) ─────────────────────────── */

.cc-zone-tooltip {
    background: rgba(0,0,0,.7);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
}

/* Print Styles */
@media print {
    .cc-map-info-reseau-container {
        height: 500px !important;
        page-break-inside: avoid;
    }
    
    .leaflet-control-zoom {
        display: none;
    }
}
