/* ============================================================
   NevaiScreen — Design System
   Light/Dark themes • Responsive • Silent (no animations)
   ============================================================ */

:root {
  /* Brand */
  --brand: #6d5efc;
  --brand-2: #00d4ff;
  --brand-grad: linear-gradient(135deg, #6d5efc 0%, #00d4ff 100%);
  --danger: #ff4d5e;
  --success: #21c97a;
  --warning: #ffb020;

  /* Radius / spacing */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --gap: 16px;

  --sidebar-w: 256px;
  --topbar-h: 60px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Motion: keep it silent by default */
  --t: 0.12s;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ---------- Light theme ---------- */
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-2: #ffffff;
  --bg-3: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --border: #e2e6ef;
  --border-strong: #cdd4e3;
  --text: #131620;
  --text-2: #5a6275;
  --text-3: #8b93a7;
  --shadow: 0 6px 24px rgba(20, 28, 56, 0.08);
  --shadow-lg: 0 18px 50px rgba(20, 28, 56, 0.14);
  --scrim: rgba(15, 20, 40, 0.35);
  --skeleton: #e9edf5;
  color-scheme: light;
}

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] {
  --bg: #0b0d12;
  --bg-2: #11141c;
  --bg-3: #161a24;
  --surface: #151926;
  --surface-2: #1b2030;
  --border: #232a3a;
  --border-strong: #313a50;
  --text: #eef1f8;
  --text-2: #a6b0c6;
  --text-3: #6f7894;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  --scrim: rgba(0, 0, 0, 0.55);
  --skeleton: #1c2230;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Silent mode: kill animations/transitions entirely */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
.reduced * { animation: none !important; transition: none !important; }

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ============================================================
   App layout
   ============================================================ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  gap: 8px;
  z-index: 40;
}

.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand__logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--brand-grad); color: #fff; flex: 0 0 auto;
}
.brand__logo .icon { width: 20px; height: 20px; stroke: #fff; }
.brand__name { font-size: 17px; font-weight: 600; flex: 1; white-space: nowrap; }
.brand__name strong { color: var(--brand); font-weight: 800; }
.sidebar__close { display: none; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--r-md);
  background: transparent; border: 0; color: var(--text-2);
  font-size: 14.5px; font-weight: 600; text-align: left; width: 100%;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.nav__item .icon { width: 19px; height: 19px; }
.nav__item:hover { background: var(--surface-2); color: var(--text); }
.nav__item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.nav__item.is-active::before {
  content: ""; position: absolute; left: 0; width: 3px; height: 22px;
  border-radius: 0 4px 4px 0; background: var(--brand-grad);
}
.nav__item { position: relative; }
.nav__badge {
  margin-left: auto; font-size: 11px; font-weight: 700; color: var(--brand);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  padding: 2px 8px; border-radius: 999px;
}
.nav__item--ghost { color: var(--text-2); }

.sidebar__footer { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.theme-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-weight: 600; font-size: 14px;
}
.theme-toggle__icon { width: 18px; height: 18px; }
.theme-toggle__label { flex: 1; text-align: left; }

/* Main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.topbar__title { font-size: 16px; font-weight: 700; }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar__menu { display: none; }

.scrim {
  position: fixed; inset: 0; background: var(--scrim); z-index: 35;
  opacity: 0; visibility: hidden; transition: opacity var(--t) var(--ease), visibility var(--t);
}
.scrim.is-open { opacity: 1; visibility: visible; }

.view { padding: 22px; max-width: 1180px; width: 100%; margin: 0 auto; outline: none; }

/* ============================================================
   Components
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 16px; border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), transform var(--t) var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn--primary { background: var(--brand-grad); border: 0; color: #fff; box-shadow: 0 8px 22px rgba(109, 94, 252, 0.35); }
.btn--primary:hover { filter: brightness(1.05); background: var(--brand-grad); }
.btn--ghost { background: transparent; }
.btn--danger { background: var(--danger); border: 0; color: #fff; }
.btn--block { width: 100%; }
.btn--lg { padding: 13px 22px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: var(--r-md); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); flex: 0 0 auto;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--brand); }
.icon-btn.is-active { color: var(--brand); border-color: var(--brand); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow);
}
.card--pad { padding: 18px; }
.card__title { font-size: 16px; margin-bottom: 4px; }
.card__sub { color: var(--text-2); font-size: 13.5px; }

.grid { display: grid; gap: var(--gap); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head__text { flex: 1; min-width: 200px; }
.page-head h1 { font-size: 24px; }
.page-head p { color: var(--text-2); margin-top: 4px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
}
.badge--brand { color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, transparent); border-color: transparent; }
.badge--success { color: var(--success); background: color-mix(in srgb, var(--success) 16%, transparent); border-color: transparent; }
.badge--dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.stat__label { color: var(--text-2); font-size: 13px; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 14px; font-family: inherit; transition: border-color var(--t) var(--ease);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); }
.textarea { resize: vertical; min-height: 90px; }

/* Switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.switch__label { font-weight: 600; }
.switch__desc { color: var(--text-2); font-size: 12.5px; }
.switch input { display: none; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--border-strong); position: relative; flex: 0 0 auto; transition: background var(--t) var(--ease); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--t) var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* Recorder stage */
.stage {
  position: relative; aspect-ratio: 16 / 9; width: 100%; border-radius: var(--r-lg);
  background: var(--bg-3); border: 1px solid var(--border); overflow: hidden;
  display: grid; place-items: center;
}
.stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage__placeholder { color: var(--text-3); text-align: center; display: grid; gap: 10px; place-items: center; padding: 20px; }
.stage__placeholder .icon { width: 46px; height: 46px; stroke: var(--text-3); }

.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.rec-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); font-weight: 700; font-size: 13px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }

