:root {
  --bg: #0b0e14;
  --panel: #141924;
  --panel-2: #1c2333;
  --border: #2a3346;
  --text: #e6ebf5;
  --muted: #8a95a8;
  --accent: #3b82f6;
  --accent-hover: #2f6fe0;
  --live: #22c55e;
  --offline: #6b7280;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 1.15rem; margin: 0; font-weight: 650; }

.dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted);
}
.dot.live {
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #16203a 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.subtitle { color: var(--muted); margin: 8px 0 24px; font-size: 0.92rem; }

form { display: flex; flex-direction: column; }
label { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; margin-top: 14px; }
input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.95rem;
  outline: none;
}
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
}
button, .btn {
  margin-top: 22px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-hover); }

.alert {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.page-body { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-right button, .topbar-right .btn {
  margin: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  padding: 7px 14px;
}
.topbar-right button:hover { background: var(--border); }

main { padding: 24px; max-width: 1100px; margin: 0 auto; width: 100%; }

.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.camera-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.camera-card h2 { margin: 0; font-size: 1rem; }
.camera-meta { color: var(--muted); font-size: 0.85rem; }
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 6px;
}
.badge.online { background: rgba(34,197,94,0.15); color: #86efac; }
.badge.offline { background: rgba(107,114,128,0.2); color: #d1d5db; }
.badge.streaming { background: rgba(59,130,246,0.15); color: #93c5fd; }

.camera-card .btn { margin-top: auto; }
.camera-card .btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.stage {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.video-wrap {
  position: relative;
  width: 100%;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
}
.video-wrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.placeholder { color: var(--muted); font-size: 0.95rem; }

.status-badge {
  position: absolute; top: 12px; left: 12px;
  background: rgba(34, 197, 94, 0.9);
  color: #04210f;
  font-weight: 700; font-size: 0.72rem; letter-spacing: 0.5px;
  padding: 4px 10px; border-radius: 6px;
}
.status-badge.waiting { background: rgba(234, 179, 8, 0.9); color: #422006; }
.status-badge.offline { background: rgba(239, 68, 68, 0.9); color: #2a0606; }

.controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.controls button {
  margin: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.controls button:hover { background: var(--border); }

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.back-link:hover { color: var(--text); }
