/* ==========================================================================
   Quake Toast Notification
   ========================================================================== */
#quake-toast {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(10, 15, 30, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 14px 20px;
    z-index: 2000;
    min-width: 280px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    display: flex !important;
    align-items: center;
    gap: 14px;
}

#quake-toast.toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-mag {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    color: #fff;
    flex-shrink: 0;
}

.toast-info {
    flex: 1;
    min-width: 0;
}

.toast-info .toast-place {
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-info .toast-time {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.toast-info .toast-source {
    font-size: 10px;
    color: #38bdf8;
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Base Styles & Variables
   ========================================================================== */
:root {
    --bg-dark: #0f111a;
    --panel-bg: rgba(20, 24, 36, 0.75);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    
    /* Earthquake Colors */
    --mag-low: #38bdf8;
    --mag-med: #fbbf24;
    --mag-high: #ef4444;
    --mag-extreme: #9f1239;
    
    /* Effects */
    --blur: blur(16px);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

.lang-selector {
    display: flex;
    gap: 4px;
    margin-top: 12px;
}

.lang-selector button {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    padding: 5px 10px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    letter-spacing: 0.5px;
    flex: 1;
    text-align: center;
}

.lang-selector button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}

.lang-selector button.active {
    background: var(--mag-low);
    color: #000;
    border-color: var(--mag-low);
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* ==========================================================================
   Layout
   ========================================================================== */
#app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ==========================================================================
   Sidebar (Glassmorphism)
   ========================================================================== */
#sidebar {
    width: 380px;
    height: 100%;
    background: var(--panel-bg);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: var(--shadow);
    position: relative;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar.collapsed {
    margin-left: -380px;
}

#sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -24px;
    width: 24px;
    height: 48px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-left: none;
    color: white;
    cursor: pointer;
    border-radius: 0 8px 8px 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    transform: translateY(-50%);
    box-shadow: 4px 0 8px rgba(0,0,0,0.2);
    font-size: 10px;
    transition: all 0.3s ease;
}

#sidebar-toggle:hover {
    background: rgba(40, 50, 70, 0.85);
    color: var(--mag-low);
}

#sidebar.collapsed #sidebar-toggle {
    transform: translateY(-50%) rotate(180deg);
    border-radius: 8px 0 0 8px;
    right: -24px;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--panel-border);
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.sidebar-header p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 0;
}

.stats-container {
    display: flex;
    gap: 16px;
}

.stat-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: transform 0.2s;
}

.stat-box:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.stat-box span {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--mag-low);
    margin-bottom: 4px;
}

#max-mag {
    color: var(--mag-high);
}

.stat-box label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.quake-list-header {
    padding: 16px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filters-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filters-container select {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 11px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.filters-container select option {
    background: var(--bg-dark);
}

/* List of Earthquakes */
.quake-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    min-height: 0; /* necesario para scroll dentro de flex */
}

.quake-list::-webkit-scrollbar {
    width: 6px;
}

.quake-list::-webkit-scrollbar-track {
    background: transparent;
}

.quake-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.quake-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Tarjeta del sismo más reciente — efecto radar pulsante */
.quake-card.latest-alert {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.5);
    animation: latest-card-pulse 1.6s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.quake-card.latest-alert::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(239,68,68,0.12), transparent);
    animation: latest-card-sweep 2s linear infinite;
}

@keyframes latest-card-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.0), inset 0 0 0 1px rgba(239,68,68,0.5); }
    50%       { box-shadow: 0 0 18px 4px rgba(239,68,68,0.35), inset 0 0 0 1px rgba(239,68,68,0.9); }
}

@keyframes latest-card-sweep {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Tarjetas 2 y 3 (amarillo/verde) — pulso suave */
.quake-card.recent-alert-yellow {
    background: rgba(251, 191, 36, 0.06);
    border-color: rgba(251, 191, 36, 0.5);
    position: relative;
    overflow: hidden;
    animation: recent-pulse-yellow 2s ease-in-out infinite;
}
.quake-card.recent-alert-yellow::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(251,191,36,0.10), transparent);
    animation: latest-card-sweep 2.5s linear infinite;
}
@keyframes recent-pulse-yellow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(251,191,36,0.0); }
    50%       { box-shadow: 0 0 14px 3px rgba(251,191,36,0.25); }
}

.quake-card.recent-alert-green {
    background: rgba(34, 197, 94, 0.06);
    border-color: rgba(34, 197, 94, 0.5);
    position: relative;
    overflow: hidden;
    animation: recent-pulse-green 2.4s ease-in-out infinite;
}
.quake-card.recent-alert-green::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(34,197,94,0.10), transparent);
    animation: latest-card-sweep 3s linear infinite;
}
@keyframes recent-pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.0); }
    50%       { box-shadow: 0 0 14px 3px rgba(34,197,94,0.25); }
}

