/**
 * Estilos unificados para LocationPickerModal
 * Componente reutilizable de selección de ubicación
 */

/* Modal principal */
.location-modal {
    position: fixed !important;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
    padding: 16px;
}

.location-modal[aria-hidden="false"],
.location-modal.show {
    display: flex !important;
}

/* Backdrop */
.location-modal-backdrop {
    position: fixed !important;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 99998 !important;
}

/* Contenedor del modal */
.location-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999 !important;
}

/* Header */
.location-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.location-modal-back {
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.location-modal-back:hover {
    background: #f3f4f6;
}

.location-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
}

/* Tabs */
.location-modal-tabs {
    display: flex;
    padding: 0 20px;
    border-bottom: 1px solid #e9ecef;
    gap: 0;
    flex-shrink: 0;
}

.location-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.location-tab:hover {
    color: #00b487;
}

.location-tab.active {
    color: #00b487;
    border-bottom-color: #00b487;
}

/* Body */
.location-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.location-tab-content {
    display: none;
}

.location-tab-content.active {
    display: block;
}

/* Mapa */
#locationMapContainer {
    width: 100% !important;
    min-width: 100% !important;
    height: 400px !important;
    min-height: 400px !important;
    max-height: 400px !important;
    position: relative !important;
    overflow: hidden !important;
    background-color: #f0f0f0 !important;
    border-radius: 8px;
    margin-top: 16px;
}

#locationMapContainer .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    min-height: 400px !important;
}

.location-tab-content.active #locationMapContainer {
    display: block !important;
    visibility: visible !important;
}

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

#locationMapLoading i {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
}

/* Barra de búsqueda */
.location-search-bar {
    position: relative;
    margin-bottom: 16px;
    z-index: 1001;
}

.location-search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    z-index: 2;
}

.location-search-bar input {
    width: 100%;
    padding: 12px 44px 12px 44px;
    border: 1px solid #e2e4e9;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    background: white;
}

.location-search-bar input:focus {
    outline: none;
    border-color: #00b487;
    box-shadow: 0 0 0 3px rgba(0, 180, 135, 0.1);
}

.clear-search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    z-index: 10;
    transition: all 0.2s ease;
}

.clear-search-btn:hover {
    color: #6b7280;
    background-color: #f3f4f6;
}

/* Slider de distancia */
.location-distance-slider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.location-distance-slider span {
    font-size: 14px;
    color: #6b7280;
    min-width: 60px;
    font-weight: 500;
}

.location-distance-slider input[type="range"] {
    flex: 1;
    height: 4px;
    background: #e2e4e9;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.location-distance-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #00b487;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

.location-distance-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.location-distance-slider input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #00b487;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.location-distance-slider input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
}

/* Botón aplicar */
.apply-location-filter-btn {
    width: 100%;
    padding: 14px 20px;
    background: #00b487;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.2s;
}

.apply-location-filter-btn:hover {
    background: #00a077;
}

.apply-location-filter-btn:active {
    background: #008f68;
}

/* Lista de sugerencias */
.location-suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e4e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0;
}

.location-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s;
}

.location-suggestion-item:last-child {
    border-bottom: none;
}

.location-suggestion-item:hover {
    background: #f9fafb;
}

.location-suggestion-item i {
    color: #9ca3af;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.location-suggestion-text {
    flex: 1;
    font-size: 16px;
    color: #1f2937;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.location-suggestion-type {
    font-size: 12px;
    color: #6b7280;
    font-weight: 400;
}

/* Responsive */
@media (max-width: 768px) {
    .location-modal {
        padding: 8px;
    }
    
    .location-modal-content {
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .location-modal-header {
        padding: 12px 16px;
    }
    
    .location-modal-title {
        font-size: 16px;
    }
    
    .location-modal-tabs {
        padding: 0 16px;
    }
    
    .location-tab {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .location-modal-body {
        padding: 16px;
    }
    
    #locationMapContainer {
        height: 300px !important;
        min-height: 300px !important;
        max-height: 300px !important;
    }
    
    #locationMapContainer .leaflet-container {
        min-height: 300px !important;
    }
    
    .location-distance-slider {
        margin: 16px 0;
    }
    
    .apply-location-filter-btn {
        padding: 12px 16px;
        font-size: 15px;
        margin-top: 16px;
    }
}

@media (max-width: 480px) {
    .location-modal {
        padding: 0;
    }
    
    .location-modal-content {
        max-height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    
    #locationMapContainer {
        height: 250px !important;
        min-height: 250px !important;
        max-height: 250px !important;
    }
    
    #locationMapContainer .leaflet-container {
        min-height: 250px !important;
    }
}

