/**
 * Veertualia /locals — Global Map Styles
 *
 * Stili per la mappa globale Leaflet, i filtri, il loader,
 * i popup dei marker e il layout responsive.
 *
 * @package    Veertualia_Locals
 * @since      1.1.0
 */

/* =============================================
   Map Wrapper
   ============================================= */
.vlocals-map-wrapper {
    position: relative;
    margin: 1.5em 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* =============================================
   Map Container
   ============================================= */
#vlocals-global-map {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
    z-index: 1;
}

/* =============================================
   Filters Bar
   ============================================= */
.vlocals-map-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0;
    margin-bottom: 4px;
}

.vlocals-map-filters select {
    flex: 1 1 200px;
    padding: 10px 36px 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #1d2327;
    background-color: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    /* Remove native browser dropdown arrow */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Custom SVG dropdown arrow */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2350575e' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px 8px;
}

.vlocals-map-filters select:hover {
    border-color: #8c8f94;
}

.vlocals-map-filters select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* =============================================
   Loader Overlay
   ============================================= */
.vlocals-map-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    z-index: 1000;
    pointer-events: none;
}

/* =============================================
   Spinner Animation
   ============================================= */
.vlocals-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: vlocals-spin 0.8s linear infinite;
}

@keyframes vlocals-spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
   Popup Card
   ============================================= */
.vlocals-popup {
    max-width: 260px;
    padding: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.5;
}

.vlocals-popup-thumb {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 8px;
    display: block;
    object-fit: cover;
    max-height: 140px;
}

.vlocals-popup h4 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

.vlocals-popup h4 a {
    color: #1d2327;
    text-decoration: none;
    transition: color 0.2s ease;
}

.vlocals-popup h4 a:hover {
    color: #2271b1;
}

.vlocals-popup-type {
    display: inline-block;
    margin: 0 0 6px 0;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #2271b1;
    background: #f0f6fc;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.vlocals-popup-address,
.vlocals-popup-phone,
.vlocals-popup-price {
    margin: 0 0 3px 0;
    font-size: 13px;
    color: #50575e;
}

.vlocals-popup-phone a {
    color: #2271b1;
    text-decoration: none;
}

.vlocals-popup-phone a:hover {
    text-decoration: underline;
}

.vlocals-popup-price {
    font-weight: 600;
    color: #1d2327;
}

/* =============================================
   No Results Message
   ============================================= */
.vlocals-no-results {
    background: #fff;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    color: #50575e;
    margin: 10px;
}

.vlocals-no-results p {
    margin: 0;
}

/* =============================================
   Leaflet Popup Overrides
   ============================================= */
.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-popup-content {
    margin: 10px !important;
}

/* =============================================
   Responsive — Mobile (< 768px)
   ============================================= */
@media screen and (max-width: 768px) {
    .vlocals-map-filters {
        flex-direction: column;
        gap: 8px;
    }

    .vlocals-map-filters select {
        flex: 1 1 auto;
        width: 100%;
    }

    #vlocals-global-map {
        min-height: 300px;
    }
}