/* Indicador de "EN VIVO" en el badge de magnitud */
.quake-mag.live-mag {
    animation: live-mag-pop 1.6s ease-in-out infinite;
}

@keyframes live-mag-pop {
    0%, 100% { transform: scale(1);    filter: brightness(1); }
    50%       { transform: scale(1.15); filter: brightness(1.4); }
}

.quake-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--panel-border);
    transform: translateX(4px);
}

.quake-mag {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

.quake-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

.quake-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
    animation: pulse 1.5s infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--mag-low);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* ==========================================================================
   Map Area
   ========================================================================== */
#map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark);
}

/* Floating Legend */
.map-legend {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: var(--panel-bg);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    padding: 16px 20px;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.map-legend h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    margin-bottom: 8px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot-low { background: var(--mag-low); box-shadow: 0 0 10px var(--mag-low); }
.dot-med { background: var(--mag-med); box-shadow: 0 0 10px var(--mag-med); }
.dot-high { background: var(--mag-high); box-shadow: 0 0 10px var(--mag-high); }

/* ==========================================================================
   Custom Leaflet Overrides
   ========================================================================== */
/* Hide attribution to make it look cleaner */
.leaflet-control-attribution {
    display: none !important;
}

/* Custom Popup Styling */
.leaflet-popup-content-wrapper {
    background: var(--panel-bg);
    backdrop-filter: var(--blur);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.leaflet-popup-tip {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
}

.popup-custom h3 {
    font-size: 15px;
    margin-bottom: 8px;
    font-weight: 600;
}

.popup-custom p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 4px 0;
}

/* Earthquake Marker Animations */
.quake-marker {
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.3);
    animation: markerPulse 2s infinite ease-out;
}

@keyframes markerPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* ==========================================================================
   Tectonic Plates & Map Controls
   ========================================================================== */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--panel-bg);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    z-index: 1000;
    box-shadow: var(--shadow);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.controls-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 8px;
}

#controls-toggle {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#controls-toggle:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

#controls-body {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 400px;
    opacity: 1;
}

#controls-body.collapsed {
    max-height: 0;
    opacity: 0;
}

.map-controls label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   Tsunami Alerts
   ========================================================================== */
.tsunami-alert-card {
    border: 1px solid #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.tsunami-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 6px;
    animation: flashRed 2s infinite;
}

.tsunami-badge-popup {
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    text-align: center;
    animation: flashRed 2s infinite;
}

.tsunami-marker {
    border-radius: 50%;
    animation: tsunamiPulse 1.5s infinite ease-out;
}

