/* Sidecam Cloud — visor. Estética de la app: modo oscuro, teal #34C7B5,
   ámbar solo para lo anómalo. Poco texto, nada de marca clínica. */

:root {
  --bg: #0c0f0e;
  --panel: #161a19;
  --panel-2: #1e2422;
  --ink: #eef2f1;
  --ink-dim: #9aa5a2;
  --teal: #34c7b5;
  --teal-ink: #06312c;
  --amber: #e8a13c;
  --red: #e5544b;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

#topbar[hidden] { display: none; }
#topbar {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: .7rem 1.2rem;
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-weight: 700; letter-spacing: -.02em; }
.brand-cloud { color: var(--teal); font-weight: 600; }
#topbar nav { display: flex; gap: 1rem; flex: 1; }
#topbar a { color: var(--ink-dim); text-decoration: none; padding: .2rem .4rem; }
#topbar a.active, #topbar a:hover { color: var(--ink); }

main { max-width: 1100px; margin: 0 auto; padding: 1.2rem; }
.center { text-align: center; }

button {
  background: var(--teal);
  color: var(--teal-ink);
  border: 0;
  border-radius: 10px;
  padding: .6rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button.ghost {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid #2c3331;
}
button:disabled { opacity: .45; cursor: default; }

/* ── Conectar ─────────────────────────────────────────────────────────── */
.connect {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-top: 4vh;
  text-align: center;
}
.connect h1 { font-size: 1.5rem; margin: 0; }
.connect p { color: var(--ink-dim); max-width: 34rem; margin: 0; }
.qr-card {
  background: #fff;
  padding: 18px;
  border-radius: var(--radius);
  line-height: 0;
}
.qr-meta { color: var(--ink-dim); font-size: .85rem; }
.connect .alt { margin-top: 1.6rem; }
.code-input {
  width: min(26rem, 90vw);
  padding: .7rem .9rem;
  border-radius: 10px;
  border: 1px solid #2c3331;
  background: var(--panel);
  color: var(--ink);
  font: 1.05rem/1 ui-monospace, 'SF Mono', Menlo, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
}
.error { color: var(--red); }
.notice { color: var(--amber); }

/* ── Biblioteca ───────────────────────────────────────────────────────── */
.crumbs { color: var(--ink-dim); margin-bottom: 1rem; }
.crumbs a { color: var(--teal); text-decoration: none; }
.rows { display: flex; flex-direction: column; gap: .4rem; }
.row {
  display: flex;
  align-items: center;
  gap: .8rem;
  background: var(--panel);
  border-radius: 10px;
  padding: .65rem .9rem;
  cursor: pointer;
  border: 0;
  color: var(--ink);
  text-align: left;
  font: inherit;
}
.row:hover { background: var(--panel-2); }
.row .icon { font-size: 1.2rem; width: 1.6rem; text-align: center; }
.row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--ink-dim); font-size: .85rem; flex-shrink: 0; }
.illegible { color: var(--ink-dim); font-style: italic; }

/* ── Grid de sesión / en vivo ─────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .6rem;
}
.cell {
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 0;
  padding: 0;
  color: var(--ink-dim);
  font-size: 1.6rem;
  position: relative;
}
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell .badge {
  position: absolute;
  right: .4rem;
  bottom: .3rem;
  font-size: .75rem;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  padding: .05rem .4rem;
  border-radius: 6px;
}
.live-hero {
  margin-bottom: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40vh;
}
.live-hero img, .live-hero video { max-width: 100%; max-height: 68vh; display: block; }
.live-state { color: var(--ink-dim); margin: .6rem 0 1rem; }
.live-state .dot {
  display: inline-block;
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: var(--teal);
  margin-right: .45rem;
  animation: pulse 2.4s infinite;
}
@keyframes pulse { 50% { opacity: .3; } }

/* ── Elemento ─────────────────────────────────────────────────────────── */
.item-view { display: flex; flex-direction: column; gap: 1rem; align-items: center; }
.item-view img, .item-view video { max-width: 100%; max-height: 78vh; border-radius: 10px; }
.item-actions { display: flex; gap: .8rem; }

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #2c3331;
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
