/* FOSS Studio host dashboard - Lightmorphic house style. */

@font-face {
  font-family: "Manrope";
  src: url("/fonts/Manrope.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #ffffff;  --fg: #09090b;
  --panel: #ffffff;  --panel-border: rgba(24, 24, 40, 0.10);
  --border: #e4e4e7;  --muted: #f4f4f5;  --muted-fg: #71717a;
  --shadow-panel: 0 1px 2px rgba(24,24,40,.05), 0 8px 24px -16px rgba(24,24,40,.18);

  --accent: #fbc711;  --accent-hover: #ddaf0f;  --on-accent: #645007;
  /* Menu highlight: solid brand-yellow-into-navy chip, white text */
  --accent-container: #645520;  --on-accent-container: #ffffff;

  --brand-navy: #111827;
  --brand-yellow: #fbc711; /* fixed identity colour; never follows the accent */
  --link: #1b74bc;
  --danger: #cc372d;   --danger-bg: #fef2f1;
  --success: #38813a;  --success-bg: #f2f9f3;
  --warning: #8f6c03;  --warning-bg: #fffbee;
  --info: #1b74bc;     --info-bg: #f0f8fe;

  --radius: 0.875rem;
  --panel-radius: 1.375rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;  --fg: #fafafa;
    --panel: #1b1d29;  --panel-border: rgba(255,255,255,.09);
    --border: #27272a;  --muted: #1c1c1f;  --muted-fg: #a1a1aa;
    --shadow-panel: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -16px rgba(0,0,0,.6);
    --link: #2295f1;
    --danger: #f34236;   --danger-bg: #350f0c;
    --success: #4bae4f;  --success-bg: #102611;
    --warning: #ffc006;  --warning-bg: #382a01;
    --info: #2295f1;     --info-bg: #072135;
  }
}

* { margin: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  font-family: "Manrope", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.6;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow-panel);
  padding: 1.5rem;
}

h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
h1 .foss { color: var(--brand-yellow); }
h2 { font-size: 1.0625rem; font-weight: 600; margin-bottom: 0.75rem; }

/* ---------- Layout: main menu | sub-menu | content ---------- */

.shell {
  max-width: 76rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.topbar h1 { margin-right: auto; }
.whoami { color: var(--muted-fg); font-size: 0.9rem; }

.layout {
  display: grid;
  grid-template-columns: 11rem 10rem 1fr;
  gap: 1.25rem;
  align-items: start;
}
/* A menu with a single section needs no submenu: drop its column and hide
   the bar (.submenu sets display:flex, so the hidden attribute alone won't) */
.layout.no-sub { grid-template-columns: 11rem 1fr; }
.layout.no-sub .submenu { display: none; }
/* Menus sit in panel boxes, matching the content cards */
.mainmenu, .submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 1rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow-panel);
  padding: 0.75rem 0.6rem;
  align-self: start;
}
.mainmenu button, .submenu button {
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  text-align: left;
  padding: 0.5rem 0.7rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-fg);
  cursor: pointer;
}
.submenu button { font-weight: 500; }
.mainmenu button:hover, .submenu button:hover {
  background: var(--muted);
  color: var(--fg);
}
.mainmenu button.active {
  background: var(--accent-container);
  color: var(--on-accent-container);
}
.submenu button.active {
  background: var(--muted);
  color: var(--fg);
}
.content { min-width: 0; }

@media (max-width: 820px) {
  .layout, .layout.no-sub { grid-template-columns: 1fr; }
  .mainmenu, .submenu {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.5rem;
  }
}
.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
}
.stack > * + * { margin-top: 1.25rem; }

/* ---------- Controls ---------- */

button, input, select { font: inherit; }

.btn {
  display: inline-block;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--muted);
  color: var(--fg);
  border-color: var(--border);
}
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }

.soft { color: var(--muted-fg); font-weight: 400; font-size: 0.85rem; }

