/* SentinelCam — dark glass UI */
:root {
  --bg-0: #0b0d12;
  --bg-1: #11141c;
  --bg-2: #161a25;
  --bg-3: #1d2230;
  --border: #262c3b;
  --text: #e5e9f0;
  --text-dim: #8b94a8;
  --accent: #5b8cff;
  --accent-2: #4cd1c0;
  --ok: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: radial-gradient(1200px 800px at 10% -10%, #1b2236 0%, var(--bg-0) 60%);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: #82a9ff; }

/* Layout */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex; flex-direction: column;
}
.brand {
  font-weight: 700; font-size: 18px; letter-spacing: .5px;
  display: flex; align-items: center; gap: 10px; margin-bottom: 28px;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--ok); box-shadow: 0 0 12px var(--ok);
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text-dim); font-weight: 500;
}
.nav a:hover { background: var(--bg-2); color: var(--text); }
.nav a.active {
  background: linear-gradient(180deg, rgba(91,140,255,.18), rgba(91,140,255,.06));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(91,140,255,.25);
}
.nav .icon { width: 18px; text-align: center; opacity: .9; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-dim); }

.main { padding: 28px 36px; max-width: 1500px; }
.page-title {
  font-size: 22px; font-weight: 700; margin: 0 0 4px;
  display: flex; align-items: center; gap: 12px;
}
.page-sub { color: var(--text-dim); margin: 0 0 22px; }

/* Cards */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 14px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-dim); }
.row { display: grid; gap: 16px; }
.row.cols-2 { grid-template-columns: 1fr 1fr; }
.row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.row.cols-4 { grid-template-columns: repeat(4, 1fr); }
.row.cols-2of3 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) {
  .row.cols-3, .row.cols-4, .row.cols-2, .row.cols-2of3 { grid-template-columns: 1fr; }
}

/* Stats */
.stat .v { font-size: 28px; font-weight: 700; }
.stat .l { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.stat .accent { color: var(--accent-2); }
.stat .warn { color: var(--warn); }

/* Stream */
.stream-wrap {
  position: relative;
  border-radius: 14px; overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
}
.stream-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stream-status {
  position: absolute; top: 12px; left: 12px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  border-radius: 999px; padding: 6px 12px; font-size: 12px;
  display: flex; align-items: center; gap: 8px;
}
.stream-status .pulse {
  width: 8px; height: 8px; border-radius: 999px; background: var(--err);
  box-shadow: 0 0 10px var(--err); animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.85); }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  font-weight: 600; cursor: pointer; font-size: 13px;
  transition: all .15s;
}
.btn:hover { border-color: #3a425b; background: #232938; }
.btn.primary {
  background: linear-gradient(180deg, #5b8cff, #4570e0);
  border-color: #4570e0; color: white;
  box-shadow: 0 8px 20px -8px rgba(91,140,255,.7);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger {
  background: #2a1b22; border-color: #5a2832; color: var(--err);
}
.btn.danger:hover { background: #3a2229; }
.btn.ghost { background: transparent; }

/* Forms */
label.field { display: block; margin-bottom: 14px; }
label.field .lbl {
  display: block; font-size: 12px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-dim); margin-bottom: 6px;
  font-weight: 600;
}
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); font: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,140,255,.18); }
textarea.input { min-height: 64px; resize: vertical; }

/* Toggle */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle input { display: none; }
.toggle .slider {
  width: 42px; height: 24px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 999px; position: relative;
  transition: all .2s;
}
.toggle .slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; background: #fff; border-radius: 999px;
  transition: all .2s;
}
.toggle input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .slider::after { left: 21px; }

/* Flash */
.flash-wrap { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-1);
}
.flash.ok { border-color: #2c4d35; background: #14241a; color: #b8f0c5; }
.flash.error { border-color: #5a2832; background: #2a1b22; color: #f8b7b7; }

/* Tables / events */
.events-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.event-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.event-card:hover { transform: translateY(-2px); border-color: #3a425b; }
.event-card .thumb { aspect-ratio: 16/9; background: #000; }
.event-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.event-card .meta { padding: 10px 12px; }
.event-card .label { font-weight: 600; }
.event-card .ts { font-size: 11px; color: var(--text-dim); }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase;
}
.badge.motion { background: rgba(251,191,36,.15); color: var(--warn); }
.badge.person { background: rgba(248,113,113,.15); color: var(--err); }
.badge.pet { background: rgba(76,209,192,.15); color: var(--accent-2); }
.badge.detection { background: rgba(91,140,255,.15); color: var(--accent); }
.badge.face { background: rgba(192,132,252,.15); color: #c084fc; }

/* Pets */
.pet-card {
  display: grid; grid-template-columns: 1fr; gap: 12px;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px;
}
.pet-card h4 { margin: 0; font-size: 16px; }
.pet-card .species { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.pet-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.pet-photos .ph {
  position: relative; width: 72px; height: 72px;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--border);
}
.pet-photos .ph img { width: 100%; height: 100%; object-fit: cover; }
.pet-photos .ph button {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px;
  border-radius: 999px; background: rgba(0,0,0,.7); color: #fff; border: 0;
  cursor: pointer; font-size: 12px; line-height: 18px; padding: 0;
}

/* Login */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(800px 600px at 50% -20%, #1b2236 0%, var(--bg-0) 60%);
}
.login-card {
  width: 380px; max-width: 92vw; padding: 32px;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow);
}
.login-card h1 { margin: 0 0 4px; }
.login-card .sub { color: var(--text-dim); margin: 0 0 20px; font-size: 13px; }

/* Help box for EZ Settings */
.help-box {
  background: linear-gradient(180deg, rgba(76,209,192,.08), rgba(76,209,192,.02));
  border: 1px solid rgba(76,209,192,.25);
  border-radius: 12px; padding: 14px 16px; font-size: 13px;
}
.help-box h4 { margin: 0 0 8px; color: var(--accent-2); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.help-box ol { margin: 0; padding-left: 22px; }
.help-box li { margin: 4px 0; }
.help-box code {
  background: var(--bg-3); padding: 2px 6px; border-radius: 6px;
  font-size: 12px; color: var(--accent-2);
}

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 24px 0 12px;
}
.section-title h2 { margin: 0; font-size: 16px; }

/* Sliders */
.ctrl-slider {
  -webkit-appearance: none; width: 100%; height: 6px;
  border-radius: 999px; background: var(--bg-3); outline: none;
  border: 1px solid var(--border);
}
.ctrl-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 999px; background: var(--accent);
  cursor: pointer; border: 2px solid #11141c;
  box-shadow: 0 0 10px rgba(91,140,255,.6);
}
.ctrl-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 999px;
  background: var(--accent); border: 2px solid #11141c;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(5, 7, 12, 0.92);
  display: none; align-items: center; justify-content: center;
  padding: 32px;
  backdrop-filter: blur(4px);
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.lightbox-meta {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: rgba(15, 18, 25, 0.85);
  border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 999px;
  font-size: 13px; display: flex; align-items: center; gap: 12px;
}
.lightbox-close {
  position: absolute; top: 20px; right: 24px;
  background: rgba(15, 18, 25, 0.85);
  border: 1px solid var(--border); color: var(--text);
  width: 42px; height: 42px; border-radius: 999px;
  font-size: 22px; cursor: pointer; line-height: 1;
}
.lightbox-close:hover { background: var(--bg-3); }
.event-card { cursor: zoom-in; }

/* small util */
.muted { color: var(--text-dim); }
.spacer-12 { height: 12px; }
.spacer-24 { height: 24px; }
.right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
