/**
 * Mapa de Escorts - Estilos CSS
 * OpenStreetMap + Leaflet.js
 *
 * @package ChicasIndependientes
 * @since 2025-12
 */

/* ==========================================================================
   CONTENEDOR DEL MAPA
   ========================================================================== */

#mapa-container {
    position: relative;
    height: calc(100vh - 64px);
    width: 100%;
    overflow: hidden;
}

#mapa {
    height: 100%;
    width: 100%;
    z-index: 1;
}

/* ==========================================================================
   MARCADORES PERSONALIZADOS
   ========================================================================== */

.pin {
    width: 30px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.pin::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pin i {
    position: relative;
    z-index: 1;
    color: white;
    font-size: 12px;
    margin-top: -8px;
}

/* Colores por categoría */
.pin-escorts::before {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.pin-masajes::before {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.pin-trans::before {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.pin-verificado::before {
    background: linear-gradient(135deg, #10b981, #059669);
}

/* Mi ubicación */
.pin-mi-ubicacion {
    width: 24px;
    height: 24px;
    background: #3b82f6;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-location 2s infinite;
}

.pin-mi-ubicacion i {
    color: white;
    font-size: 10px;
}

@keyframes pulse-location {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(59, 130, 246, 0);
    }
}

/* ==========================================================================
   CLUSTERS
   ========================================================================== */

.marker-cluster {
    background: transparent !important;
}

.cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.cluster-small {
    width: 36px;
    height: 36px;
    font-size: 12px;
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.cluster-medium {
    width: 44px;
    height: 44px;
    font-size: 14px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.cluster-large {
    width: 52px;
    height: 52px;
    font-size: 16px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ==========================================================================
   POPUPS
   ========================================================================== */

.leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 0;
    min-width: 200px;
    max-width: 280px;
}

.leaflet-popup-tip {
    background: white;
}

.popup-anuncio {
    width: 100%;
}

.popup-imagen {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
}

.popup-imagen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.popup-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.popup-badge-verificado {
    background: #10b981;
    color: white;
}

/* Botón favorito en popup */
.popup-btn-fav {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.popup-btn-fav:hover {
    background: white;
    transform: scale(1.1);
}

.popup-btn-fav i {
    font-size: 16px;
    color: #ef4444;
}

.popup-btn-fav i.fas {
    color: #ef4444;
}

.popup-btn-fav i.far {
    color: #9ca3af;
}

.popup-btn-fav:hover i.far {
    color: #ef4444;
}

.popup-info {
    padding: 12px;
}

.popup-titulo {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    line-height: 1.3;
}

.popup-ubicacion {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.popup-ubicacion i {
    color: #ec4899;
    margin-right: 4px;
}

.popup-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.popup-categoria {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.popup-categoria-escorts {
    background: #fce7f3;
    color: #db2777;
}

.popup-categoria-masajes {
    background: #ede9fe;
    color: #7c3aed;
}

.popup-categoria-trans {
    background: #fef3c7;
    color: #d97706;
}

.popup-edad {
    font-size: 11px;
    color: #6b7280;
}

.popup-distancia {
    font-size: 11px;
    color: #3b82f6;
    font-weight: 500;
}

.popup-acciones {
    display: flex;
    gap: 8px;
}

.popup-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
    text-decoration: none;
}

.popup-btn-ver {
    background: #ec4899;
    color: white;
}

.popup-btn-ver:hover {
    background: #db2777;
    color: white;
}

.popup-btn-ruta {
    background: #f3f4f6;
    color: #374151;
}

.popup-btn-ruta:hover {
    background: #e5e7eb;
}

/* ==========================================================================
   PANEL DE FILTROS
   ========================================================================== */

#panel-filtros {
    transition: transform 0.3s ease;
}

#panel-filtros.hidden {
    transform: translateX(-110%);
}

@media (max-width: 768px) {
    #panel-filtros {
        width: calc(100% - 32px);
        max-width: 320px;
    }
}

/* ==========================================================================
   LISTA DE ANUNCIOS
   ========================================================================== */

#panel-lista {
    transition: all 0.3s ease;
}

#panel-lista.panel-colapsado {
    width: 48px;
    overflow: hidden;
}

#panel-lista.panel-colapsado .p-4,
#panel-lista.panel-colapsado #lista-anuncios {
    display: none;
}

.lista-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.2s;
}

.lista-item:hover {
    background: #f9fafb;
}

.lista-item-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.lista-item-info {
    flex: 1;
    margin-left: 12px;
    min-width: 0;
}

.lista-item-titulo {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lista-item-ubicacion {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

.lista-item-distancia {
    font-size: 10px;
    color: #3b82f6;
    font-weight: 500;
    margin-top: 2px;
    display: block;
}

.lista-item-verificado {
    flex-shrink: 0;
    margin-left: 8px;
}

/* ==========================================================================
   CONTROLES PERSONALIZADOS
   ========================================================================== */

/* Ocultar controles de Leaflet por defecto */
.leaflet-control-zoom {
    display: none;
}

/* Ocultar panel por defecto de Leaflet Routing */
.leaflet-routing-container {
    display: none !important;
}

/* ==========================================================================
   PANEL DE RUTA PERSONALIZADO
   ========================================================================== */

#panel-ruta {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 280px;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.panel-ruta-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
    font-weight: 600;
}

.panel-ruta-header i {
    font-size: 16px;
}

.panel-ruta-cerrar {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.panel-ruta-cerrar:hover {
    background: rgba(255,255,255,0.3);
}

.panel-ruta-info {
    display: flex;
    padding: 20px 16px;
    gap: 32px;
    justify-content: center;
}

.panel-ruta-dato {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.panel-ruta-dato i {
    font-size: 24px;
    color: #ec4899;
}

.panel-ruta-valor {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.panel-ruta-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-ruta-botones {
    display: flex;
    gap: 0;
}

.panel-ruta-btn {
    flex: 1;
    padding: 14px 12px;
    border: none;
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.panel-ruta-btn i {
    color: white;
    font-size: 16px;
}

/* Google Maps - Azul */
.panel-ruta-btn-google {
    background: #4285f4;
}

.panel-ruta-btn-google:hover {
    background: #3367d6;
}

/* Waze - Celeste */
.panel-ruta-btn-waze {
    background: #33ccff;
}

.panel-ruta-btn-waze:hover {
    background: #00b8f0;
}

/* Responsive panel ruta */
@media (max-width: 768px) {
    #panel-ruta {
        left: 16px;
        right: 16px;
        transform: none;
        min-width: auto;
        bottom: 80px; /* Espacio para botones móviles */
    }

    .panel-ruta-valor {
        font-size: 24px;
    }

    .panel-ruta-info {
        gap: 24px;
        padding: 16px;
    }
}

/* ==========================================================================
   SLIDER DE RADIO
   ========================================================================== */

#slider-radio {
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    outline: none;
}

#slider-radio::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ec4899;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#slider-radio::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ec4899;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   MARCADOR DE BÚSQUEDA
   ========================================================================== */

.pin-busqueda {
    width: 30px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.pin-busqueda::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pin-busqueda i {
    position: relative;
    z-index: 1;
    color: white;
    font-size: 12px;
    margin-top: -8px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Botón lista siempre visible */
#panel-lista {
    display: block !important;
}

@media (max-width: 768px) {
    #mapa-container {
        height: calc(100vh - 56px);
    }

    #panel-filtros {
        top: auto;
        bottom: 16px;
        left: 16px;
        right: 16px;
        width: auto;
        max-height: 60vh;
    }

    #btn-mostrar-filtros {
        bottom: 16px;
        top: auto;
    }

    /* Buscador móvil - segunda fila, ancho completo */
    #buscador-direccion {
        top: 56px;
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
    }

    #buscador-direccion input {
        font-size: 14px;
        padding: 10px 12px;
    }

    #buscador-direccion .flex {
        box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    }

    /* Botones herramientas móvil - primera fila derecha */
    #panel-lista {
        top: 8px;
        right: 8px;
        gap: 6px;
    }

    #panel-lista button {
        padding: 8px 10px;
        min-width: 40px;
        min-height: 40px;
    }

    #panel-lista button i {
        font-size: 15px;
    }

    /* Badges más pequeños en móvil */
    #panel-lista .absolute.-top-1 {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }
}

/* ==========================================================================
   FULLSCREEN
   ========================================================================== */

#mapa-container:fullscreen {
    height: 100vh;
}

#mapa-container:fullscreen header {
    display: none;
}

#mapa-container:-webkit-full-screen {
    height: 100vh;
}

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.popup-anuncio {
    animation: fadeIn 0.2s ease;
}

/* Spinner de carga */
.spinner-ring {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #ec4899;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Animación de corazón favorito */
@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1); }
    75% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes heartPop {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.popup-btn-fav.animating i {
    animation: heartBeat 0.6s ease;
}

.popup-btn-fav.adding i {
    animation: heartPop 0.4s ease forwards;
}

/* ==========================================================================
   DARK MODE (opcional, preparado para futuro)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    /* Por ahora no implementado */
}
