/**
 * Carte Belgique Interactive - Styles CSS
 * Version: 1.0.0
 */

/* Import de la police Inter */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

/* ========================================
   Container principal
   ======================================== */
.carte-belgique-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

/* Masquer sur mobile */
@media screen and (max-width: 768px) {
    .carte-belgique-container {
        display: none !important;
    }
}

/* ========================================
   Barre de recherche
   ======================================== */
.cbi-search-wrapper {
    position: relative;
    margin-bottom: 30px;
    max-width: 400px;
}

.cbi-search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    font-size: 16px;
    line-height: 1.5;
    border: 2px solid #ddd;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    background-color: #fff;
    color: #333;
}

.cbi-search-input::placeholder {
    color: #999;
    font-weight: 300;
}

.cbi-search-input:focus {
    border-color: #168FFB;
    box-shadow: 0 0 0 3px rgba(22, 143, 251, 0.1);
}

.cbi-search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #999;
    pointer-events: none;
}

/* ========================================
   Liste d'autocomplétion
   ======================================== */
.cbi-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #168FFB;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
}

.cbi-autocomplete.visible {
    display: block;
}

.cbi-autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.cbi-autocomplete-item:last-child {
    border-bottom: none;
}

.cbi-autocomplete-item:hover,
.cbi-autocomplete-item.selected {
    background: #f8f9fa;
}

.cbi-autocomplete-item-code {
    color: #168FFB;
    font-weight: 700;
    margin-right: 8px;
    text-transform: uppercase;
}

.cbi-autocomplete-item-name {
    color: #333;
}

.cbi-autocomplete-item mark {
    background: #fff3cd;
    color: #168FFB;
    font-weight: 600;
    padding: 0 2px;
}

.cbi-autocomplete-empty {
    padding: 12px 15px;
    color: #999;
    font-style: italic;
    text-align: center;
}

/* ========================================
   Layout carte + liste côte à côte
   ======================================== */
.cbi-content-wrapper {
    display: block;
}

.cbi-map-section {
    flex: 0 0 100% !important;
    max-width: 100% !important;
}

.cbi-list-section {
    display: none !important;
}

/* ========================================
   Container de la carte
   ======================================== */
.cbi-map-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
    max-height: 800px;
    overflow: hidden;
}

.cbi-carte {
    width: 100%;
    height: auto;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.cbi-carte.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.cbi-carte.loading::before {
    content: 'Chargement de la carte...';
    font-size: 16px;
    color: #168FFB;
}

.cbi-carte svg {
    width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   Styles des provinces
   ======================================== */
.cbi-carte svg path[id^="prov_"] {
    fill: #8ad;
    stroke: #fff;
    stroke-width: 0.5;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

/* État hover */
.cbi-carte svg path[id^="prov_"]:hover,
.cbi-carte svg path[id^="prov_"].highlighted {
    fill: #DC143C !important;
    stroke: #fff;
    stroke-width: 1.5;
    filter: drop-shadow(0 4px 8px rgba(220, 20, 60, 0.3));
}

/* Effet de focus pour l'accessibilité */
.cbi-carte svg path[id^="prov_"]:focus {
    fill: #DC143C;
    stroke: #fff;
    stroke-width: 2;
    outline: none;
}


/* Liste de provinces sous la carte */
#cbi-provinces-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

#cbi-provinces-list .cbi-province-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
}

#cbi-provinces-list .cbi-province-item:hover {
    border-color: #168FFB;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 143, 251, 0.2);
}

#cbi-provinces-list .cbi-province-item.highlighted {
    border-color: #168FFB;
    background: #E8F4FD;
}

#cbi-provinces-list .cbi-province-item.dimmed {
    opacity: 0.4;
}

#cbi-provinces-list .cbi-province-item.pulse {
    animation: pulse 0.5s ease-in-out;
}

#cbi-provinces-list .cbi-province-code {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background: #168FFB;
    color: white;
    font-weight: bold;
    border-radius: 50%;
    margin-right: 15px;
    font-size: 14px;
}

#cbi-provinces-list .cbi-province-name {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
}

#cbi-provinces-list .cbi-province-item::after {
    content: '→';
    font-size: 20px;
    color: #168FFB;
    margin-left: 10px;
    transition: transform 0.3s ease;
}

#cbi-provinces-list .cbi-province-item:hover::after {
    transform: translateX(5px);
}
    outline: none;
}

/* Enlever tout outline au clic */
.cbi-carte svg path[id^="prov_"]:focus-visible {
    outline: none;
}

/* Provinces avec opacité réduite (lors de la recherche) */
.cbi-carte svg path[id^="prov_"].dimmed {
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

/* ========================================
   Tooltip
   ======================================== */
.cbi-tooltip {
    position: fixed;
    padding: 10px 15px;
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.cbi-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.cbi-tooltip-code {
    color: #DC143C;
    font-weight: 700;
    margin-right: 5px;
    text-transform: uppercase;
}

.cbi-tooltip-name {
    color: #fff;
}

/* Flèche du tooltip */
.cbi-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
}

/* ========================================
   Animations
   ======================================== */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.cbi-carte svg path[id^="prov_"].pulse {
    animation: pulse 0.5s ease;
}

/* ========================================
   États de chargement
   ======================================== */
.cbi-carte.loading {
    opacity: 0.5;
    pointer-events: none;
}

.cbi-carte.loading::after {
    content: 'Chargement...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #168FFB;
    font-weight: 600;
}

/* ========================================
   Responsive
   ======================================== */
@media screen and (max-width: 1024px) {
    .carte-belgique-container {
        padding: 15px;
    }
    
    .cbi-search-input {
        font-size: 15px;
    }
    
    .cbi-tooltip {
        font-size: 13px;
    }
}

@media screen and (max-width: 768px) {
    /* Déjà masqué via le container */
}

/* ========================================
   Accessibilité
   ======================================== */
.cbi-carte svg path[id^="prov_"]:focus-visible {
    outline: none;
    fill: #168FFB;
    stroke: #fff;
    stroke-width: 2;
}

/* Mode contraste élevé */
@media (prefers-contrast: high) {
    .cbi-carte svg path[id^="prov_"] {
        stroke-width: 1;
    }
    
    .cbi-carte svg path[id^="prov_"]:hover,
    .cbi-carte svg path[id^="prov_"].highlighted {
        stroke-width: 2.5;
    }
}

/* Mode mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    .cbi-carte svg path[id^="prov_"],
    .cbi-tooltip,
    .cbi-search-input {
        transition: none !important;
        animation: none !important;
    }
}

/* ========================================
   Print styles
   ======================================== */
@media print {
    .cbi-search-wrapper {
        display: none;
    }
    
    .cbi-tooltip {
        display: none;
    }
    
    .cbi-carte svg path[id^="prov_"] {
        fill: #fff !important;
        stroke: #000 !important;
    }
}
