/* EDC Vision demo — same "liquid glass" design system as the EDC Face Matching lab
   (face.edctech.vn) and the EDC OCR lab. Brand blue (#29AAE2) from the EDC logo. */

:root {
  --edc-blue:       #29AAE2;
  --edc-blue-dark:  #1C87BD;
  --edc-blue-light: #6FC6EE;

  --ink:      #16324A;
  --ink-soft: #4C6478;
  --ink-faint:#8098AC;

  --glass-bg:      rgba(255, 255, 255, 0.55);
  --glass-bg-soft: rgba(255, 255, 255, 0.38);
  --glass-border:  rgba(255, 255, 255, 0.6);
  --glass-shadow:  0 8px 32px rgba(22, 74, 116, 0.16);
  --line:          rgba(41, 170, 226, 0.14);

  --ok-bg:   rgba(22, 163, 74, 0.14);
  --ok-fg:   #0f8a3f;
  --err-bg:  rgba(220, 38, 38, 0.12);
  --err-fg:  #c22222;
  --warn-bg: rgba(217, 119, 6, 0.14);
  --warn-fg: #b45309;
  --info-bg: rgba(41, 170, 226, 0.15);

  /* Chart series: fixed order, colour follows the entity (vào / ra) */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid:     rgba(41, 170, 226, 0.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  padding: 40px 16px 64px;
  position: relative;
  overflow-x: hidden;
  background: linear-gradient(180deg, #eef8fd 0%, #f6fbfe 45%, #ffffff 100%);
  background-attachment: fixed;
}

/* Soft blurred colour blobs behind the glass cards */
body::before, body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  z-index: -1;
  opacity: 0.55;
}
body::before {
  width: 480px; height: 480px;
  top: -160px; left: -140px;
  background: radial-gradient(circle, var(--edc-blue) 0%, transparent 70%);
}
body::after {
  width: 560px; height: 560px;
  bottom: -220px; right: -180px;
  background: radial-gradient(circle, var(--edc-blue-light) 0%, transparent 70%);
}

.container { max-width: 960px; margin: 0 auto; position: relative; }

a { color: var(--edc-blue-dark); }

/* ── Header / brand ─────────────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.brand-home { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand h1 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand .pill { margin-left: auto; }

.back-link { display: inline-block; margin-bottom: 14px; font-size: .88rem; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* ── Glass card ──────────────────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  padding: 24px;
  margin-bottom: 20px;
  position: relative;
}
/* Subtle top-edge specular highlight */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.card-title, .card h2 {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  margin-bottom: 16px;
}
.card h2 + .muted { margin-top: -10px; }
.page-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; }

.muted { color: var(--ink-faint); font-size: .88rem; margin-bottom: 12px; }
.muted strong { color: var(--ink-soft); }
.hint { color: var(--ink-faint); font-size: .8rem; margin-top: 8px; }

code {
  font-family: Consolas, 'Cascadia Mono', monospace;
  font-size: .85em;
  background: rgba(41,170,226,0.1);
  padding: 1px 6px;
  border-radius: 6px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

/* ── Tabs (source type) ──────────────────────────────────────────────────── */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--glass-bg-soft);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: var(--glass-shadow);
  max-width: 100%;
  overflow-x: auto;
}
.tab {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s;
}
.tab input { position: absolute; opacity: 0; pointer-events: none; }
.tab:hover { color: var(--edc-blue-dark); background: rgba(41,170,226,0.08); }
.tab:has(input:checked) {
  color: #fff;
  background: linear-gradient(180deg, var(--edc-blue-light) 0%, var(--edc-blue) 60%, var(--edc-blue-dark) 100%);
}
.tab:has(input:focus-visible) { outline: 2px solid var(--edc-blue-dark); outline-offset: 2px; }

/* ── Form ────────────────────────────────────────────────────────────────── */
label, .label { display: block; font-size: .85rem; color: var(--ink-soft); margin-bottom: 6px; }
label .req { color: var(--err-fg); }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

input[type=text], input[type=url], select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(41,170,226,0.3);
  background: rgba(255,255,255,0.7);
  font: inherit; font-size: .9rem; color: var(--ink);
  min-width: 0;
}
select { width: auto; min-width: 200px; }
input:focus, select:focus { outline: none; border-color: var(--edc-blue); box-shadow: 0 0 0 3px rgba(41,170,226,0.18); }

