/* ========================================
   DASHBOARD.CSS - TOTIZSHIELD v2.0
   ======================================== */

/* ========== TOKENS ========== */
:root {
    --bg: #0a0a0a;
    --surface: #131313;
    --surface-2: #1a1a1a;
    --border: #262626;
    --border-soft: #1f1f1f;
    --text: #eaeaea;
    --text-muted: #888888;
    --text-dim: #5c5c5c;
    --accent: #297bd9;
    --accent-dim: #1f7d49;
    --accent-soft: rgba(41, 123, 217);
    --danger: #ff4d4d;
    --danger-soft: rgba(255, 77, 77, 0.10);
    --warning: #ffb020;
    --font-display: 'Space Mono', monospace;
    --font-body: 'Inter', sans-serif;
    --radius: 4px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

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

html,
body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--accent-dim);
    color: #000;
}

a {
    color: var(--accent);
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input {
    font-family: inherit;
}

/* ========== SCANLINE OVERLAY ========== */
.scan-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image: repeating-linear-gradient(0deg,
            rgba(255, 255, 255, 0.012) 0px,
            rgba(255, 255, 255, 0.012) 1px,
            transparent 1px,
            transparent 3px);
    mix-blend-mode: overlay;
}

/* ========================================
   LOGIN SCREEN
   ======================================== */
#login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 44px 40px 36px;
    position: relative;
    box-shadow: var(--shadow);
}

.login-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.login-eyebrow {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.6s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 var(--accent-soft);
    }
    50% {
        opacity: 0.4;
    }
}

.login-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}

.login-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 32px;
    line-height: 1.5;
}

.login-error {
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid rgba(255, 77, 77, 0.3);
    padding: 10px 12px;
    display: none;
}

.login-error.visible {
    display: block;
}

.login-foot {
    margin-top: 24px;
    font-size: 11px;
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-soft);
    padding-top: 16px;
}

/* ========================================
   FORMULARIOS
   ======================================== */
.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.field input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    border-radius: var(--radius);
}

.field input:focus {
    border-color: var(--accent);
}

.field input::placeholder {
    color: var(--text-dim);
}

.btn-primary {
    width: 100%;
    background: var(--accent);
    color: #06150d;
    border: none;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 13px;
    margin-top: 6px;
    transition: opacity 0.15s;
    border-radius: var(--radius);
}

.btn-primary:hover {
    opacity: 0.88;
}

.btn-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 8px 14px;
    font-size: 12px;
    letter-spacing: 0.04em;
    border-radius: var(--radius);
    transition: all 0.15s;
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ========================================
   DASHBOARD
   ======================================== */
#dashboard {
    display: none;
    position: relative;
    z-index: 2;
    min-height: 100vh;
}

/* ========== TOPBAR ========== */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-wrap: wrap;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.04em;
}

.brand-mark {
    width: 18px;
    height: 18px;
    background: var(--accent);
    clip-path: polygon(50% 0%, 100% 25%, 100% 70%, 50% 100%, 0% 70%, 0% 25%);
}

.status-line {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
}

.dot.dot-bad {
    background: var(--danger);
}

#live-clock {
    font-family: var(--font-display);
    color: var(--text);
}

/* ========== MAIN ========== */
main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px;
}

/* ========== STATS GRID ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: var(--border);
    margin-bottom: 28px;
    border: 1px solid var(--border);
}

.stat-card {
    background: var(--surface);
    padding: 20px 22px;
}

.stat-label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-value .unit {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 4px;
}

.stat-sub {
    font-size: 11.5px;
    color: var(--text-dim);
    margin-top: 8px;
}

.stat-accent {
    color: var(--accent);
}

/* ========== PANELS ========== */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
    gap: 14px;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 13px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 9px 12px;
    font-size: 12.5px;
    outline: none;
    border-radius: var(--radius);
}

.range-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.range-toggle button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 14px;
    font-size: 12px;
    letter-spacing: 0.03em;
    border-right: 1px solid var(--border);
    transition: all 0.15s;
}

.range-toggle button:last-child {
    border-right: none;
}

.range-toggle button.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.panel-body {
    padding: 22px;
}

/* ========== CHART ========== */
.chart-wrap {
    position: relative;
    height: 360px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 360px;
    color: var(--text-dim);
    text-align: center;
    gap: 8px;
}

.empty-state .t {
    color: var(--text-muted);
    font-size: 13px;
}

.empty-state .s {
    font-size: 11.5px;
    max-width: 320px;
}

/* ========== TABLE ========== */
.rooms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.rooms-table th {
    text-align: left;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 0 0 12px;
    border-bottom: 1px solid var(--border-soft);
}

.rooms-table td {
    padding: 13px 0;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text);
}

.rooms-table tr:last-child td {
    border-bottom: none;
}

.room-name {
    font-weight: 600;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 3px 9px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 20px;
}

.badge.live {
    color: var(--accent);
    border-color: var(--accent-dim);
}

.count-num {
    font-family: var(--font-display);
    font-weight: 700;
}

/* ========== FOOTER ========== */
footer {
    text-align: center;
    padding: 24px;
    color: var(--text-dim);
    font-size: 11.5px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .topbar {
        padding: 14px 16px;
    }

    main {
        padding: 16px;
    }

    .panel-body {
        padding: 16px;
    }

    .chart-wrap,
    .empty-state {
        height: 280px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .login-card {
        padding: 30px 20px;
    }

    .controls {
        width: 100%;
    }

    .range-toggle {
        width: 100%;
    }

    .range-toggle button {
        flex: 1;
        text-align: center;
    }

    .rooms-table {
        font-size: 11px;
    }

    .rooms-table td,
    .rooms-table th {
        padding: 8px 4px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .status-line {
        gap: 10px;
        font-size: 11px;
    }

    .brand {
        font-size: 14px;
    }

    .login-title {
        font-size: 22px;
    }
}
