@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0c0c12;
  --surface: #13131e;
  --surface2: #1a1a27;
  --border: #252535;
  --accent: #6366f1;
  --accent-dim: rgba(99,102,241,0.12);
  --accent-hover: #4f46e5;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #e4e4f0;
  --muted: #6b6b85;
  --sidebar-w: 224px;
  --radius: 10px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #818cf8; }

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  left: 0; top: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  z-index: 200;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.sidebar-brand img { width: 26px; height: 26px; }
.sidebar-brand span {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; }
.nav-item:hover { background: var(--accent-dim); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: #818cf8; }

.sidebar-bottom {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cam-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface2);
  font-size: 12.5px;
  color: var(--muted);
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.on {
  background: var(--success);
  box-shadow: 0 0 8px rgba(34,197,94,0.6);
  animation: blink 2s ease-in-out infinite;
}

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

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

/* ── Main layout ── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 40px 44px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card + .card { margin-top: 20px; }

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: all 0.15s;
  line-height: 1;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; stroke: currentColor; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); color: white; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; color: white; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; color: white; }
.btn-ghost {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 13px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
  -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

textarea { resize: vertical; min-height: 160px; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b85' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

select option { background: var(--surface2); }

/* ── Alerts ── */
.alert {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5;
}

.alert-success {
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.25);
  color: #86efac;
}

/* ── Reports list ── */
.report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  margin-bottom: 8px;
  transition: border-color 0.15s, background 0.15s;
}

.report-item:hover { border-color: #333348; background: #1e1e2c; }

.report-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.report-name:hover { color: #818cf8; }

.report-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.green { background: var(--success); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.status-badge.red { background: var(--danger); box-shadow: 0 0 6px rgba(239,68,68,0.4); }
.status-badge.gray { background: #3f3f52; }

/* ── Dropdown ── */
.dropdown { position: relative; }

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 140px;
  z-index: 50;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  overflow: hidden;
}

.dropdown-menu.open { display: block; }

.dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}

.dropdown-menu button:hover { background: var(--surface2); }
.dropdown-menu button.danger { color: #fca5a5; }

.dropdown-trigger {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}

.dropdown-trigger:hover { background: var(--surface); color: var(--text); }

/* ── KPI output ── */
#resultado-kpis {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  min-height: 120px;
}

/* ── Folder / Slideshow ── */
.slideshow-wrap { text-align: center; }

.slideshow-wrap img {
  width: 100%;
  max-width: 680px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.speed-btn {
  padding: 5px 13px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.speed-btn.active,
.speed-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #818cf8;
}

input[type="range"] {
  width: 100%;
  max-width: 680px;
  margin-top: 12px;
  height: 4px;
  accent-color: var(--accent);
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.text-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 12px;
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.text-box strong {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

/* ── Camera preview ── */
.camera-preview img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ── Divider ── */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ── Utilities ── */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); font-size: 13px; }
.text-sm { font-size: 13px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }

/* ── Landing page ── */
.landing-body { background: var(--bg); }

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 64px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(12,12,18,0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.landing-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--text);
}

.landing-logo img { width: 26px; }

.hero {
  padding: 100px 64px 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 500px;
  background: radial-gradient(ellipse at 50% 40%, rgba(99,102,241,0.14) 0%, transparent 65%);
  pointer-events: none;
}

.hero > * { position: relative; z-index: 1; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(99,102,241,0.3);
  color: #818cf8;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #e4e4f0 20%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 17px;
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto 36px;
  line-height: 1.65;
}

.features-section {
  padding: 0 64px 80px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 960px;
  margin: 0 auto;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 24px;
  transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
  border-color: rgba(99,102,241,0.4);
  transform: translateY(-2px);
}

.feature-icon {
  width: 44px; height: 44px;
  background: var(--accent-dim);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.feature-icon svg { width: 20px; height: 20px; color: #818cf8; stroke: currentColor; }

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

.feature-card p {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.6;
}

.landing-footer {
  border-top: 1px solid var(--border);
  padding: 22px 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
}

.footer-links a { color: var(--muted); transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  position: relative;
}

.login-wrap::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(99,102,241,0.1) 0%, transparent 60%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-logo img { width: 28px; }
.login-logo span { font-weight: 700; font-size: 15px; letter-spacing: 0.05em; }

.login-title {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 24px;
}

/* ── Quick-link cards (dashboard) ── */
.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  text-decoration: none;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 8px;
}

.quick-link:hover {
  border-color: rgba(99,102,241,0.4);
  background: #1e1e2c;
  color: var(--text);
}

.quick-link svg { width: 17px; height: 17px; color: var(--accent); stroke: currentColor; flex-shrink: 0; }

/* ── Status card ── */
.status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.status-card.on { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.05); }
.status-card.off { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.05); }

.status-card .dot-lg {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-card.on .dot-lg { background: var(--success); box-shadow: 0 0 10px rgba(34,197,94,0.6); animation: blink 2s infinite; }
.status-card.off .dot-lg { background: var(--danger); }

.status-card-text strong { font-size: 14px; font-weight: 600; display: block; }
.status-card-text span { font-size: 12.5px; color: var(--muted); }
