/**
 * BERTOKIN MAP STYLES v1.0
 * Estilos para el mapa interactivo de Leaflet
 */

/* Contenedor principal del mapa cuando se inyecta */
#bertokin-map-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: #f5f5f5;
}

/* El mapa Leaflet */
#bertokin-leaflet-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: 12px;
    z-index: 1;
}

/* Panel de filtros */
.bertokin-map-filters {
    position: absolute;
    top: 10px;
    left: 50px;
    right: 50px;
    z-index: 1000;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.bertokin-map-filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 140px;
}

.bertokin-map-filters select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

/* Botón de ubicación */
.bertokin-location-btn {
    position: absolute;
    bottom: 30px;
    right: 10px;
    z-index: 1000;
    width: 44px;
    height: 44px;
    background: white;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.bertokin-location-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.bertokin-location-btn.active {
    background: #007AFF;
    color: white;
    border-color: #007AFF;
}

.bertokin-location-btn svg {
    width: 22px;
    height: 22px;
}

/* Lista de recursos con distancias */
.bertokin-resource-list {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #eee;
    display: none;
}

.bertokin-resource-list.visible {
    display: block;
}

.bertokin-resource-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s ease;
}

.bertokin-resource-item:hover {
    background: #f5f5f5;
}

.bertokin-resource-item:last-child {
    border-bottom: none;
}

.resource-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 16px;
}

.resource-info {
    flex: 1;
}

.resource-name {
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.resource-address {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.resource-distance {
    font-size: 13px;
    font-weight: 600;
    color: #007AFF;
    margin-left: 10px;
    white-space: nowrap;
}

/* Popup del mapa personalizado */
.bertokin-popup {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bertokin-popup .popup-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.bertokin-popup .popup-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 14px;
}

.bertokin-popup .popup-title {
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.bertokin-popup .popup-category {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.bertokin-popup .popup-address {
    font-size: 13px;
    color: #555;
    margin: 8px 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.bertokin-popup .popup-distance {
    display: inline-block;
    background: #007AFF;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 5px;
}

.bertokin-popup .popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.bertokin-popup .popup-btn {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.bertokin-popup .popup-btn-primary {
    background: #007AFF;
    color: white;
}

.bertokin-popup .popup-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

/* Marcador de usuario */
.user-marker-icon {
    background: transparent;
    border: none;
}

.user-marker-pulse {
    width: 20px;
    height: 20px;
    background: #007AFF;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(0, 122, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0);
    }
}

/* Mensaje de carga */
.bertokin-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 1001;
}

.bertokin-map-loading .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top-color: #007AFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mensaje de sin resultados */
.bertokin-no-results {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.bertokin-no-results .emoji {
    font-size: 40px;
    margin-bottom: 10px;
}

.bertokin-no-results .message {
    font-size: 14px;
    color: #666;
}

/* Toggle lista de recursos */
.bertokin-list-toggle {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.bertokin-list-toggle:hover {
    background: #f5f5f5;
}

/* Responsive */
@media (max-width: 600px) {
    .bertokin-map-filters {
        left: 10px;
        right: 10px;
        padding: 8px 10px;
    }
    
    .bertokin-map-filters select {
        min-width: 100px;
        font-size: 13px;
        padding: 6px 8px;
    }
    
    .bertokin-resource-list {
        max-height: 150px;
    }
    
    .bertokin-location-btn {
        bottom: 20px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
}

/* Ajustes para Leaflet */
.leaflet-popup-content {
    margin: 12px;
    min-width: 200px;
}

.leaflet-popup-content-wrapper {
    border-radius: 10px;
}

.leaflet-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
