/* ============================================================
   HANWHA VISION – SISTEMA DE TEMAS (OSC/LIGHT)
   Archivo: theme.css
   Estructura 100% compatible con theme.js + data-theme
============================================================ */
/* ===============================
   RBAC – Visibilidad de tabs
=============================== */

/* Viewer */
body[data-role="viewer"] .nav-item[href*="statistics"],
body[data-role="viewer"] .nav-item[href*="monitor"],
body[data-role="viewer"] .nav-item[href*="settings"] {
  display: none !important;
}

/* Operator */
body[data-role="operator"] .nav-item[href*="settings"] {
  display: none !important;
}
/* -----------------------------
   PALETA Y VARIABLES PRINCIPALES
------------------------------*/
:root {
  --color-bg: #121212;
/*  --color-bg-alt: #1a1a1a; */
  --color-surface: #1f1f1f;

  --color-text: #e0e0e0;
  --color-text-muted: #bdbdbd;

  --color-accent: #ff9800;
  --color-accent-soft: #ffb74d;

  --card-bg: #1b1b1b;
  --card-shadow: rgba(0,0,0,0.5);
  --card-hover-shadow: rgba(255,152,0,0.25);

  font-family: Arial, sans-serif;
}

/* -----------------------------
   TEMA CLARO
------------------------------*/
[data-theme="light"] {
  --color-bg: #fafafa;
  --color-bg-alt: #ffffff;
  --color-surface: #f0f0f0;

  --color-text: #222;
  --color-text-muted: #555;

  --card-bg: #ffffff;
  --card-shadow: rgba(0,0,0,0.15);
  --card-hover-shadow: rgba(255,152,0,0.25);

  --color-accent: #ff9800;
  --color-accent-soft: #ffb74d;
}

/* ============================================================
   APLICACIÓN GLOBAL
============================================================ */
body {
  background: linear-gradient(135deg, #205a91 0%, #141414 40%, #205a91 100%);
  color: #205a91;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  transition: background 0.25s ease, color 0.25s ease;
}

/* -----------------------------
   TOPBAR / NAV
------------------------------*/
.topbar {
  color: #205a91;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-surface);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.logo {
  color: var(--color-accent);
  font-weight: bold;
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.main-nav {
  flex-grow: 1;
  display: flex;
  justify-content: center;
}

.nav-item {
  color: var(--color-text-muted);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.09em;
  position: relative;
  padding-bottom: 6px;
  transition: color 0.2s ease;
}

.nav-item:hover {
  color: #6cd3ff;
}

.nav-item.active {
  color: #6cd3ff;
}

.nav-item.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background-color: linear-gradient(90deg, var(--accent), #a5e9ff);
  border-radius: 999px;
}

/* -----------------------------
   HEADER
------------------------------*/
header {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-surface);
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.title-main {
  color: var(--color-accent);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.title-sub {
  color: var(--color-text-muted);
  font-size: 12px;
}

header button {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-accent);
  background: transparent;
  color: var(--color-accent);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

header button:hover {
  background: var(--color-accent);
  color: #000;
  box-shadow: 0 0 12px rgba(255,152,0,0.55);
}

/* -----------------------------
   SELECTS
------------------------------*/
select {
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}

/* -----------------------------
   CARDS (EVENTOS Y ESTADISTICAS)
------------------------------*/
.event-card,
.card {
  background: var(--card-bg);
  box-shadow: 0 3px 10px var(--card-shadow);
  color: var(--color-text);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.event-card:hover,
.card:hover {
  box-shadow: 0 4px 16px var(--card-hover-shadow);
  transform: translateY(-2px);
}

.card h3 {
  color: var(--color-accent);
}

.timestamp {
  color: var(--color-text-muted);
}

.card-info i {
  color: var(--color-accent-soft);
}

.card-info strong {
  color: var(--color-accent);
}

/* -----------------------------
   EXPANDED MODAL / FULLSCREEN IMG
------------------------------*/
.expanded {
  background-color: rgba(0,0,0,0.85);
}

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

.close-btn:hover {
  background: var(--color-accent);
  color: #000;
}

/* -----------------------------
   COMPONENTES ESPECÍFICOS
------------------------------*/
#summaryBar {
  background: var(--card-bg);
  box-shadow: 0 3px 10px var(--card-shadow);
}

#summaryBar strong {
  color: var(--color-accent);
}

/* Estadísticas - labels de Chart.js en tema claro */
[data-theme="light"] .chartjs-render-monitor,
[data-theme="light"] canvas {
  color: #222 !important;
}

/* TEXTOS ESPECÍFICOS PARA STATISTICS */
#updateLabel,
#weekRangeLabel {
  color: var(--color-text-muted);
}

/* ============================================================
   EVENTOS (index.html) – LAYOUT ESPECÍFICO
============================================================ */

/* fondo con radial sólo en la página de eventos */
body.events-page {
  background: radial-gradient(circle at top left, #232323 0, #121212 40%, #050506 100%);
}

/* contenedor principal */
body.events-page .container {
  max-width: 1400px;
  margin: 0 auto 40px auto;
  padding: 0 24px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* summary bar compacta */
body.events-page #summaryBar {
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-radius: 12px;
  padding: 12px 0;
  margin: 18px auto;
  max-width: 1400px;
  text-align: center;
  font-size: 14px;
}

/* tarjeta de evento compacta con imagen a la derecha */
body.events-page .event-card {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.75);
  border: 1px solid #242424;
  overflow: hidden;
}

/* columna de texto */
body.events-page .card-info {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
}

/* Preview tamaño imagen en tarjeta */
body.events-page .card-image {
  flex-shrink: 0;
  width: 400px;
  background-color: #050505;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* imagen ocupa toda la columna */
body.events-page .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* timestamp + punto de "nuevo" */
body.events-page .timestamp {
  font-size: 0.82em;
}

body.events-page .new-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-accent);
  margin-right: 8px;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes event-highlight {
  0% { background-color: rgba(255, 152, 0, 0.12); }
  50% { background-color: rgba(255, 152, 0, 0.22); }
  100% { background-color: inherit; }
}

body.events-page .new-event {
  animation: event-highlight 1.2s ease-in-out;
}

body.events-page .new-event .new-dot {
  opacity: 1;
  transform: scale(1);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--color-bg-alt);
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(7px);
}

/* Logo */
.logo img {
  height: 26px;
  width: auto;
  display: block;
  filter: brightness(1.1);
  transition: opacity 0.25s ease;
}
.logo img:hover { opacity: 0.85; }
[data-theme="light"] .logo img { filter: none; }

/* Nav */
.main-nav {
  display: flex;
  gap: 28px;
}

.nav-item {
  position: relative;
  color: var(--color-text-muted);
  font-size: 13px;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color .2s;
  padding-bottom: 6px;
}

.nav-item:hover {
  color: var(--color-text);
}

.nav-item.active {
  color: var(--hanwha);
  font-weight: 600;
}

.nav-item.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background-color: #a5e9ff;
  border-radius: 999px;
}

/* Botón logout */
.logout-btn {
  background: none;
  border: 1px solid rgba(255, 152, 0, 0.7);
  border-radius: 999px;
  color: var(--hanwha);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 14px;
  transition: all 0.18s ease;
}

.logout-btn:hover {
  background-color: #b4b4b4
  color: #111827;
  box-shadow: 0 0 14px rgba(255, 152, 0, 0.55);
}