/* ----------------------------------------------------------------------- */
/* SSNF Development Dashboard                                               */
/* ----------------------------------------------------------------------- */
:root {
  --bg: #0f1216;
  --panel: #171c23;
  --panel-2: #1e242d;
  --line: #2a313b;
  --text: #e7ecf2;
  --muted: #8b97a7;
  --accent: #4da3ff;
  --ok: #3ecf8e;
  --warn: #ffb454;
  --progress: #4da3ff;
  --complete: #3ecf8e;
  --scheduled: #b48cff;
  --other: #8b97a7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: #000;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { height: 38px; width: auto; display: block; }
.brand-text { font-weight: 600; letter-spacing: .3px; font-size: 17px; }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }

main {
  max-width: 1400px; margin: 0 auto; padding: 20px;
  display: flex; flex-direction: column; gap: 20px;
}

/* ---------- Cameras: two equal halves ---------- */
.cameras { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
.cam-main { min-width: 0; }
.cam-tile {
  position: relative; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; width: 100%;
}
.cam-main .cam-tile { aspect-ratio: 16 / 9; }
.cam-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--muted); text-align: center; padding: 8px;
}
.cam-placeholder .cam-icon { font-size: 30px; opacity: .5; }
.cam-placeholder small { color: var(--muted); opacity: .7; font-size: 12px; }
.cam-label {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(0,0,0,.55); color: #fff;
  padding: 4px 10px; border-radius: 6px; font-size: 13px;
}
.cam-thumbs { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 14px; min-width: 0; }
.cam-thumb {
  aspect-ratio: auto; height: 100%;
  cursor: pointer; padding: 0; text-align: left;
  color: var(--text); font: inherit;
  transition: border-color .15s, transform .05s;
}
.cam-thumb:hover { border-color: #3a4654; }
.cam-thumb:active { transform: scale(.99); }
.cam-thumb-label {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0,0,0,.55); color: #fff;
  padding: 2px 8px; border-radius: 5px; font-size: 12px;
}

/* ---------- Experiments ---------- */
.experiments {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px 18px;
}
.exp-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.exp-header h2 { margin: 0; font-size: 18px; }
.exp-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.exp-filters {
  display: flex; gap: 3px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 3px;
}
.exp-filters button {
  background: transparent; border: 0; color: var(--muted);
  font: inherit; font-size: 13px; padding: 5px 11px;
  border-radius: 6px; cursor: pointer;
}
.exp-filters button:hover { color: var(--text); }
.exp-filters button.active { background: var(--accent); color: #06121f; font-weight: 600; }

.refresh-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer;
  font-size: 17px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.refresh-btn:hover { border-color: #3a4654; }
.refresh-btn.spinning { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.exp-status { font-size: 13px; color: var(--muted); }
.exp-status.ok { color: var(--ok); }
.exp-status.warn { color: var(--warn); }

/* Day-grouped table; scroll up/down through days; sticky column header. */
.days-scroller {
  position: relative;
  max-height: 560px; overflow-y: auto; overflow-x: auto;
  border: 1px solid var(--line); border-radius: 10px;
}
.exp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.exp-table thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--panel); text-align: left;
  font-weight: 600; color: var(--muted);
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.exp-table tbody td { padding: 8px 12px; border-bottom: 1px solid var(--panel-2); }
.exp-table tbody tr:hover td { background: rgba(255,255,255,.02); }

tr.day-sep td {
  background: var(--panel-2);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 7px 12px;
}
tr.day-sep .d-title { font-weight: 700; }
tr.day-sep.today .d-title { color: var(--accent); }
tr.day-sep .d-date { color: var(--muted); font-size: 12px; margin-left: 10px; }
tr.day-sep:hover td { background: var(--panel-2); }

tr.empty-day td { color: var(--muted); font-size: 13px; padding: 8px 12px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.st-progress  { background: rgba(77,163,255,.15);  color: var(--progress); }
.badge.st-complete  { background: rgba(62,207,142,.15);  color: var(--complete); }
.badge.st-scheduled { background: rgba(180,140,255,.15); color: var(--scheduled); }
.badge.st-other     { background: rgba(139,151,167,.15); color: var(--other); }

@media (max-width: 820px) {
  .cameras { grid-template-columns: 1fr; }
  .cam-thumbs { grid-template-columns: 1fr 1fr; }
  .cam-thumb { aspect-ratio: 16 / 9; height: auto; }
}