.drop-zone {
  border: 2px dashed rgba(41,170,226,0.35);
  background: var(--glass-bg-soft);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .15s;
  position: relative;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.drop-zone:hover     { border-color: var(--edc-blue); background: rgba(41,170,226,0.08); }
.drop-zone.drag-over { border-color: var(--edc-blue); background: rgba(41,170,226,0.14); transform: scale(1.01); }
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.drop-zone .icon  { font-size: 2rem; }
.drop-zone .drop-label { font-size: .85rem; color: var(--ink-faint); overflow-wrap: anywhere; }
.drop-zone.has-file .drop-label { color: var(--ink); font-weight: 600; }
.drop-zone .badge {
  font-size: .75rem;
  background: var(--info-bg);
  color: var(--edc-blue-dark);
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, var(--edc-blue-light) 0%, var(--edc-blue) 55%, var(--edc-blue-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 30px;
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(41,170,226,0.4), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.btn:hover:not(:disabled)  { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(41,170,226,0.48), inset 0 1px 0 rgba(255,255,255,0.5); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  display: inline-block;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(41,170,226,0.3);
  color: var(--edc-blue-dark);
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit; font-size: .82rem; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--edc-blue); background: rgba(41,170,226,0.1); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }
.btn-danger {
  background: none;
  border: 1px solid rgba(220,38,38,0.4);
  color: var(--err-fg);
  border-radius: 999px;
  padding: 7px 16px;
  font: inherit; font-size: .82rem; font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: var(--err-bg); }
.link-danger { border: 0; background: none; color: var(--err-fg); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; padding: 4px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }

/* ── Status ──────────────────────────────────────────────────────────────── */
.alert { border-radius: 14px; padding: 12px 14px; font-size: .9rem; margin-bottom: 16px; }
.alert-err  { background: var(--err-bg);  border: 1px solid rgba(220,38,38,0.25);  color: var(--err-fg); }
.alert-warn { background: var(--warn-bg); border: 1px solid rgba(217,119,6,0.25); color: var(--warn-fg); }

.pill, .badge {
  display: inline-block;
  font-size: .72rem; font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.pill-ok, .badge-done              { background: var(--ok-bg);   color: var(--ok-fg); }
.pill-err, .badge-failed           { background: var(--err-bg);  color: var(--err-fg); }
.badge-queued, .badge-setup        { background: var(--warn-bg); color: var(--warn-fg); }
.badge-running, .badge-snapshot    { background: var(--info-bg); color: var(--edc-blue-dark); }

.job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.job-head .muted { overflow-wrap: anywhere; margin: 4px 0 0; }
.progress { height: 6px; border-radius: 999px; background: rgba(41,170,226,0.15); overflow: hidden; margin: 18px 0 8px; }
.progress > div { height: 100%; background: var(--edc-blue); transition: width .4s; }

/* ── Summary ─────────────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile {
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--glass-shadow);
  padding: 12px 14px;
}
.tile > span { display: block; font-size: .78rem; color: var(--ink-soft); font-weight: 600; }
.tile strong { display: block; font-size: 1.6rem; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tile small  { display: block; font-size: .75rem; color: var(--ink-faint); line-height: 1.5; }

.chart { position: relative; height: 230px; }
.media { display: block; width: 100%; border-radius: 12px; border: 1px solid rgba(41,170,226,0.2); background: #000; }

.table-wrap { overflow-x: auto; margin: 0 -8px; }
.table-scroll { max-height: 280px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th {
  text-align: left;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-faint);
  padding: 8px;
  border-bottom: 1px solid rgba(41,170,226,0.2);
  white-space: nowrap;
}
td { padding: 9px 8px; border-bottom: 1px solid rgba(41,170,226,0.1); vertical-align: middle; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: rgba(255,255,255,0.45); }
.table-scroll th { position: sticky; top: 0; background: #f4fafd; }
.title-cell { overflow-wrap: anywhere; font-weight: 600; }

details summary { cursor: pointer; font-size: .82rem; color: var(--edc-blue-dark); font-weight: 600; }
details[open] summary { margin-bottom: 12px; }

/* ── Line and zone editor ────────────────────────────────────────────────── */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; margin: 16px 0 20px; }
.editor-stage { position: relative; align-self: start; line-height: 0; }
.editor-stage img { width: 100%; border-radius: 12px; border: 1px solid rgba(41,170,226,0.2); user-select: none; }
.editor-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.editor-side h2:not(:first-child) { margin-top: 24px; }
.editor-side h2 { margin-bottom: 8px; }
.editor-side h2 + .muted { margin-top: 0; }
.editor-side .muted { font-size: .82rem; }
.zone-list { list-style: none; margin: 0 0 10px; }
.zone-list li { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; counter-increment: zone; }
.zone-list li::before { content: counter(zone); width: 12px; color: var(--ink-faint); font-size: .78rem; }
.zone-list input[type=text] { flex: 1; padding: 7px 12px; font-size: .85rem; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }

@media (max-width: 760px) {
  body { padding-top: 24px; }
  .grid-2, .editor { grid-template-columns: 1fr; }
  .grid-2 { gap: 0; }
}

/* ── Navigation ──────────────────────────────────────────────────────────── */
.nav-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.nav-row .tabs { margin-bottom: 0; }
a.tab { text-decoration: none; }
.tab.active {
  color: #fff;
  background: linear-gradient(180deg, var(--edc-blue-light) 0%, var(--edc-blue) 60%, var(--edc-blue-dark) 100%);
}
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.subtab {
  padding: 6px 14px; margin: 0;
  border-radius: 999px;
  font-size: .85rem; font-weight: 600;
  color: var(--ink-soft);
  border: 1px solid rgba(41,170,226,0.2);
  background: rgba(255,255,255,0.45);
  cursor: pointer; user-select: none;
}
.subtab input { position: absolute; opacity: 0; pointer-events: none; }
.subtab:hover { border-color: var(--edc-blue); color: var(--edc-blue-dark); }
.subtab:has(input:checked) { border-color: var(--edc-blue); background: rgba(41,170,226,0.14); color: var(--edc-blue-dark); }
.subtab:has(input:focus-visible) { outline: 2px solid var(--edc-blue-dark); outline-offset: 2px; }

.login-card { max-width: 420px; }
input[type=password], input[type=number], input[type=date] {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(41,170,226,0.3);
  background: rgba(255,255,255,0.7);
  font: inherit; font-size: .9rem; color: var(--ink);
  min-width: 0;
}
.btn.btn-sm { padding: 8px 18px; font-size: .85rem; }
.link-btn { border: 0; background: none; padding: 0; color: var(--edc-blue-dark); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; text-decoration: underline; }
.form-grid { gap: 0 20px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: .85rem; color: var(--ink-soft); margin-bottom: 8px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--edc-blue); }
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.filter-row .check { margin-bottom: 10px; }
.mini-field { display: block; margin: 0; }
.mini-field > span { display: block; font-size: .75rem; color: var(--ink-faint); margin-bottom: 3px; }
.mini-field input, .mini-field select { padding: 7px 10px; font-size: .85rem; min-width: 0; width: 100%; }
.filter-row .mini-field select { width: auto; min-width: 140px; }
.filter-row .mini-field input { width: auto; }
.mini-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

.pill-off  { background: rgba(128,152,172,0.18); color: var(--ink-soft); }
.pill-info { background: var(--info-bg); color: var(--edc-blue-dark); }
.pill-alert { background: var(--err-bg); color: var(--err-fg); }

/* ── Cameras ─────────────────────────────────────────────────────────────── */
.cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cam-card {
  display: block;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 8px 12px;
  text-decoration: none; color: var(--ink);
  transition: border-color .15s;
}
.cam-card:hover { border-color: var(--edc-blue); }
.cam-thumb {
  aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  background: rgba(22,50,74,0.08);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint); font-size: .78rem;
}
.cam-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 4px 0; }
.cam-meta strong { font-size: .92rem; overflow-wrap: anywhere; }
.cam-sub { margin: 0 4px; font-size: .78rem; color: var(--ink-faint); }
.cam-stats { display: flex; gap: 12px; margin: 8px 4px 0; font-size: .8rem; color: var(--ink-soft); }
.cam-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert-list { list-style: none; margin-bottom: 14px; }
.alert-list li { padding: 8px 0; border-bottom: 1px solid rgba(41,170,226,0.1); }
.alert-list a { display: block; font-size: .88rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.alert-list a:hover { color: var(--edc-blue-dark); }
.alert-list small { color: var(--ink-faint); font-size: .76rem; }
.alert-list li.seen a { font-weight: 400; color: var(--ink-soft); }
.alert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.alert-card {
  background: var(--glass-bg);
  border: 1px solid rgba(220,38,38,0.3);
  border-radius: 14px;
  padding: 8px;
  min-width: 0;
}
.alert-card.seen { border-color: var(--line); }
.alert-card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: rgba(22,50,74,0.08); }
.alert-card figcaption { display: grid; gap: 4px; padding: 8px 4px 2px; justify-items: start; }
.alert-card strong { font-size: .88rem; overflow-wrap: anywhere; }
.alert-card small { font-size: .76rem; color: var(--ink-faint); }
.alert-card.seen .pill-alert { background: rgba(128,152,172,0.18); color: var(--ink-soft); }

/* ── Flow bars ───────────────────────────────────────────────────────────── */
.bars { list-style: none; display: grid; gap: 8px; font-size: .82rem; margin-bottom: 12px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 8px; border-radius: 999px; background: rgba(41,170,226,0.12); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--series-1); min-width: 2px; }
.bar-value { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ── Editor lists ────────────────────────────────────────────────────────── */
.editor { grid-template-columns: minmax(0, 1fr) 300px; }
/* The side panel is taller than the picture; keep the picture in view while it scrolls */
.editor-stage { position: sticky; top: 16px; }
@media (max-width: 760px) { .editor { grid-template-columns: 1fr; } .editor-stage { position: static; } }
.item-list { display: grid; gap: 10px; margin-bottom: 10px; }
.item { background: rgba(255,255,255,0.55); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.item-head input[type=text] { flex: 1; padding: 6px 10px; font-size: .85rem; }
.item-no { width: 12px; color: var(--ink-faint); font-size: .78rem; }
.item .hint { margin-top: 6px; }