.sound-list { color: var(--muted-fg); font-size: 0.9rem; }
.sound-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.sound-row:last-child { border-bottom: 0; }
.sound-name { flex: 1; color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

label { display: block; font-size: 0.9375rem; font-weight: 600; margin-bottom: 0.3rem; }
.hint { font-size: 0.8125rem; font-weight: 400; color: var(--muted-fg); }

input[type="text"], input[type="password"], input[type="number"],
input[type="email"], input[type="url"] {
  display: block;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}
.field { margin-bottom: 1rem; }

:is(button, input, select, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Icon buttons + inline delete confirm ---------- */

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--muted);
  color: var(--fg);
  cursor: pointer;
}
.iconbtn svg { width: 1rem; height: 1rem; }
.iconbtn.confirm { background: var(--danger); border-color: var(--danger); color: #fff; }
.iconbtn.done { background: var(--success); border-color: var(--success); color: #fff; }

/* ---------- Sessions list ---------- */

.session-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}
.session-row:first-child { border-top: 0; }
.session-row .title { font-weight: 600; }
.session-row .meta { font-size: 0.8125rem; color: var(--muted-fg); }
.session-row .spacer { margin-left: auto; }
.session-row .title-edit {
  font: inherit;
  font-weight: 600;
  color: inherit;
  background: var(--input-bg, rgba(0, 0, 0, 0.25));
  border: 1px solid var(--accent, #fbc711);
  border-radius: 0.5rem;
  padding: 0.15rem 0.5rem;
  min-width: 16rem;
}
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
}
/* Icon-only status markers (no pill) */
.badge.status-icon {
  display: inline-grid;
  place-items: center;
  padding: 0;
  background: none;
  min-width: 1.2rem;
  height: 1.2rem;
}
.badge.status-fail { color: var(--danger); font-weight: 800; font-size: 1rem; }
.proc-spinner {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid var(--danger-bg);
  border-top-color: var(--danger);
  animation: proc-spin 0.8s linear infinite;
}
@keyframes proc-spin { to { transform: rotate(360deg); } }
.rec-live {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--danger);
  animation: rec-pulse 1.2s ease-in-out infinite;
}
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .proc-spinner { animation: none; border-top-color: var(--danger); }
  .rec-live { animation: none; }
}

/* ---------- Accent swatches ---------- */

.bg-picker { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.hex-field { display: flex; align-items: center; gap: 0.6rem; }
.hex-field input { max-width: 8rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.swatch {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}
.swatch.active { border-color: var(--fg); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg); }

/* ---------- Toggle ---------- */

.toggle { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.toggle .track {
  width: 2.6rem;
  height: 1.45rem;
  border-radius: 999px;
  background: var(--muted);
  border: 1px solid var(--border);
  position: relative;
  transition: background 150ms;
  flex-shrink: 0;
}
.toggle .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 1.05rem; height: 1.05rem;
  border-radius: 50%;
  background: var(--muted-fg);
  transition: transform 150ms, background 150ms;
}
.toggle input:checked + .track { background: var(--accent); border-color: transparent; }
.toggle input:checked + .track::after { transform: translateX(1.15rem); background: var(--on-accent); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Per-host settings drawer ---------- */


/* ---------- Feedback ---------- */

.msg { border-radius: var(--radius); padding: 0.6rem 0.9rem; font-size: 0.9rem; margin-top: 0.75rem; }
.msg.ok { background: var(--success-bg); color: var(--success); }
.msg.err { background: var(--danger-bg); color: var(--danger); }

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.login-wrap .panel { width: 100%; max-width: 22rem; }

/* ---------- Wallpaper preview ---------- */

.wallpaper-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-size: cover;
  background-position: center;
  background-color: var(--muted);
  display: grid;
  place-items: center;
  color: var(--muted-fg);
  font-size: 0.85rem;
}

/* ---------- Tooltips: lozenge, background-coloured, outlined ---------- */

[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 60;
  pointer-events: none;
}

/* ---------- Intro preview modal ---------- */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
}
/* Guard display behind :not([hidden]) so the hidden attribute still hides it */
.video-modal:not([hidden]) { display: flex; }
.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}
.video-modal-box {
  position: relative;
  z-index: 1;
  width: 80vw;
  max-width: 80vw;
}
.video-modal-player {
  display: block;
  width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.video-modal-close {
  position: absolute;
  top: -0.6rem;
  right: -0.6rem;
  z-index: 2;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 0;
  background: var(--fg);
  color: var(--bg);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.video-modal-close:hover { opacity: 0.85; }

/* ---------- Recording cards ---------- */
.rec-card {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.rec-card:first-child { border-top: 0; padding-top: 0.25rem; }
.rec-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.rec-head-text { min-width: 0; }
.rec-head-text .title { font-weight: 600; }
.rec-head-text .meta { font-size: 0.8125rem; color: var(--muted-fg); }
/* Status + delete pinned top-right, not floating beside the file list */
.rec-head-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 0.5rem; }

/* Files in two columns, each a self-contained chip */
.files {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (max-width: 640px) { .files { grid-template-columns: 1fr; } }
.rec-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.rec-file {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
}
.rec-fname {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
a.iconbtn { text-decoration: none; }
.iconbtn:hover { border-color: var(--muted-fg); }

/* Inline new-password editor on a user row (no browser pop-up) */
.pw-inline {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}
.pw-inline input {
  font: inherit;
  font-size: 0.85rem;
  width: 15rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--line, #d5d9e0);
  border-radius: 8px;
  background: var(--bg, #fff);
  color: inherit;
}
