/* Maptica Maps CSS */

/* Contenedor del mapa */
#maptica-mapa {
    width: 100%;
    height: 400px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    position: relative;
}

#maptica-mapa:before {
    content: "Cargando mapa...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
}

.maptica-map-container {
    margin: 20px 0;
    min-height: 420px;
    max-width: none !important;
}

/* Ocultar el texto de carga cuando Leaflet está activo */
.leaflet-container:before {
    display: none;
}

/* Estilos para filtros del mapa */
.maptica-map-filters {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.maptica-map-filters h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
}

.filter-section {
    margin-bottom: 20px;
}

.filter-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 10px;
    gap: 15px;
}

.filter-header h5 {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-weight: bold;
}

.filter-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Switch para marcar/desmarcar todo */
.filter-actions .master-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    color: #666;
}

.filter-actions .master-switch input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}

.filter-actions .master-switch .switch-control {
    position: relative;
    width: 32px;
    height: 16px;
    border-radius: 16px;
    background-color: #ccc;
    border: 1px solid #999;
    transition: all 0.3s ease;
    margin-right: 6px;
    flex-shrink: 0;
}

.filter-actions .master-switch .switch-control::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: white;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.filter-actions .master-switch input[type="checkbox"]:checked + .switch-control {
    background-color: #555;
    border-color: #333;
}

.filter-actions .master-switch input[type="checkbox"]:checked + .switch-control::before {
    transform: translateX(16px);
}

.filter-actions .master-switch:hover .switch-control {
    box-shadow: 0 0 0 2px rgba(85, 85, 85, 0.1);
}

.filter-actions .master-switch input[type="checkbox"]:focus + .switch-control {
    outline: 2px solid #555;
    outline-offset: 1px;
}

/* Switches individuales de filtros */
.filter-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
    user-select: none;
}

/* Ocultar checkbox original */
.filter-checkbox input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}

/* Switch personalizado - BASE (para categorías - puntos normales) */
.filter-checkbox input[type="checkbox"] + .color-indicator {
    position: relative;
    margin-right: 12px;
    width: 40px;
    height: 20px;
    border-radius: 20px;
    background-color: #ccc;
    border: 2px solid white;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

/* Círculo del switch - BASE (blanco para categorías) */
.filter-checkbox input[type="checkbox"] + .color-indicator::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: white;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Switch activado - categorías (borde blanco, círculo blanco) */
.filter-checkbox input[type="checkbox"]:checked + .color-indicator {
    border-color: white;
}

.filter-checkbox input[type="checkbox"]:checked + .color-indicator::before {
    transform: translateX(20px);
    background-color: white;
}

/* RUTAS: Switch con borde y círculo gris #333 */
.route-filter + .color-indicator {
    border-color: #000 !important;
}

.route-filter + .color-indicator::before {
    background-color: #000 !important;
}

.route-filter:checked + .color-indicator {
    border-color: #000 !important;
}

.route-filter:checked + .color-indicator::before {
    background-color: #000 !important;
}

/* NUEVO: SENDEROS - Switch con borde y círculo gris #777 */
.sendero-filter + .color-indicator {
    border-color: #555 !important;
}

.sendero-filter + .color-indicator::before {
    background-color: #555 !important;
}

.sendero-filter:checked + .color-indicator {
    border-color: #555 !important;
}

.sendero-filter:checked + .color-indicator::before {
    background-color: #555 !important;
}

/* Texto del switch */
.filter-checkbox .switch-text {
    flex: 1;
    display: flex;
    align-items: center;
}

/* Estados hover y focus */
.filter-checkbox:hover input[type="checkbox"] + .color-indicator {
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.filter-checkbox input[type="checkbox"]:focus + .color-indicator {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   🎨 ESTILOS DE LOS SWITCHES DE FILTROS
   ═══════════════════════════════════════════════════════════*/

 /* Switch control (el círculo deslizante) */
 .maptica-map-filters .switch-control {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;           /* ⬅️ Color cuando está OFF (gris) */
    transition: 0.4s;
    border-radius: 34px;
}

/* Círculo interno del switch */
.maptica-map-filters .switch-control:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 3px;
    background-color: white;          /* ⬅️ Color del círculo (blanco) */
    transition: 0.4s;
    border-radius: 50%;
}

/* Switch cuando está activado (checked) */
.maptica-map-filters input:checked + .switch-control {
    background-color: #2196F3;        /* ⬅️ Color cuando está ON (azul) */
}

/* Posición del círculo cuando está activado */
.maptica-map-filters input:checked + .switch-control:before {
    transform: translateX(20px);
}

/* Hover effect */
.maptica-map-filters input:focus + .switch-control {
    box-shadow: 0 0 1px #2196F3;     /* ⬅️ Sombra al hacer focus (azul) */
}

@media (min-width: 768px) {
    .maptica-map-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 30px;
    }
    
    .maptica-map-filters h4 {
        width: 100%;
    }
    
    .filter-section {
        flex: 1;
        min-width: 200px;
    }
}

/* Overlay para cerrar panel al hacer clic fuera */
#maptica-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9999;
    transition: opacity 0.3s ease;
}

