:root {
    --green-alert: #00ff00;
    --red-alert: #ff0000;
    --blue-alert: #0055ff;
    --dark-bg: #000000;
}

body, html { 
    margin: 0;
    padding: 0;
    height: 100%; 
    background: var(--dark-bg); 
    font-family: 'Segoe UI', Tahoma, sans-serif; 
    overflow: hidden; 
}

#app-content {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

#mapa-ultimo-evento { 
    position: absolute; 
    top: 0; 
    left: 0;
    right: 0;
    bottom: 0; 
    width: 100%; 
    height: 100%;
    z-index: 1; 
}

.top-bar { 
    position: absolute;
    top: 0;
    width: 100%; 
    background: rgba(0,0,0,0.0);
    color: #00E4E8; 
    padding: 12px;
    display: flex;
    justify-content: space-between; 
    font-size: 11px;
    z-index: 1000; 
}

.btn-ctrl {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12px;
    transition: 0.3s;
}

.btn-ctrl:hover {
    background: #222;
    border-color: var(--green-alert);
}

.mapboxgl-ctrl-top-left {
    top: 70px;
    left: 10px;
}

.mapboxgl-ctrl-group {
    background: #000000 !important;
    border: 1px solid #ffffff !important;
}

.mapboxgl-ctrl-fullscreen span {
    filter: invert(1);
}

.mapboxgl-user-location-dot {
    background-image: url('ubicacion.png') !important; 
    background-size: contain !important;
    background-repeat: no-repeat !important;
    width: 28px !important; 
    height: 28px !important;
    background-color: transparent !important; 
    border: none !important;
    box-shadow: none !important; 
}

.mapboxgl-user-location-dot::before, 
.mapboxgl-user-location-dot::after {
    display: none !important;
}

#alert-container {
    position: absolute;
    top: 50px;
    right: 20px;
    width: 360px; 
    z-index: 5000;
    display: none;
}

.banner-sismo {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2); 
    border-radius: 12px; 
    color: white; 
    padding: 15px 20px;
    height: auto;
    min-height: 85px;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    transition: all 0.5s ease;
}

#logo-sasepa-alerta {
    position: absolute;
    top: 11px;    
    right: 15px;
    width: 30px;
    opacity: 0.6;
    filter: brightness(1.2);
}

.deteccion-contenedor {
    margin-top: 0;
    width: calc(100% - 40px); 
}

#alert-zone {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 800;
    margin-bottom: 2px;
}

