/* Estilos específicos para Rain Alarm */
.map-wrapper {
    position: relative;
    width: 100%;
    height: calc(100vh - 80px); /* Altura completa menos el header */
}

.rain-alarm-container {
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    background-color: #fff;
    position: relative;
}

.map-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 12px 15px;
    border-radius: 8px;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    display: none; /* Oculto por defecto */
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    z-index: 1000;
    max-width: 320px;
    backdrop-filter: blur(10px);
}

.layer-selector {
    width: 100%;
    margin-bottom: 5px;
}

.layer-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
}

.layer-selector select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: #fff;
    cursor: pointer;
}

.map-controls label {
    font-weight: 500;
    color: #333;
}

.map-controls input,
.map-controls select,
.map-controls button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.map-controls input[type="number"] {
    width: 80px;
}

.map-controls button {
    background-color: #0010ef;
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

.map-controls button:hover {
    background-color: #0015c7;
}

.map-controls button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.location-info-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.location-info {
    position: absolute;
    top: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 12px 15px;
    padding-top: 35px;
    border-radius: 8px;
    margin: 0;
    border-left: 4px solid #0010ef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 250px;
    max-width: 300px;
    backdrop-filter: blur(10px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.location-info.collapsed {
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    pointer-events: none;
}

.location-info .close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.location-info .close-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

@media (min-width: 769px) {
    .location-info-wrapper {
        top: 70px;
    }
}

.location-info h3 {
    color: #0010ef;
    margin-bottom: 8px;
    font-size: 1rem;
}

.location-info .info-item {
    margin: 6px 0;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.info-item strong {
    color: #333;
}

.legend-wrapper {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
}

.legend {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 12px 15px;
    padding-top: 35px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    border: 1px solid rgba(224, 224, 224, 0.5);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.legend.collapsed {
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    pointer-events: none;
}

.legend .close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.legend .close-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.toggle-btn {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(224, 224, 224, 0.5);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: background-color 0.2s, transform 0.2s;
    padding: 0;
    font-size: 20px;
    z-index: 1001;
}

.toggle-btn:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.toggle-btn.active {
    background-color: #0010ef;
    color: #fff;
    border-color: #0010ef;
}

.toggle-icon {
    font-size: 20px;
    line-height: 1;
}

.legend h4 {
    margin-bottom: 10px;
    color: #0010ef;
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 5px 0;
    font-size: 0.85rem;
}

.legend-color {
    width: 30px;
    height: 20px;
    margin-right: 10px;
    border-radius: 3px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.error {
    background-color: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #c33;
}

.info-box {
    position: absolute;
    top: 70px;
    left: 10px;
    background-color: rgba(227, 242, 253, 0.95);
    color: #1565c0;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 0;
    border-left: 4px solid #0010ef;
    z-index: 1000;
    max-width: calc(100% - 20px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .info-box {
        top: auto;
        bottom: 140px; /* Encima de los controles de time-lapse */
    }
}

.info-box code {
    background-color: rgba(0, 16, 239, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.timelapse-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 12px 15px;
    border-radius: 8px;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    min-width: 300px;
    backdrop-filter: blur(10px);
}

.timelapse-controls h3 {
    margin-bottom: 10px;
    color: #0010ef;
    font-size: 0.95rem;
}

.timelapse-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.timelapse-buttons button {
    padding: 8px 16px;
    background-color: #0010ef;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s;
}

.timelapse-buttons button:hover {
    background-color: #0015c7;
}

.timelapse-buttons button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.timelapse-buttons label {
    margin-left: 15px;
    font-weight: 500;
}

.timelapse-buttons input[type="range"] {
    width: 100px;
    margin: 0 10px;
}

.timelapse-buttons #speedValue {
    font-weight: bold;
    color: #0010ef;
    min-width: 30px;
    display: inline-block;
}

.timelapse-time {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.timelapse-time strong {
    color: #333;
}

.timelapse-slider-container {
    margin-top: 10px;
}

.timelapse-slider-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
}

.timelapse-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.timelapse-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0010ef;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timelapse-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #0010ef;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timelapse-slider:hover::-webkit-slider-thumb {
    background: #0015c7;
}

.timelapse-slider:hover::-moz-range-thumb {
    background: #0015c7;
}

/* Estilos para el mapa de Leaflet */
.leaflet-container {
    background-color: #e5e5e5;
}

.custom-marker {
    background: transparent;
    border: none;
}

.precipitation-tooltip {
    background-color: rgba(0, 16, 239, 0.9);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Personalización de los controles del mapa */
.leaflet-control-zoom a {
    background-color: #0010ef;
    color: #fff;
}

.leaflet-control-zoom a:hover {
    background-color: #0015c7;
}

/* Responsive */
@media (max-width: 768px) {
    .map-wrapper {
        height: calc(100vh - 60px);
    }
    
    .map-controls {
        flex-direction: column;
        align-items: stretch;
        max-width: calc(100% - 100px);
        font-size: 0.8rem;
        padding: 8px;
        gap: 8px;
    }
    
    .map-controls > div {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .map-controls label {
        min-width: 60px;
        font-size: 0.8rem;
    }
    
    .map-controls input[type="number"] {
        flex: 1;
        width: auto;
        font-size: 0.8rem;
        padding: 6px 8px;
    }
    
    .map-controls button {
        font-size: 0.8rem;
        padding: 6px 12px;
        width: 100%;
    }
    
    .location-info-wrapper {
        top: 10px;
        right: 10px;
    }
    
    .location-info {
        max-width: calc(100vw - 80px);
        min-width: 200px;
        font-size: 0.85rem;
        padding: 10px;
        padding-top: 35px;
    }
    
    .legend-wrapper {
        bottom: 10px;
        right: 10px;
    }
    
    .legend {
        max-width: calc(100vw - 80px);
        min-width: 180px;
        padding: 10px;
        padding-top: 35px;
        font-size: 0.8rem;
    }
    
    .legend-item {
        font-size: 0.75rem;
        margin: 4px 0;
    }
    
    .legend-color {
        width: 24px;
        height: 16px;
        margin-right: 8px;
    }
    
    .timelapse-controls {
        position: absolute;
        bottom: 10px;
        left: 10px;
        max-width: calc(100vw - 80px);
        padding: 10px;
        font-size: 0.8rem;
        min-width: 250px;
    }
    
    .timelapse-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .timelapse-buttons button {
        padding: 6px 12px;
        font-size: 0.8rem;
        flex: 1 1 auto;
        min-width: 70px;
    }
    
    .timelapse-buttons label {
        margin-left: 0;
        margin-right: 5px;
        font-size: 0.8rem;
    }
    
    .timelapse-buttons input[type="range"] {
        width: 80px;
        margin: 0 5px;
    }
    
    .timelapse-time {
        font-size: 0.8rem;
        gap: 15px;
        flex-wrap: wrap;
    }
    
    .info-box {
        position: absolute;
        top: auto;
        bottom: 180px;
        left: 10px;
        max-width: calc(100% - 20px);
        padding: 10px;
        font-size: 0.8rem;
    }
    
    .toggle-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .location-info-wrapper {
        top: 5px;
        right: 5px;
    }
    
    .legend-wrapper {
        bottom: 5px;
        right: 5px;
    }
    
    .location-info,
    .legend {
        max-width: calc(100vw - 60px);
    }
    
    .timelapse-controls {
        bottom: 5px;
        left: 5px;
        max-width: calc(100vw - 70px);
        padding: 8px;
    }
    
    .map-controls {
        top: 5px;
        left: 5px;
        max-width: calc(100% - 60px);
        padding: 6px;
    }
}

