/* ==========================================================================
   ATOM CCTV - SISTEMA DE VIDEOVIGILANCIA
   Hoja de Estilos Completa (Diseño Exacto Consola NVR Oscura)
   ========================================================================== */

:root {
    --bg-app: #0b101e;
    --bg-header: #101729;
    --bg-sidebar: #111827;
    --bg-panel: #151e31;
    --bg-card: #161f33;
    --bg-input: #0d1424;
    --border-color: #1f2b42;
    --border-highlight: #2b3b59;
    --primary-blue: #0066ff;
    --primary-blue-hover: #1a75ff;
    --accent-cyan: #38bdf8;
    --text-main: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --green-online: #22c55e;
    --red-alert: #ef4444;
    --orange-detect: #f97316;
    --yellow-folder: #f59e0b;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   BARRA SUPERIOR (TOPBAR)
   ========================================================================== */
.topbar {
    height: 50px;
    background: linear-gradient(180deg, #141d33 0%, #0e1526 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 0 12px;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-main);
    min-width: 175px;
}

.brand-logo-img {
    height: 38px;
    width: auto;
    display: block;
    object-fit: contain;
}

.brand-fallback {
    display: none;
}

.brand-logo-img[style*="none"] + .brand-fallback {
    display: flex;
    flex-direction: column;
}

.brand-atom {
    font-weight: 800;
    font-size: 18px;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.brand-cctv {
    font-weight: 800;
    font-size: 18px;
    color: #f97316;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #cbd5e1;
    height: 36px;
    padding: 0 14px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.nav-btn.active {
    background: linear-gradient(180deg, #0a74ff 0%, #005ce6 100%);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 102, 255, 0.4);
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.db-status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border-color);
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    color: var(--text-secondary);
}

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

.status-dot.online {
    background: var(--green-online);
    box-shadow: 0 0 6px var(--green-online);
}

.status-dot.warn {
    background: var(--yellow-folder);
}

.notif-btn {
    position: relative;
    background: transparent;
    border: none;
    color: #cbd5e1;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.notif-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.notif-wrap {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 15px;
    height: 15px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.notif-badge.hidden {
    display: none;
}

.notif-dropdown {
    display: none;
    position: absolute;
    top: 40px;
    right: 0;
    width: 320px;
    background: #141d30;
    border: 1px solid #2b3c5e;
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    z-index: 80;
    overflow: hidden;
}

.notif-dropdown.show {
    display: block;
}

.notif-dropdown-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #1f2b44;
    font-size: 12px;
}

.notif-dropdown-head button {
    background: none;
    border: none;
    color: #38bdf8;
    cursor: pointer;
    font-size: 11px;
}

.notif-item {
    width: 100%;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: #e2e8f0;
    text-align: left;
    cursor: pointer;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-item.unread {
    background: rgba(0, 102, 255, 0.08);
}

.notif-item img {
    width: 42px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
}

.notif-item span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-item small {
    color: #94a3b8;
    font-size: 10px;
}

.notif-view-all {
    width: 100%;
    padding: 10px;
    background: #101728;
    border: none;
    border-top: 1px solid #1f2b44;
    color: #3b82f6;
    cursor: pointer;
    font-size: 12px;
}

.user-profile-box {
    display: flex;
    align-items: center;
    gap: 9px;
    background: #172136;
    border: 1px solid #263554;
    padding: 4px 12px 4px 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.user-profile-box:hover {
    border-color: #3b82f6;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.user-name {
    font-size: 12px;
    font-weight: 600;
    color: #f8fafc;
}

.user-role {
    font-size: 10.5px;
    color: #94a3b8;
}

.window-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    padding-left: 8px;
    border-left: 1px solid var(--border-color);
}

.win-btn {
    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    color: #94a3b8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    font-size: 12px;
}

.win-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.win-btn.win-close:hover {
    background: #ef4444;
    color: #fff;
}

/* ==========================================================================
   WORKSPACE Y PESTAÑAS
   ========================================================================== */
.workspace {
    height: calc(100vh - 50px);
    width: 100%;
    position: relative;
}

.tab-panel {
    display: none;
    width: 100%;
    height: 100%;
}

.tab-panel.active {
    display: flex;
}

/* ==========================================================================
   SIDEBAR IZQUIERDO: CÁMARAS Y VISTAS
   ========================================================================== */
.left-sidebar {
    width: 185px;
    min-width: 185px;
    height: 100%;
    background: #101726;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px 0;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
}

.cameras-section {
    flex: 1;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px 8px;
    font-size: 11.5px;
    font-weight: 700;
    color: #cbd5e1;
    letter-spacing: 0.5px;
}

.sidebar-close-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 15px;
    cursor: pointer;
    line-height: 1;
}

.sidebar-close-btn:hover {
    color: #fff;
}

.sidebar-add-btn {
    width: 19px;
    height: 19px;
    border: 1px solid #38bdf8;
    border-radius: 5px;
    background: #10253b;
    color: #7dd3fc;
    font-size: 16px;
    line-height: 15px;
    cursor: pointer;
}

.sidebar-add-btn:hover {
    background: #16456a;
    color: #fff;
}

.search-box {
    margin: 0 8px 8px;
    background: #162033;
    border: 1px solid #25334d;
    border-radius: 6px;
    height: 30px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    gap: 6px;
    color: #64748b;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-size: 11.5px;
    width: 100%;
}

.search-box input::placeholder {
    color: #64748b;
}

/* Árbol de cámaras */
.camera-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0 6px;
}

.camera-tree::-webkit-scrollbar {
    width: 4px;
}

.camera-tree::-webkit-scrollbar-thumb {
    background: #263554;
    border-radius: 4px;
}

.tree-root-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 5px;
    background: linear-gradient(90deg, #0066ff 0%, #0052cc 100%);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 4px;
}

.tree-group {
    margin-bottom: 3px;
}

.tree-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.tree-group-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.tree-caret {
    font-size: 9px;
    color: #94a3b8;
    width: 10px;
    display: inline-block;
    transition: transform 0.15s;
}

.tree-group.collapsed .tree-caret {
    transform: rotate(-90deg);
}

.tree-group.collapsed .tree-group-children {
    display: none;
}

.folder-icon {
    color: var(--yellow-folder);
    flex-shrink: 0;
}

.folder-icon-white {
    color: #ffffff;
    flex-shrink: 0;
}

.tree-group-children {
    padding-left: 14px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tree-cam-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    border-radius: 4px;
    color: #cbd5e1;
    font-size: 11.5px;
    cursor: pointer;
    transition: background 0.12s;
}

.tree-cam-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.tree-cam-item.selected {
    background: rgba(0, 102, 255, 0.22);
    color: #ffffff;
    border-left: 2px solid #0066ff;
}

.tree-cam-left {
    display: flex;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cam-bullet-icon {
    color: #cbd5e1;
    flex-shrink: 0;
}

.cam-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green-online);
    box-shadow: 0 0 5px rgba(34, 197, 94, 0.8);
    flex-shrink: 0;
}

.cam-status-dot.offline {
    background: #ef4444;
    box-shadow: none;
}

/* Sección Vistas */
.views-section {
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}

.views-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 0 6px;
}

.view-item {
    background: transparent;
    border: 1px solid transparent;
    color: #cbd5e1;
    padding: 7px 9px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.view-item small {
    color: #94a3b8;
    font-size: 11px;
}

.view-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.view-item.active {
    background: #14284b;
    border-color: #1e4280;
    color: #ffffff;
    font-weight: 600;
}

.view-item.active svg {
    color: #38bdf8;
}

/* ==========================================================================
   ZONA CENTRAL: GRILLA DE CÁMARAS Y TIMELINE
   ========================================================================== */
.center-stage {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 6px;
    gap: 6px;
    overflow: hidden;
    background: #0b101d;
}

.camera-grid {
    flex: 1;
    display: grid;
    gap: 5px;
    width: 100%;
    min-height: 0;
}

.camera-grid.grid-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.camera-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.camera-grid.grid-6 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.camera-grid.grid-8 {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* Tarjeta individual de cámara */
.cam-tile {
    position: relative;
    background: #060a12;
    border-radius: 6px;
    overflow: hidden;
    border: 1.5px solid #1e293b;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.cam-tile.active-cam {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45);
}

.cam-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    background: #050811;
}

.cam-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform-origin: center center;
    transition: transform 0.22s ease-out, filter 0.15s ease;
}

/* Efecto sutil de escaneo en vivo y telemetría IA */
.cam-live-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.18) 0%,
        transparent 18%,
        transparent 82%,
        rgba(0, 0, 0, 0.22) 100%
    );
}