@keyframes flashRed {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes tsunamiPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* ==========================================================================
   New Controls & Badges (Volcanoes, PAGER, Depth)
   ========================================================================== */
.control-divider {
    height: 1px;
    background: var(--panel-border);
    margin: 8px 0;
}

.small-select {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 11px;
    outline: none;
    margin-left: 4px;
}

.small-select option {
    background: var(--bg-dark);
}

.volcano-icon {
    font-size: 14px;
    text-align: center;
    text-shadow: 0 0 5px #ef4444;
}

.station-icon {
    font-size: 12px;
    text-align: center;
    color: #38bdf8;
    text-shadow: 0 0 3px #000;
}

.alert-badge {
    display: inline-block;
    color: #000;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 6px;
    margin-right: 4px;
}
.alert-green { background: #4ade80; }
.alert-yellow { background: #facc15; }
.alert-orange { background: #fb923c; color: #fff; }
.alert-red { background: #ef4444; color: #fff; animation: flashRed 2s infinite; }

.felt-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 6px;
}

/* Latest Marker Pulse */
.latest-pulse-icon {
    pointer-events: none; /* Deja que el clic pase al marcador real */
}

.pulse-ring {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #ef4444;
    animation: latestPulseAnim 1.5s infinite ease-out;
    box-sizing: border-box;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.pulse-ring.selected-pulse {
    border-color: #06b6d4;
    animation: latestPulseAnim 0.6s infinite ease-out;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

@keyframes latestPulseAnim {
    0% { transform: scale(0.1); opacity: 1; border-width: 3px; }
    70% { transform: scale(2); opacity: 0; border-width: 1px; }
    100% { transform: scale(2); opacity: 0; border-width: 1px; }
}

/* ==========================================================================
   Responsive — Tablet (≤ 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
    #sidebar { width: 300px; }

    .sidebar-header { padding: 18px 18px 14px; }
    .sidebar-header h1 { font-size: 20px; }

    .quake-list-header { padding: 12px 18px; }
    .quake-list { padding: 10px; }

    .map-controls { font-size: 12px; }
}

/* ==========================================================================
   Responsive — Mobile (≤ 768px)
   ========================================================================== */
@media (max-width: 768px) {
    body { overflow: hidden; }

    /* Apilar verticalmente: mapa arriba, sidebar abajo */
    #app-container {
        flex-direction: column;
    }

    #map-container {
        width: 100%;
        height: 60vh;
        flex-shrink: 0;
        order: 1;
    }

    #sidebar {
        width: 100%;
        height: 40vh;
        border-right: none;
        border-top: 1px solid var(--panel-border);
        order: 2;
        overflow: hidden;
    }

    /* Header compacto — título e idiomas ocultos */
    .sidebar-header {
        padding: 6px 12px;
        border-bottom: 1px solid var(--panel-border);
    }

    .sidebar-header h1 { display: none; }
    .sidebar-header #txt-subtitle { display: none; }

    /* Idiomas: ocultos en móvil (se accede al idioma antes de abrir en móvil) */
    .lang-selector { display: none; }

    /* Stats en fila compacta */
    .stats-container { gap: 6px; margin-top: 0; }
    .stat-box { padding: 5px 8px; border-radius: 7px; }
    .stat-box span { font-size: 15px; margin-bottom: 1px; }
    .stat-box label { font-size: 8px; }

    /* Filtros */
    .quake-list-header {
        padding: 5px 12px;
        font-size: 11px;
    }
    .filters-container { gap: 4px; }
    .filters-container select {
        font-size: 9px;
        padding: 3px 4px;
        max-width: 100px;
    }

    /* Lista — min-height:0 es necesario para que flex no la expanda fuera del contenedor */
    .quake-list { padding: 6px; min-height: 0; }
    .quake-card { padding: 8px 10px; gap: 9px; margin-bottom: 5px; }
    .quake-mag { width: 36px; height: 36px; font-size: 13px; }
    .quake-info h4 { font-size: 11px; }
    .quake-info p { font-size: 9px; }
    .alert-badge, .felt-badge, .tsunami-badge { font-size: 8px; padding: 1px 4px; }

    /* Botón play/pausa del tour 3D */
    #globe-tour-btn { bottom: 12px !important; left: 12px !important; width: 34px !important; height: 34px !important; font-size: 14px !important; }

    /* Panel de controles: esquina superior derecha, colapsado por defecto */
    .map-controls {
        top: 8px;
        right: 8px;
        left: auto;
        padding: 7px 12px;
        font-size: 11px;
        max-width: 210px;
    }
    /* Auto-colapsar en mobile vía JS — ver app.js initMobileControls */
    #controls-body { font-size: 11px; }
    #controls-body label { gap: 5px; margin-bottom: 4px; }
    .control-divider { margin: 5px 0; }
    .small-select { font-size: 10px; }

    /* Leyenda: esquina inferior izquierda para no chocar con controles */
    .map-legend {
        bottom: 8px;
        right: 8px;
        left: auto;
        padding: 8px 12px;
        border-radius: 8px;
    }
    .map-legend h4 { font-size: 10px; margin-bottom: 6px; }
    .legend-item { font-size: 10px; gap: 7px; margin-bottom: 5px; }
    .dot { width: 9px; height: 9px; }

    /* Toast: ancho completo en mobile */
    #quake-toast {
        bottom: 8px;
        left: 10px;
        right: 10px;
        transform: translateY(20px);
        min-width: unset;
        max-width: unset;
        width: calc(100% - 20px);
    }
    #quake-toast.toast-visible {
        transform: translateY(0);
    }
    .toast-mag { width: 38px; height: 38px; font-size: 13px; }
    .toast-info .toast-place { font-size: 12px; }
}

/* ==========================================================================
   Responsive — Mobile muy pequeño (≤ 380px)
   ========================================================================== */
@media (max-width: 380px) {
    #map-container { height: 50vh; }
    #sidebar { height: 50vh; }

    .sidebar-header { padding: 8px 10px 6px; }
    .sidebar-header h1 { font-size: 15px; }
    .stat-box span { font-size: 18px; }

    .filters-container select { max-width: 90px; font-size: 9px; }

    .map-controls { max-width: 170px; font-size: 10px; }
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
#loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-left-color: #38bdf8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
}
/* ==========================================================================
   Floating Persistent Alerts
   ========================================================================== */
#alert-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 320px;
    pointer-events: none;
}

.floating-alert-card {
    background: rgba(15, 17, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-left: 5px solid #ef4444;
    border-radius: 10px;
    padding: 12px 16px;
    color: #fff;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    pointer-events: auto;
    animation: alertSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s ease;
}

@keyframes alertSlideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.floating-alert-card .alert-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

.floating-alert-card .alert-close:hover {
    background: rgba(239, 68, 68, 0.4);
}

.floating-alert-card h5 {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 6px;
}

.floating-alert-card .alert-place {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.floating-alert-card .alert-meta {
    font-size: 11px;
    color: #94a3b8;
}

.floating-alert-card .alert-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.floating-alert-card .alert-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fff;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.floating-alert-card .alert-btn:hover {
    background: rgba(239, 68, 68, 0.4);
}