.seg { display: flex; gap: 6px; background: var(--surface-2); padding: 4px; border-radius: var(--r-md); border: 1px solid var(--border); }
.seg button { flex: 1; padding: 9px 10px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13.5px; }
.seg button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Features drawer */
.drawer { position: fixed; inset: 0; z-index: 60; visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer__scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity var(--t) var(--ease); }
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer__panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(440px, 92vw);
  background: var(--bg-2); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform var(--t) var(--ease);
  display: flex; flex-direction: column;
}
.drawer.is-open .drawer__panel { transform: translateX(0); }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer__head h2 { font-size: 18px; }
.features-grid { padding: 18px 20px; overflow-y: auto; display: grid; gap: 12px; }

.feature {
  display: flex; gap: 13px; padding: 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
}
.feature__icon { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 11px; display: grid; place-items: center; background: var(--brand-grad); color: #fff; }
.feature__icon .icon { width: 20px; height: 20px; stroke: #fff; }
.feature h4 { font-size: 14.5px; }
.feature p { font-size: 12.8px; color: var(--text-2); margin-top: 2px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: var(--r-md);
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); z-index: 90;
  opacity: 0; visibility: hidden; transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), visibility var(--t);
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); visibility: visible; }

/* Empty / hero */
.hero { display: grid; gap: 22px; }
.hero__card { position: relative; overflow: hidden; }
.hero__card::before { content: ""; position: absolute; inset: 0; background: var(--brand-grad); opacity: 0.08; }
.hero h1 { font-size: 30px; line-height: 1.15; position: relative; }
.hero p { color: var(--text-2); max-width: 60ch; position: relative; }
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; position: relative; }

.list { display: grid; gap: 10px; }
.list__row { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.list__row .icon { width: 18px; height: 18px; color: var(--brand); }
.list__row .meta { margin-left: auto; color: var(--text-2); font-size: 13px; }

.muted { color: var(--text-2); }
.tiny { font-size: 12.5px; }
.center { text-align: center; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ============================================================
   Responsive / Mobile
   ============================================================ */
@media (max-width: 900px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform var(--t) var(--ease); box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar__close { display: grid; }
  .topbar__menu { display: grid; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .view { padding: 16px; }
  .topbar__title { font-size: 15px; }
  .btn span { display: none; }
  .btn--primary { padding: 10px; }
  .page-head h1 { font-size: 21px; }
}

@media (min-width: 761px) {
  .scrim { display: none; }
}