/* Panel lateral */
.maptica-info-panel.sidebar {
    position: fixed;
    top: 0;
    right: -50%;
    width: 50%;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 10000; /* Por encima del overlay */
    overflow-y: auto;
    padding: 20px;
}

.maptica-info-panel.sidebar.active {
    right: 0;
}

/* Panel inferior */
.maptica-info-panel.bottom {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    height: 90%;
    background: white;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    transition: bottom 0.3s ease;
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
}

.maptica-info-panel.bottom.active {
    bottom: 0;
}

/* Modal */
.maptica-info-panel.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.maptica-info-panel.modal.active {
    display: flex;
}

.maptica-info-panel.modal .modal-content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 80%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    margin: 20px;
}

/* Botón de cerrar */
.maptica-info-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
    z-index: 999;
}

.maptica-info-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* Contenido de la información */
.maptica-info-content {
    padding-right: 40px;
}

.maptica-info-content h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
    font-weight: bold;
}

.maptica-info-content p.popup-route-title {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 20px;
}

/* Contenedor de contenido con imagen */
.maptica-info-body { 
}

.maptica-info-text {
    flex: 1;
}

.maptica-info-image {
    flex: 0 0 100%;
    position: relative;
}

.maptica-info-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.maptica-info-content .info-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.maptica-info-content .info-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.maptica-info-content .info-description {
    line-height: 1.6;
    color: #555;
}

/* Responsive - Móviles */
@media (max-width: 767px) {
    .maptica-info-panel.sidebar {
        width: 85vw;
        right: -85vw;
    }
    
    .maptica-info-panel.modal .modal-content {
        margin: 10px;
        padding: 20px;
        max-height: 90vh;
    }
    
    .maptica-info-content {
        padding-right: 0;
    }
    
    .maptica-info-content h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .maptica-info-body {
        display: block;
    }
    
    .maptica-info-image {
        width: 100%;
        margin-bottom: 15px;
        position: relative;
    }
    
    .maptica-info-image img {
        width: 100%;
        height: auto;
        border-radius: 8px;
    }
    
    .maptica-info-text {
        width: 100%;
    }
}

/* Estilos para popups estándar de Leaflet */
.leaflet-popup {
    z-index: 10001 !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    background: white !important;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4) !important;
}

.leaflet-popup-content {
    margin: 13px 19px !important;
    line-height: 1.4 !important;
    font-size: 13px !important;
    color: #333 !important;
}

.leaflet-popup-tip {
    background: white !important;
}

.leaflet-popup-close-button {
    color: #c3c3c3 !important;
    font-size: 16px !important;
    font-weight: bold !important;
}

.leaflet-popup-content img {
    max-width: 100%;
}

.leaflet-popup-content .popup-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 5px;
}

.leaflet-popup-content .popup-route {
    font-weight: normal;
    font-size: 12px;
    color: #666;
    margin-top: 10px;
}

.leaflet-popup-content .popup-route-title {
    font-weight: bold;
    font-size: 12px;
    color: #666;
    margin: 5px 0 10px 0;
}
