/**
 * Mappa Minestudio 2025 - Stili CSS
 * 
 * Questo file contiene gli stili base del plugin e importa
 * le librerie CSS esterne necessarie per i provider mappa
 */

/* ========================================
   IMPORTAZIONE LIBRERIE ESTERNE
   ======================================== */

/* Mapbox CSS - Versione 2.13.0 */
@import url('https://api.mapbox.com/mapbox-gl-js/v2.13.0/mapbox-gl.css');

/* ========================================
   STILI BASE DEL PLUGIN
   ======================================== */

.mappa-minestudio-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.mappa-map-area {
    width: 100%;
    position: relative;
    min-height: 600px;
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mappa-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
    z-index: 10;
}

.mappa-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #242424;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mappa-map {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
}
.mapboxgl-canvas {
    width: 100%;
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
}

/* ========================================
   LISTA LOCALITÀ
   ======================================== */

.mappa-localities-list {
   width: 100%;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #242424;
    border-radius:14px;
    padding: 15px;
}

.mappa-localities-list h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px;
}

.localities-container {
    max-height: 320px;
    overflow-y: auto;
}


/* ========================================
   CITTÀ (VISIBILI NELLA LISTA)
   ======================================== */

.city-item {
    display: inline-block;
    padding: 4px 16px;
    border: 1px solid #242424;
    border-radius: 12px;
    margin-bottom: 8px;
    margin-right: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}


.city-item:hover {
    background-color: #242424;
    color: #fff;
}
.dark-mode .city-item:hover {
    background-color: #242424;
    color: #fff;
}   
.dark-mode:lang(it) .city-item:hover {
    background-color: #242424;
    color: #fff;
}

.city-item.active {
    background-color: #242424;
    color: #fff;

   
}

.city-item.selected {
    background-color: #242424;
    color: #fff;
}

.city-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.city-header i {
    font-size: 16px;
    color: #0073aa;
}

.city-item:hover .city-header i,
.city-item.active .city-header i,
.city-item.selected .city-header i {
    color: #fff;
}

.city-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    border: none;
    padding: 0;
}

.dark-mode .city-header h3 {
    color: #333 !important;
}
.dark-mode:lang(it) .city-header h3 {
    color: #333 !important;
}
.city-item:hover .city-header h3,
.city-item.active .city-header h3,
.city-item.selected .city-header h3 {
    color: #fff !important;
}
.dark-mode .city-item:hover .city-header h3,
.dark-mode .city-item.active .city-header h3,
.dark-mode .city-item.selected .city-header h3 {
    color: #fff !important;
}
.dark-mode:lang(it) .city-item:hover .city-header h3,
.dark-mode:lang(it) .city-item.active .city-header h3,
.dark-mode:lang(it) .city-item.selected .city-header h3 {
    color: #fff !important;
}

.dark-mode:lang(it) .city-header h3 {
    color: #333 !important;
}
.city-item.selected .city-header h3 {
    color: #fff !important;
}


