/**
 * Estilos para Mapa Interactivo
 * US Food Banks Directory
 */

/* ===========================
   CONTENEDOR PRINCIPAL
=========================== */
.usfbd-map-container {
    max-width: 100%;
    margin: 20px 0;
}

/* ===========================
   FILTROS DEL MAPA
=========================== */
.usfbd-map-filters {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 8px 8px 0 0;
    border: 1px solid #ddd;
    border-bottom: none;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

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

.filter-search {
    flex: 1;
}

.map-search-field {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.map-search-field:focus {
    outline: none;
    border-color: #ff8c8c;
}

.map-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.map-btn-locate {
    background-color: white;
    color: #333;
    border: 2px solid #ff8c8c;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: 500;
}

.map-btn-locate:hover {
    background-color: #ff8c8c;
    color: white;
    border-color: #e77a7a;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.map-btn-locate .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #ff8c8c;
    margin-right: 5px;
}

.map-btn-locate:hover .dashicons {
    color: white;
}

.map-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Checkboxes de filtros */
.filter-checkboxes {
    flex-wrap: wrap;
}

.filter-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    margin-right: 15px;
}

.filter-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.filter-label {
    font-size: 0.9em;
    padding: 5px 10px;
    border-radius: 3px;
    background: white;
    border: 1px solid #ddd;
}

.filter-label.filter-snap {
    border-color: #ffd700;
    color: #b8860b;
}

.filter-label.filter-voluntario {
    border-color: #4169e1;
    color: #1e3a8a;
}

.filter-label.filter-iglesia {
    border-color: #9370db;
    color: #4b0082;
}

.filter-label.filter-comedor {
    border-color: #32cd32;
    color: #006400;
}

.filter-info {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

/* ===========================
   MAPA
=========================== */
.usfbd-map {
    width: 100%;
    height: 600px;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    z-index: 1;
}

/* ===========================
   MARCADORES PERSONALIZADOS
=========================== */
.custom-marker {
    background: transparent;
    border: none;
}

/* Estilo de pin para marcadores */
.marker-pin {
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    position: relative;
    transform: rotate(-45deg);
    margin: -12px 0 0 -12px;
}

.marker-pin::after {
    content: '';
    width: 12px;
    height: 12px;
    margin: 6px 0 0 6px;
    background: #fff;
    position: absolute;
    border-radius: 50%;
}

/* Colores según tipo */
.marker-banco .marker-pin {
    background-color: #ff6b6b;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.marker-iglesia .marker-pin {
    background-color: #9370db;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.marker-comedor .marker-pin {
    background-color: #51cf66;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.marker-snap .marker-pin {
    background-color: #ffd700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.marker-user .marker-pin {
    background-color: #4169e1;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}

/* Animación para marcador de usuario */
.marker-pin.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: rotate(-45deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(-45deg) scale(1.15);
        opacity: 0.85;
    }
}

/* ===========================
   POPUPS PERSONALIZADOS
=========================== */
.custom-popup .leaflet-popup-content-wrapper {
    border-radius: 8px;
    padding: 0;
}

.custom-popup .leaflet-popup-content {
    margin: 0;
    min-width: 250px;
}

.marker-popup {
    padding: 15px;
}

.popup-title {
    font-size: 1.2em;
    margin: 0 0 10px 0;
    color: #2c5d3f;
    border-bottom: 2px solid #ff8c8c;
    padding-bottom: 8px;
}

.popup-address,
.popup-location,
.popup-phone,
.popup-hours,
.popup-distance {
    font-size: 0.9em;
    margin: 8px 0;
    line-height: 1.5;
}

.popup-phone a {
    color: #ff8c8c;
    text-decoration: none;
}

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

.popup-distance {
    color: #666;
    font-style: italic;
}

/* Badges en popup */
.popup-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0;
}

.popup-badges .badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: 500;
}

.badge-snap {
    background: #fff9e6;
    color: #b8860b;
    border: 1px solid #ffd700;
}

.badge-voluntario {
    background: #e6f0ff;
    color: #1e3a8a;
    border: 1px solid #4169e1;
}

.badge-iglesia {
    background: #f0e6ff;
    color: #4b0082;
    border: 1px solid #9370db;
}

.badge-comedor {
    background: #e6ffe6;
    color: #006400;
    border: 1px solid #32cd32;
}

/* Botones en popup */
.popup-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.popup-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 5px;
    text-align: center;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.popup-btn-details {
    background-color: #ff8c8c;
    color: white !important;
}

.popup-btn-details:hover,
.popup-btn-details:visited {
    background-color: #e77a7a;
    color: white !important;
    text-decoration: none;
}

.popup-btn-directions {
    background-color: #4169e1;
    color: white !important;
}

.popup-btn-directions:hover,
.popup-btn-directions:visited {
    background-color: #1e3a8a;
    color: white !important;
    text-decoration: none;
}

/* Botón "Mi ubicación" */
.map-btn-locate {
    background: white;
    color: #333;
    border: 2px solid #ff8c8c;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.map-btn-locate:hover {
    background: #ff8c8c;
    color: white;
    border-color: #e77a7a;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.map-btn-locate .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: #ff8c8c;
}

.map-btn-locate:hover .dashicons {
    color: white;
}

/* Botón geolocate de Leaflet (si se usa control personalizado) */
.leaflet-control-geolocate {
    background: white;
    border: 2px solid #ff8c8c;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    padding: 8px;
    margin: 10px;
    transition: all 0.3s ease;
}

.leaflet-control-geolocate:hover {
    background: #ff8c8c;
    border-color: #e77a7a;
}

.leaflet-control-geolocate svg {
    display: block;
    width: 20px;
    height: 20px;
}

.leaflet-control-geolocate svg path {
    fill: #ff8c8c;
}

.leaflet-control-geolocate:hover svg path {
    fill: white;
}

/* ===========================
   LEYENDA
=========================== */
.usfbd-map-legend {
    background: #f8f8f8;
    padding: 15px 20px;
    border-radius: 0 0 8px 8px;
    border: 1px solid #ddd;
    border-top: none;
    margin-top: -1px;
}

.usfbd-map-legend h4 {
    margin: 0 0 10px 0;
    font-size: 1em;
    color: #333;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 992px) {
    .usfbd-map-filters {
        padding: 15px;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .map-btn {
        width: 100%;
        justify-content: center;
    }

    .filter-checkboxes {
        flex-direction: column;
        gap: 10px;
    }

    .filter-checkbox {
        margin-right: 0;
        width: 100%;
    }

    .usfbd-map {
        height: 400px;
    }

    .popup-actions {
        flex-direction: column;
    }

    .legend-items {
        flex-direction: column;
        gap: 8px;
    }
}

/* ===========================
   CLUSTERS DE LEAFLET
=========================== */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(255, 140, 140, 0.6);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(255, 140, 140, 0.8);
    color: white;
    font-weight: bold;
}

/* ===========================
   DASHICONS EN BOTONES
=========================== */
.map-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ===========================
   LOADING STATES
=========================== */
.map-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* ===========================
   ACCESIBILIDAD
=========================== */
.map-btn:focus,
.map-search-field:focus,
.filter-checkbox input:focus {
    outline: 2px solid #ff8c8c;
    outline-offset: 2px;
}