#alert-title {
    font-size: 22px !important; 
    margin: 0 !important;
    font-weight: 900;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.info-grid-horizontal {
    display: flex;
    justify-content: flex-start;
    gap: 25px;
    align-items: center;
    width: 100%;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.info-grid-horizontal p {
    flex-direction: row !important;
    gap: 6px;
    font-size: 10px;
    align-items: baseline;
    margin: 0;
}

.label-mini { 
    font-size: 9px;
    text-transform: uppercase; 
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700; 
    letter-spacing: 0.5px;
    margin-bottom: 0 !important;
    display: inline-block !important;
}

.info-grid-horizontal p span {
    font-size: 18px; 
    font-weight: 900;
    margin-top: 0;
}

.btn-cerrar {
    position: absolute;
    top: 22px;            
    right: 20px;          
    width: 24px !important;  
    height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    color: #ff0000 !important;
    border: none !important;
    border-radius: 6px;   
    font-size: 16px !important; 
    font-weight: 900 !important; 
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
}

.btn-cerrar:hover {
    background: #ffffff !important;
    transform: scale(1.15) rotate(90deg); /* Se agranda y gira sutilmente */
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

.btn-cerrar * {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.btn-cerrar::before {
    content: "✕" !important; 
    display: block !important;
    line-height: 1 !important;
    visibility: visible !important;
}

#alert-percepcion {
    margin-top: 12px;
    font-size: 11px;
    color: #eee;
    background: rgba(255, 255, 255, 0.07);
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid rgba(255, 255, 255, 0.2);
}

.fuerte-glow {
    animation: glow-red 1.2s infinite alternate;
    background: linear-gradient(180deg, #ff0000 0%, #440000 100%) !important;
}

.moderado-glow {
    animation: glow-blue 1.2s infinite alternate;
    background: linear-gradient(180deg, #03017c 0%, #1a1c77 100%) !important;
}

@keyframes glow-red {
    from { box-shadow: 0 0 10px #ff0000; border-color: #ff0000; }
    to { box-shadow: 0 0 40px #ff0000, inset 0 0 20px #ff0000; border-color: #ffffff; }
}

@keyframes glow-blue {
    from { box-shadow: 0 0 10px #0055ff; border-color: #0055ff; }
    to { box-shadow: 0 0 40px #0055ff, inset 0 0 20px #0055ff; border-color: #ffffff; }
}

.fuerte-glow #alert-eta, 
.fuerte-glow #alert-mag { 
    color: #ffffff !important; 
}

.moderado-glow #alert-eta { 
    color: #ffff00 !important; 
}

#panel-historial {
    position: absolute; 
    top: 80px;
    left: 20px;
    transform: translateX(-120%);
    width: 350px; 
    height: calc(100% - 220px);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    border-left: 6px solid var(--green-alert);
    color: white; 
    z-index: 4000; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    padding: 20px; 
    overflow-y: auto; 
    border-radius: 0 15px 15px 0;
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
}

#panel-historial.active { 
    transform: translateX(0);
    pointer-events: auto; 
}

.close-historial {
    float: right;
    cursor: pointer;
    color: #ff5555;
    font-size: 11px;
    font-weight: bold;
    border: 1px solid #ff5555;
    padding: 2px 6px;
    border-radius: 4px;
}

#cuenta-regresiva {
    position: absolute;
    bottom: 85px; 
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    background: rgba(15, 15, 15, 0.9);
    border: 1px solid #47D673; 
    border-radius: 4px;
    padding: 6px 12px;
    z-index: 1000;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.countdown-label {
    font-size: 9px;
    color: #facc15;
    font-weight: bold;
    text-transform: uppercase;
    margin-right: 12px;
    border-right: 1px solid #444;
    padding-right: 12px;
    line-height: 1.1;
    text-align: left;
}

.countdown-values {
    display: flex;
    gap: 10px;
}

.countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.countdown-number {
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    line-height: 1;
}

.countdown-tag {
    font-size: 8px;
    color: #888;
    text-transform: uppercase;
    margin-top: 2px;
}

.leyenda {
    position: absolute;
    bottom: 30px;
    left: 20px;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid #444;
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-family: 'Roboto', sans-serif;
    z-index: 1000;
    width: 320px; 
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 4px 10px;
    /* AGREGADO PARA ANIMACIÓN */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.leyenda-titulo { grid-column: span 2; font-size: 11px; font-weight: 900; color: #00E4E8; text-align: center; border-bottom: 1px solid #333; padding-bottom: 5px; text-transform: uppercase; }
.separador-leyenda { grid-column: span 2; height: 1px; background: #333; margin: 4px 0; }
.leyenda-item { display: flex; align-items: center; }
.leyenda-item span { font-size: 8.5px; text-transform: uppercase; font-weight: 600; }

.difusion-simb { width: 14px; height: 14px; border-radius: 50%; background: transparent; margin-right: 8px; }
.d-fuerte { border: 2.5px solid #ff0000; }
.d-moderado { border: 2.5px solid #ffff00; }
.d-ligero { border: 2.5px solid #0000ff; }
.d-impercep { border: 2.5px solid #00ff00; }

.ciudad-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; margin-right: 8px; }
.c-rojo { background: #ff0000; }
.c-amarillo { background: #ffff00; }
.c-azul { background: #0000ff; }
.c-verde { background: #00ff00; }

.onda-p-simb { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.5); background: rgba(128,128,128,0.2); border-radius: 50%; margin-right: 8px; }
.onda-s-simb { width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; }
.s-roja { background: rgba(255,0,0,0.4); border: 1.5px solid #ff0000; }
.s-verde-amarillo { background: rgba(149,209,23,0.3); border: 1.5px solid #95D117; }
.epicentro-simb { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; margin-right: 8px; }
.e-rojo { background: #E05516; }
.e-verde-amarillo { background: #95D117; }
.historial-simb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 1.5px solid #E05516; margin-right: 8px; animation: blink 1s infinite; }
.icon-ubi { width: 14px; height: 14px; margin-right: 8px; }

.estado-sistema-leyenda {
    grid-column: span 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 10px;
    margin-top: 5px;
    border-top: 1px solid #333;
    font-size: 11px;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 1px;
}

.estado-sistema-leyenda i {
    color: #00ff00;
    font-size: 12px;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.leyenda.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    pointer-events: none;
}

#cuadro-ciudades {
    transition: left 0.4s ease, width 0.4s ease, font-size 0.4s ease;
}

.cerrar-leyenda {
    position: absolute;
    top: 5px;
    right: 10px;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    transition: 0.2s;
}

.cerrar-leyenda:hover {
    color: #ff0000;
}

.deteccion-contenedor {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); 
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 12px;
    display: inline-block;
}

.dot.online {
    background: var(--green-alert);
    box-shadow: 0 0 10px var(--green-alert);
}

.dot.fuerte { background: var(--red-alert); } 
.dot.moderado { background: #ffff00; }             
.dot.ligero { background: var(--blue-alert); }

.dot.onda-p {
    background: transparent;
    border: 2px solid #facc15;
}

.dot.onda-s {
    background: rgba(255, 0, 0, 0.3);
    border: 1.5px solid #ff0000;
}

#btn-status {
    color: #00ff00; 
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: #0a0a0a;
    border-top: 6px solid var(--green-alert);
    padding: 40px;
    width: 90%;
    max-width: 420px;
    border-radius: 20px;
    text-align: center;
    color: #fff;
}

@media (max-width: 600px) {
    #alert-container { top: 0; right: 0; left: 0; width: 100%; }
    .banner-sismo { border-radius: 0 0 15px 15px; width: 100%; }
}

#btn-toggle-ui {
    position: fixed;
    bottom: 100px; 
    right: 20px;
    z-index: 10000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    color: #3b82f6;
    border: 2px solid #3b82f6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
}

#btn-toggle-ui:hover {
    background: #3b82f6;
    color: white;
}

#cuenta-regresiva, 
.top-bar {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#lista-historial-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.historial-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 5px solid #555;
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.historial-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
    border-color: rgba(255, 255, 255, 0.3);
}

.hist-fuerte { border-left-color: var(--red-alert) !important; box-shadow: inset 5px 0 15px rgba(255, 0, 0, 0.1); }
.hist-mod { border-left-color: #ffff00 !important; box-shadow: inset 5px 0 15px rgba(255, 255, 0, 0.05); }
.hist-ligero { border-left-color: var(--blue-alert) !important; }

.historial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.historial-fecha {
    font-size: 10px;
    color: #aaa;
    font-family: 'Courier New', monospace;
}

.historial-tag {
    font-size: 9px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.historial-zona {
    display: block;
    font-size: 14px;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.historial-footer {
    margin-top: 8px;
    font-size: 9px;
    color: #666;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 5px;
}

#reloj {
    position: fixed;
    bottom: 5px;
    right: 25px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    border-right: 4px solid #00E4E8;
    padding: 12px 18px;
    border-radius: 6px;
    z-index: 9999;
    font-family: 'Courier New', monospace;
    text-align: right;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    pointer-events: none; 
}

#hora-cdmx {
    color: #00E4E8;
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 1px;
}

#fecha-cdmx {
    color: #ffffff;
    font-size: 14px;
    margin-top: 5px;
    opacity: 0.9;
}

.tag-sasepa {
    color: #4ade80; 
    font-size: 9px;
    font-weight: bold;
    margin-top: 6px;
    text-transform: uppercase;
}

.dot.sismo-ligero {
    width: 12px;
    height: 12px;
    background-color: #007cff;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid #fff;
    box-shadow: 0 0 8px #007cff;
    position: relative;
}

.dot.sismo-ligero::after {
    content: "";
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid #007cff;
    border-radius: 50%;
    animation: pulse 2s infinite;
    opacity: 0;
}

.dot.sismo-fuerte {
    width: 12px;
    height: 12px;
    background-color: #ff0000;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid #fff;
    box-shadow: 0 0 8px #ff0800;
    position: relative;
}

.dot.sismo-fuerte::after {
    content: "";
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid #ff5100;
    border-radius: 50%;
    animation: pulse 2s infinite;
    opacity: 0;
}

.mapboxgl-canvas {
    width: 100% !important;
    height: 100% !important;
}

.btn-icono.activo {
    background: #51f073 !important;
    color: rgb(4, 255, 4) !important;
    box-shadow: 0 0 10px #b0ff56;
}

@keyframes pulse {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.contenedor-controles-manuales {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    display: flex;
    flex-direction: row;
    gap: 10px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 12px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.contenedor-controles-manuales.ui-hidden-bottom {
    transform: translateX(-50%) translateY(150%) !important;
    opacity: 0 !important;
    pointer-events: none;
}

.logos-sasepa-fondo {
    position: fixed;
    bottom: 89px;         
    left: 89%;
    transform: translateX(-50%);
    width: 60%;            
    max-width: 1000px;      
    display: flex;
    justify-content: center; 
    align-items: center;
    gap: 60px;            
    z-index: 5;
    pointer-events: none;
    user-select: none;
}

.logos-sasepa-fondo img {
    height: 200px;         
    width: auto;
    opacity: 0.6;        
    filter: drop-shadow(0px 0px 5px rgba(0,0,0,0.5));
    transition: all 0.3s ease;
}

.logos-sasepa-fondo:hover img {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .logos-sasepa-fondo {
        gap: 25px;
        bottom: 60px;
    }
    .logos-sasepa-fondo img {
        height: 35px;
    }
}