.city-count {
    font-size: 11px;
    color: #666;
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

.city-item:hover .city-count,
.city-item.active .city-count,
.city-item.selected .city-count {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}





.locality-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.locality-header i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.locality-header h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.locality-address {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.locality-description {
    margin: 5px 0;
    color: #777;
    font-size: 13px;
    font-style: italic;
    line-height: 1.4;
}

.locality-studio {
    margin: 5px 0;
    color: #0073aa;
    font-size: 14px;
    font-weight: 500;
}

.locality-links {
    margin: 10px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.locality-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.locality-link:hover {
    background: #e0e0e0;
    color: #000;
    text-decoration: none;
}

.locality-link.website-link:hover {
    background: #e3f2fd;
    color: #1976d2;
}

.locality-link.article-link:hover {
    background: #f3e5f5;
    color: #7b1fa2;
}

.locality-link i {
    font-size: 11px;
}

.locality-coordinates {
    margin-top: 8px;
    color: #999;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

/* ========================================
   STILI SEZIONE STUDIO SELEZIONATO
   ======================================== */

.locality-selected {
    margin-top: 30px;
    transition: all 0.3s ease;
}

.locality-selected p {
    margin: 3px 0;
    font-size: 16px;
    line-height: 1.1;
}

.locality-selected p:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.locality-selected strong {
    font-weight: 600;
}

.selected-link {
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.selected-link:hover {
    text-decoration: underline;
}

/* Animazione di entrata per la sezione selezionata */
.locality-selected {
    max-width: 400px;
    animation: slideInUp 0.3s ease-out;
}

.studio-value {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

.address-value__item {
    display: block;
    margin-bottom: 30px;
}

.address-value__item strong {
    font-weight: 600;
}
.dark-mode .address-value span {
    color: #000 !important;
}
.dark-mode:lang(it) .address-value span {
    color: #000 !important;
}

.studio-link {
    color: #242424;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.studio-link:hover {
    color: #FC224C;
}
.dark-mode a.studio-link:link {
    color: #000 !important;
}
.dark-mode a.studio-link:hover {
    color: #000 !important;
}

.dark-mode a.studio-link:hover {
    color: #FC224C !important;
}
.dark-mode:lang(it) a.studio-link {
    color: #000 !important;
}
.dark-mode:lang(it) a.studio-link:link {
    color: #000 !important;
}

.dark-mode:lang(it) a.studio-link:hover {
    color: #FC224C !important;
}
.dark-mode:lang(it) a.studio-link:link:hover {
    color: #FC224C !important;
}


a.article-link {
    color: #242424;
    line-height: 1.3;
    border-bottom: 1px solid #242424;
    transition: color 0.2s ease;
    font-weight: 500;
    font-size: 14px;
    margin-top: 10px;
    text-transform: uppercase;
    display: inline-block;
}

.article-link:hover {
    color: #FC224C;
    border-bottom: 1px solid #FC224C;
}
.dark-mode a.article-link {
    color: #000 !important;
}
.dark-mode:lang(it) a.article-link {
    color: #000 !important;
}
.dark-mode a.article-link:link {
    color: #000 !important;
}
.dark-mode:lang(it) a.article-link:link {
    color: #000 !important;
}
.dark-mode a.article-link:hover {
    color: #FC224C !important;
    border-bottom: 1px solid #FC224C;
} 
.dark-mode a.article-link:link:hover {
    color: #FC224C !important;
    border-bottom: 1px solid #FC224C;
}   
.dark-mode:lang(it) a.article-link:hover {
    color: #FC224C !important;
    border-bottom: 1px solid #FC224C !important;
}
.dark-mode:lang(it) a.article-link:link:hover {
    color: #FC224C !important;
    border-bottom: 1px solid #FC224C !important;
}


@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   STILI POPUP MAPBOX
   ======================================== */

.mappa-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 250px;
    padding-right: 20px;
}

.mappa-popup h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #000 !important;
}

.mappa-popup .studio-name {
    margin: 5px 0;
    font-size: 14px;
    font-weight: 600;
    color: #000 !important;
}

.mappa-popup .address {
    margin: 5px 0;
    font-size: 13px;
    color: #000 !important;
}

.mappa-popup .description {
    margin: 5px 0;
    font-size: 12px;
    line-height: 1.4;
    color: #000 !important;
}

.popup-links {
    margin: 10px 0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: #000 !important;
}
.dark-mode .popup-links a:link {
    color: #000 !important;
}
.   dark-mode:lang(it) .popup-links a:link {
    color: #000 !important;
}

a.popup-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding-bottom: 4px;
    line-height: 1.3;
    border-bottom: 1px solid #000 !important;
    color: white;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.popup-link:hover, .popup-link:focus, .popup-link:active, .popup-link:visited, .popup-link {
    background: none !important;
    outline: none;
    color: #000 !important;

   /* background: #e0e0e0;
    color: #000;
    text-decoration: none;
    */
}
.dark-mode a.popup-link:hover, .dark-mode a.popup-link:focus, .dark-mode a.popup-link:active, .dark-mode a.popup-link:visited, .dark-mode a.popup-link {
    background: none !important;
    outline: none;
    color: #000 !important;

   /* background: #e0e0e0;
    color: #000;
    text-decoration: none;
    */
}
.dark-mode:lang(it) a.popup-link:hover, .dark-mode:lang(it) a.popup-link:focus, .dark-mode:lang(it) a.popup-link:active, .dark-mode:lang(it) a.popup-link:visited, .dark-mode:lang(it) a.popup-link {
    background: none !important;
    outline: none;
    color: #000 !important;

   /* background: #e0e0e0;
    color: #000;
    text-decoration: none;
    */
}
.dark-mode:lang(it) a.popup-link:link:hover, .dark-mode:lang(it) a.popup-link:link:focus, .dark-mode:lang(it) a.popup-link:link:active, .dark-mode:lang(it) a.popup-link:link:visited, .dark-mode:lang(it) a.popup-link:link {
    background: none !important;
    outline: none;
    color: #000 !important;

   /* background: #e0e0e0;
    color: #000;
    text-decoration: none;
    */
}

.popup-link.website-link:hover {
    background: #e3f2fd;
    color: #1976d2;
}

.popup-link.article-link:hover {
    background: #f3e5f5;
    color: #7b1fa2;
}

.popup-link i {
    font-size: 10px;
}

.mappa-popup .coordinates {
    margin-top: 8px;
    color: #999;
    font-size: 11px;
    font-family: 'Courier New', monospace;
}
button.mapboxgl-popup-close-button, button.mapboxgl-popup-close-button:hover, button.mapboxgl-popup-close-button:focus {
    background: transparent !important;
    color: #000 !important;
    border: none !important;
    outline: none !important;
    font-weight: 600 !important;
    outline: none !important;
}
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip {
    border-top-color: #F2F268;
}
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
    border-bottom-color: #F2F268;
}

.white-mode button.mapboxgl-popup-close-button {
    color: #000 !important;
}

/* ========================================
   STILI MAPBOX PERSONALIZZATI
   ======================================== */

/* Personalizzazione marker Mapbox */
.custom-marker {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F2F268;
    border: 2px solid #F2F268;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.custom-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    border-color: #005a87;
}

.custom-marker.active {
    background: #0073aa;
    border-color: #005a87;
    transform: scale(1.1);
}

.custom-marker.active i {
    color: #ffffff !important;
}

.custom-marker i {
    font-size: 20px;
    display: block;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 20px;
}

/* Fallback per icone FontAwesome non caricate */
.custom-marker i:before {
    content: "📍";
    font-family: Arial, sans-serif;
    font-size: 16px;
}

/* Se FontAwesome è caricato, nascondi il fallback */
.custom-marker i.fas:before,
.custom-marker i.far:before,
.custom-marker i.fab:before {
    content: "";
}

/* Debug: per verificare che il marker sia presente, decommentare la riga sotto */
/* .custom-marker { outline: 2px solid red !important; } */

/* ========================================
   MARKER PULSANTE PER EVIDENZIAZIONE
   ======================================== */

.pulse-marker {
    position: relative;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 2px solid #0073aa;
    border-radius: 50%;
    animation: pulse 2s infinite;
    opacity: 0.8;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: #0073aa;
    border-radius: 50%;
    animation: pulse 2s infinite 0.5s;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Personalizzazione popup Mapbox */
.mapboxgl-popup-content {
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: none;
    color: white;
    background: #F2F268;
    padding: 15px;
}

.mappa-popup h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #000 !important;
}
.dark-mode .mappa-popup h3:hover {
    color: #000 !important;
}
.dark-mode:lang(it) .mappa-popup h3:hover {
    color: #000 !important;
}
.dark-mode .mappa-popup h3 {
    color: #000 !important;
}
.dark-mode:lang(it) .mappa-popup h3 {
    color: #000 !important;
}

.mappa-popup p {
    margin: 5px 0;
    font-size: 14px;
    line-height: 1.4;
}

.mappa-popup strong {
    font-weight: 600;
}

.mappa-popup small {
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

/* ========================================
   STILI RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .mappa-minestudio-container {
        flex-direction: column-reverse;
        gap: 15px;
    }
    
    .mappa-localities-list {
        flex: none;
        max-height: none;
        order: -1; /* Lista sopra la mappa su mobile */
    }
    
    .mappa-map-area {
        min-height: 300px;
    }
    
    .localities-container {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .mappa-minestudio-container {
        margin: 10px 0;
    }
    
    .mappa-localities-list {
        padding: 10px;
    }
    
    .mappa-map-area {
        min-height: 400px;
    }
    
    .locality-item {
        padding: 12px;
    }
    
    .locality-header h4 {
        font-size: 15px;
    }
    
    .locality-selected {
        padding: 15px;
        margin-top: 10px;
    }
    
    .locality-selected p {
        margin: 2px 0;
    }
}

/* ========================================
   STILI ACCESSIBILITÀ
   ======================================== */

/* Focus visibile per navigazione tastiera */

/* Contrasto migliorato per testo */
.mappa-localities-list {
    color: #333;
}


/* ========================================
   STILI UTILITY
   ======================================== */

.mappa-hidden {
    display: none !important;
}

.mappa-visible {
    display: block !important;
}

.mappa-loading-hidden {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mappa-loading-visible {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* ========================================
   STILI TEMI PERSONALIZZABILI
   ======================================== */

/* Tema scuro (opzionale) */
.mappa-theme-dark .mappa-minestudio-container {
    background: #1a1a1a;
    color: #fff;
}

.mappa-theme-dark .mappa-localities-list {
    background: #2d2d2d;
    border-color: #444;
    color: #fff;
}

.mappa-theme-dark .locality-item {
    background: #3d3d3d;
    border-color: #555;
    color: #fff;
}

.mappa-theme-dark .locality-item:hover {
    background: #4d4d4d;
    border-color: #0073aa;
}

/* Tema colorato (opzionale) */
.mappa-theme-colored .mappa-localities-list h3 {
    background: linear-gradient(45deg, #0073aa, #005a8b);
    color: white;
    padding: 10px 15px;
    margin: -15px -15px 15px -15px;
    border-radius: 8px 8px 0 0;
    border-bottom: none;
}