.cam-scanline {
    position: absolute;
    left: 0;
    right: 0;
    height: 18%;
    pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(56, 189, 248, 0.08), transparent);
    animation: camScan 4.5s linear infinite;
}

@keyframes camScan {
    0% { top: -18%; }
    100% { top: 100%; }
}

.cam-rec-badge {
    position: absolute;
    bottom: 32px;
    left: 7px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.6px;
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 6;
    animation: pulseRec 1s infinite;
}

/* Etiquetas superpuestas en las 4 esquinas (idénticas a la imagen) */
.cam-badge-topleft {
    position: absolute;
    top: 7px;
    left: 7px;
    background: rgba(15, 20, 30, 0.82);
    backdrop-filter: blur(4px);
    padding: 4px 10px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    font-weight: 600;
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 5;
}

.cam-badge-topright {
    position: absolute;
    top: 7px;
    right: 7px;
    background: rgba(15, 20, 30, 0.82);
    backdrop-filter: blur(4px);
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 11px;
    font-family: 'Consolas', 'Courier New', monospace;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 5;
}

.cam-badge-bottomleft {
    position: absolute;
    bottom: 7px;
    left: 7px;
    background: rgba(15, 20, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    color: #cbd5e1;
    z-index: 5;
}

.cam-controls-bottomright {
    position: absolute;
    bottom: 7px;
    right: 7px;
    background: rgba(15, 20, 30, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    display: flex;
    align-items: center;
    padding: 2px 4px;
    gap: 2px;
    z-index: 5;
}

.cam-mini-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    width: 24px;
    height: 22px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.cam-mini-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.cam-mini-btn.active-mic {
    color: #22c55e;
}

/* Indicador de audio en vivo */
.cam-audio-meter {
    position: absolute;
    bottom: 34px;
    right: 9px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid #22c55e;
    border-radius: 4px;
    padding: 3px 7px;
    font-size: 10px;
    color: #22c55e;
    display: none;
    align-items: center;
    gap: 4px;
    z-index: 6;
}

.cam-audio-meter.show {
    display: flex;
}

/* ==========================================================================
   PANEL DE LÍNEA DE TIEMPO Y CONTROLES DE REPRODUCCIÓN
   ========================================================================== */
.timeline-panel {
    height: 158px;
    min-height: 158px;
    background: #111827;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.timeline-toolbar {
    height: 44px;
    min-height: 44px;
    padding: 0 12px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #131c2e;
}

.tl-left-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-picker-box {
    position: relative;
    background: #1a2438;
    border: 1px solid #2a3956;
    border-radius: 5px;
    height: 30px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #e2e8f0;
    font-size: 12px;
    cursor: pointer;
}

.date-picker-box input[type="date"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
}

.caret-down {
    font-size: 10px;
    color: #94a3b8;
}

.tl-step-btn {
    background: #1a2438;
    border: 1px solid #2a3956;
    color: #cbd5e1;
    width: 26px;
    height: 30px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
}

.tl-step-btn:hover {
    background: #24324d;
    color: #fff;
}

.tl-digital-clock {
    background: #0c2142;
    border: 1px solid #1d4ed8;
    color: #38bdf8;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13.5px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 5px;
    letter-spacing: 0.8px;
    box-shadow: inset 0 0 8px rgba(29, 78, 216, 0.35);
}

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

.tl-round-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #1b263b;
    border: 1px solid #2b3b59;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.tl-round-btn:hover {
    background: #263552;
    color: #fff;
}

.tl-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(180deg, #1d7dfa 0%, #005ce6 100%);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 102, 255, 0.5);
    transition: transform 0.12s;
}

.tl-play-btn:hover {
    transform: scale(1.05);
}

.tl-right-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.speed-select-wrapper select {
    background: #1a2438;
    border: 1px solid #2a3956;
    color: #e2e8f0;
    height: 28px;
    padding: 0 8px;
    border-radius: 5px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.tl-divider {
    width: 1px;
    height: 18px;
    background: #26334d;
}

.tl-tool-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.tl-tool-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.tl-tool-btn.recording-active {
    color: #ef4444;
    animation: pulseRec 1s infinite;
}

@keyframes pulseRec {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Pistas de Línea de Tiempo */
.timeline-tracks-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    background: #0d1322;
    padding: 2px 10px 4px 8px;
    overflow: hidden;
}

.timeline-ruler {
    display: flex;
    height: 20px;
    align-items: center;
    border-bottom: 1px solid #192338;
}

.tl-label-col {
    width: 115px;
    min-width: 115px;
    font-size: 11px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.tl-hours-col {
    flex: 1;
    position: relative;
    height: 100%;
    cursor: pointer;
}

.hour-mark {
    position: absolute;
    top: 2px;
    transform: translateX(-50%);
    font-size: 10px;
    color: #64748b;
}

.timeline-tracks-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    cursor: pointer;
}

.tl-track-row {
    display: flex;
    align-items: center;
    height: 19px;
}

.tl-track-bar {
    flex: 1;
    height: 11px;
    background: #172033;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    border: 1px solid #1e293b;
}

.tl-seg {
    position: absolute;
    top: 0;
    bottom: 0;
    height: 100%;
    border-radius: 1px;
}

.tl-seg.normal {
    background: #22c55e;
}

.tl-seg.alert {
    background: #ef4444;
}

.tl-seg.detection {
    background: #f97316;
}

/* Cabezal Playhead Azul */
.timeline-playhead {
    position: absolute;
    top: 2px;
    bottom: 0;
    width: 2px;
    pointer-events: none;
    z-index: 15;
}

.playhead-cap {
    width: 10px;
    height: 6px;
    background: #38bdf8;
    border-radius: 2px;
    transform: translateX(-4px);
    box-shadow: 0 0 6px #0066ff;
}

.playhead-line {
    width: 2px;
    height: 100%;
    background: #3b82f6;
    box-shadow: 0 0 8px #3b82f6;
}

/* ==========================================================================
   SIDEBAR DERECHO: PTZ, IMAGEN Y EVENTOS RECIENTES
   ========================================================================== */
.right-sidebar {
    width: 215px;
    min-width: 215px;
    height: 100%;
    background: #101726;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    overflow-y: auto;
}

.right-card {
    background: #141d2f;
    border: 1px solid #1f2b44;
    border-radius: 7px;
    padding: 9px 10px;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}

.selected-cam-label {
    font-size: 10px;
    color: #38bdf8;
    font-weight: 500;
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* CONTROL PTZ */
.ptz-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin: 2px 0 8px;
}

.ptz-dpad {
    width: 98px;
    height: 98px;
    border-radius: 50%;
    background: radial-gradient(circle, #1e293b 0%, #111827 100%);
    border: 2px solid #283652;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.6), 0 2px 6px rgba(0,0,0,0.4);
}

.dpad-btn {
    position: absolute;
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 10px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.12s, transform 0.1s;
}

.dpad-btn:hover {
    color: #38bdf8;
}

.dpad-btn:active {
    transform: scale(0.9);
}

.dpad-up {
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-down {
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-left {
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-right {
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1b2538, #131b2b);
    border: 1px solid #2e3e5c;
    cursor: pointer;
}

.dpad-center:hover {
    border-color: #38bdf8;
}

.ptz-zoom-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.zoom-btn {
    width: 34px;
    height: 30px;
    background: #1c273d;
    border: 1px solid #2c3b59;
    border-radius: 5px;
    color: #e2e8f0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: #263552;
    color: #fff;
}

.zoom-label {
    font-size: 10px;
    color: #94a3b8;
}

/* Sliders */
.slider-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
}

.slider-row label {
    font-size: 11px;
    color: #cbd5e1;
    min-width: 58px;
}

.slider-row input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #263552;
    border-radius: 4px;
    outline: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #0066ff;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0, 102, 255, 0.8);
}

.slider-val {
    font-size: 11px;
    color: #cbd5e1;
    width: 18px;
    text-align: right;
}

/* Botones Presets / Patrulla / AutoScan */
.ptz-Quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 4px;
}

.ptz-action-btn {
    background: #1a2438;
    border: 1px solid #263552;
    border-radius: 5px;
    padding: 6px 2px;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.ptz-action-btn:hover,
.ptz-action-btn.active {
    background: #1e3a6d;
    border-color: #3b82f6;
    color: #fff;
}

.btn-reset-image {
    margin-top: 3px;
    width: 100%;
    height: 27px;
    background: #1d283e;
    border: 1px solid #2b3a57;
    border-radius: 5px;
    color: #cbd5e1;
    font-size: 11.5px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-reset-image:hover {
    background: #273654;
    color: #fff;
}

/* EVENTOS RECIENTES */
.recent-events-card {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.view-all-link {
    color: #3b82f6;
    font-size: 10.5px;
    font-weight: 500;
    text-decoration: none;
}

.view-all-link:hover {
    text-decoration: underline;
}

.recent-events-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.recent-events-list::-webkit-scrollbar {
    width: 3px;
}

.recent-events-list::-webkit-scrollbar-thumb {
    background: #263554;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 5px;
    border-radius: 5px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background 0.15s;
}

.event-item:hover {
    background: rgba(30, 41, 59, 0.85);
}

.event-icon-Thumb {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ev-type-badge {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.ev-type-badge.alert {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.ev-type-badge.person {
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.ev-type-badge.vehicle {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.ev-thumb {
    width: 34px;
    height: 24px;
    border-radius: 3px;
    object-fit: cover;
    border: 1px solid #2b3b59;
}

.ev-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ev-title {
    font-size: 10.5px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ev-title.alert-text {
    color: #f87171;
}

.ev-cam {
    font-size: 9.5px;
    color: #94a3b8;
}

.ev-time {
    font-size: 9.5px;
    color: #94a3b8;
    font-family: 'Consolas', monospace;
}

/* ==========================================================================
   MÓDULOS SECUNDARIOS (GRABACIONES, EVENTOS, DISPOSITIVOS, USUARIOS, AJUSTES)
   ========================================================================== */
.module-panel {
    flex-direction: column;
    padding: 20px 26px;
    overflow-y: auto;
    gap: 18px;
}

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

.module-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #f8fafc;
}

.module-header p {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 3px;
}

.module-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(180deg, #0a74ff 0%, #005ce6 100%);
    border: none;
    color: #fff;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    background: #1a75ff;
}

.btn-secondary {
    background: #1e293b;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    cursor: pointer;
}

.form-control-sm {
    background: #151f33;
    border: 1px solid #2b3b59;
    color: #f1f5f9;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12.5px;
}

/* Grilla de Grabaciones */
.recordings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 16px;
}

.rec-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.rec-thumb-wrap {
    position: relative;
    height: 145px;
    background: #000;
}

.rec-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rec-duration-pill {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
}

.rec-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rec-title {
    font-weight: 600;
    font-size: 13.5px;
    color: #fff;
}

.rec-meta {
    font-size: 11.5px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.rec-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

/* Tablas de Datos */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid #1e293b;
}

.data-table th {
    background: #111827;
    color: #94a3b8;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge-pill {
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.badge-pill.online { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.badge-pill.offline { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.badge-pill.high { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.badge-pill.medium { background: rgba(249, 115, 22, 0.2); color: #fb923c; }
.badge-pill.low { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }

/* Ajustes */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 18px;
}

.settings-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-box h3 {
    font-size: 14.5px;
    color: #38bdf8;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 8px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 12px;
    color: #cbd5e1;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group select {
    background: #0d1424;
    border: 1px solid #283652;
    color: #fff;
    padding: 8px 11px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.storage-bar {
    height: 10px;
    background: #0d1424;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid #283652;
}

.storage-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066ff, #38bdf8);
}

/* ==========================================================================
   MODAL Y TOASTS
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 9, 18, 0.76);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.modal-backdrop.show {
    display: flex;
}

.modal-dialog {
    background: #141d30;
    border: 1px solid #2b3c5e;
    border-radius: 10px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65);
    overflow: hidden;
}

.modal-header {
    padding: 13px 16px;
    background: #101728;
    border-bottom: 1px solid #1f2b44;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 14.5px;
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast-container {
    position: fixed;
    bottom: 18px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast-msg {
    background: rgba(16, 24, 42, 0.95);
    border-left: 4px solid #0066ff;
    border-top: 1px solid #283654;
    border-right: 1px solid #283654;
    border-bottom: 1px solid #283654;
    color: #f8fafc;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

/* ==========================================================================
   PANTALLA DE LOGIN
   ========================================================================== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #16223b 0%, #090d18 100%);
}

.login-card {
    background: #131c2e;
    border: 1px solid #263554;
    border-radius: 12px;
    width: 100%;
    max-width: 390px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    text-align: center;
}

.login-logo-img {
    height: 46px;
    margin-bottom: 10px;
}

.login-subtitle {
    font-size: 12.5px;
    color: #94a3b8;
    margin-bottom: 20px;
}

.login-form {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.btn-block {
    width: 100%;
    padding: 10px;
    margin-top: 4px;
}

.login-alert {
    background: rgba(239, 68, 68, 0.18);
    border: 1px solid #ef4444;
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 14px;
    font-size: 12px;
}

.login-demo-hint {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid #1e293b;
    font-size: 11.5px;
    color: #64748b;
}

.login-demo-hint code {
    color: #38bdf8;
}

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

.text-muted {
    color: var(--text-muted);
    font-size: 11px;
}

.empty-state {
    padding: 22px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Badge Founder & CEO Peter Velasquez */
.badge-ceo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(59, 130, 246, 0.35);
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    color: #94a3b8;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    vertical-align: middle;
    margin-left: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.badge-ceo:hover {
    border-color: rgba(59, 130, 246, 0.7);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}
.badge-ceo strong {
    color: #f8fafc;
    font-weight: 600;
}
.brand-ceo-pill {
    margin-left: 14px;
    font-size: 11px;
}

