:root {
    /* --- VARIABLES DARK MODE (Default) --- */
    --bg-body: #121212;
    --bg-panel: rgba(30, 30, 30, 0.75);
    /* Translúcido */
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #ecf0f1;
    --text-muted: #95a5a6;
    --hover-bg: rgba(255, 255, 255, 0.1);
    --active-bg: rgba(255, 255, 255, 0.15);

    --accent-red: #e74c3c;
    --accent-orange: #f39c12;
    --accent-green: #2ecc71;
}

/* --- VARIABLES LIGHT MODE --- */
[data-theme="light"] {
    --bg-body: #f5f6fa;
    --bg-panel: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.1);
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --hover-bg: rgba(0, 0, 0, 0.05);
    --active-bg: rgba(0, 0, 0, 0.1);
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 1;
}

/* --- SIDEBAR --- */
.sidebar {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 320px;
    max-height: 90vh;
    z-index: 1000;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: background 0.3s, border-color 0.3s;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.5px;
}

/* Botón de Tema */
.icon-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--hover-bg);
}

/* Indicadores y Etiquetas */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.pulse {
    width: 8px;
    height: 8px;
    background-color: var(--accent-red);
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(231, 76, 60, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }

    100% {
        box-shadow: 0 0 0 6px rgba(231, 76, 60, 0);
    }
}

.section-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin: 0 0 10px 0;
    font-weight: 600;
}

/* --- BOTONES DE FILTRO --- */
.filter-group {
    display: flex;
    gap: 10px;
}

.filter-tgl {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-tgl:hover {
    background: var(--border-color);
}

.filter-tgl.active {
    background: var(--active-bg);
    color: var(--text-main);
    border-color: var(--text-muted);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.red {
    background: var(--accent-red);
    box-shadow: 0 0 4px var(--accent-red);
}

.dot.green {
    background: var(--accent-green);
    box-shadow: 0 0 4px var(--accent-green);
}

/* --- TABLA --- */
.stats-container {
    scroll-snap-type: y mandatory;
    overflow-y: scroll;

}

.table-wrapper {
    max-height: 400px;
}

.minimal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.minimal-table th {
    text-align: left;
    padding-bottom: 8px;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

.minimal-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.text-right {
    text-align: right;
}

.bold {
    font-weight: 600;
}

.red-text {
    color: var(--accent-red) !important;
}

.orange-text {
    color: var(--accent-orange) !important;
}

.green-text {
    color: var(--accent-green) !important;
}

.footer-info {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: auto;
}

/* --- LOGIN PAGE STYLES --- */
.login-body {
    background-color: #0f0f13;
    /* Fondo muy oscuro */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(52, 152, 219, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(231, 76, 60, 0.05) 0%, transparent 20%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 100%;
    max-width: 380px;
    padding: 40px;
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.logo-area {
    margin-bottom: 20px;
}

.login-box h1 {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 5px 0;
}

.subtitle {
    color: #7f8c8d;
    font-size: 13px;
    margin-bottom: 30px;
    letter-spacing: 0.5px;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 12px;
    color: #bdc3c7;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s;
    box-sizing: border-box;
    /* Importante para que no se salga */
}

.input-group input:focus {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.1);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #2980b9, #2ecc71);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.3);
}

.alert-error {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.5);
    color: #e74c3c;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 20px;
}

.copyright {
    margin-top: 30px;
    font-size: 11px;
    color: #555;
}