/* GoTrimy shared styles — the single visual source of truth.
   Tokens follow DESIGN_SYSTEM.md. Every page imports this file. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  /* --- design-system tokens (canonical) --- */
  --bg:            #0a0a0a;   /* near-black page background */
  --bg-elevated:   #141414;   /* cards, panels */
  --bg-hover:      #1c1c1c;   /* hover state on cards/rows */
  --border:        #262626;   /* faint borders, dividers */
  --border-light:  #333333;   /* brighter border on hover */

  --text:          #f5f5f5;   /* primary text (near-white) */
  --text-muted:    #a3a3a3;   /* secondary text, descriptions */
  --text-dim:      #6b7280;   /* captions, meta, timestamps */

  /* Brand accent — GREEN as of 2026-08-19 (gotrimy.com). It is a BRIGHT
     green, which has a consequence that must never be forgotten: white
     text on it is 1.86:1, unreadable. Anything sitting ON the accent
     carries DARK text (--accent-ink, 10.65:1). See DESIGN_SYSTEM §3b. */
  --accent:        #5ED800;                 /* green — brand accent */
  --accent-hover:  #4CB300;                 /* deeper green, button hover */
  --accent-dim:    rgba(94, 216, 0, 0.12);  /* green tint bg */
  --accent-ink:    #0a0a0a;                 /* text ON the accent, never white */

  /* Red did NOT move: error, danger and destructive keep it, because
     red-for-error is universal and swapping it for the brand colour
     would make a warning look like a call to action. */
  --danger:        #ef4444;                 /* destructive actions */
  --danger-dim:    rgba(239, 68, 68, 0.15);

  /* ---- refinement sweep: the rules, as tokens ------------------------
     Colour restraint means red must be SPENT, not sprinkled: it belongs to
     the one primary action on a screen, to destructive actions, and to
     error/warning states that are doing real work. Everything decorative
     resolves to greys on near-black. These tokens exist so that stays true
     without hand-tuning each screen. */
  --surface-active: #1c1c1c;   /* selected tab / nav row — soft, not bright */
  --control-on:     #ededed;   /* a PRESSED control: light fill, dark text (switches ON use --accent) */
  /* the amber the warning notes already use, as a token — ALSO the
     credits indicator's colour (owner's call, 2026-08-22): warm, not a
     state, so it never reads as an error or a call to action */
  --warm:           #f5a623;
  --warm-dim:       rgba(245, 166, 35, 0.10);
  --warm-line:      rgba(245, 166, 35, 0.32);
  --focus-ring:     rgba(255, 255, 255, 0.16);

  /* spacing scale — "generous whitespace" is only consistent if it counts */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 20px; --sp-5: 32px; --sp-6: 48px;
  /* ONE control height, product-wide (2026-08-22): every button and pill
     is 34px tall — padding is horizontal only and the box centres its
     label. Exempt by decision, not by drift: the landing hero CTA. */
  --control-h: 34px;

  /* type scale — two sizes do most of the work: a big title and a muted
     subtitle, then body and meta */
  --fs-title: 30px;
  --fs-sub:   15px;
  --fs-body:  14px;
  --fs-meta:  12.5px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', "SF Mono", Menlo, monospace;

  /* --- back-compat aliases (old names → new tokens) --- */
  --card: var(--bg-elevated);
  --card-hover: var(--bg-hover);
  --muted: var(--text-muted);
  --mint: var(--accent);
  --mint-dim: var(--accent-dim);
  --red: var(--danger);
  --red-dim: var(--danger-dim);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  /* radial accent glow (top) over a barely-there graph-paper grid — fine
     hairlines, wide cells, very low opacity so it reads as texture only */
  background-image:
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(255, 255, 255, 0.035), transparent),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 72px 72px, 72px 72px;
  background-position: center top, center, center;
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }

/* The wordmark is an SVG now. Height is pinned so swapping the text logo
   out did not move anything: the old text rendered ~26px tall at 22px/700,
   and the asset is 345x69 (5:1), so 26px height => ~130px wide. `display:
   block` kills the inline baseline gap that would otherwise add ~4px. */
.logo { display: inline-flex; align-items: center; }
.logo-img { height: 26px; width: auto; display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  min-height: var(--control-h);
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease, color 150ms ease;
  text-align: center;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 24px rgba(94, 216, 0, 0.25); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: default; box-shadow: none; transform: none; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); border-color: var(--border-light); }
.btn-ghost:disabled { opacity: 0.35; cursor: default; background: transparent; }
.btn-sm { padding: 0 14px; font-size: 14px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }

/* Focus is a neutral ring. It used to be a red border + red glow, which
   put the brand accent on every field on every form — the single loudest
   source of stray colour in the product. */
input:focus, textarea:focus {
  border-color: var(--border-light);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.topbar .right { display: flex; align-items: center; gap: 14px; }
.topbar .contact { color: var(--muted); font-size: 14px; }
.topbar .contact:hover { color: var(--text); }
.avatar {
  width: var(--control-h); height: var(--control-h);
  border-radius: 50%;
  background: var(--surface-active);
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.avatar:hover { border-color: var(--border-light); background: var(--bg-hover); }

/* avatar account dropdown */
.avatar-wrap { position: relative; }
.avatar-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  min-width: 200px;
  z-index: 40;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.avatar-menu.open { display: block; }
.avatar-menu .am-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.avatar-menu .am-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
.avatar-menu .am-email { color: var(--text); font-size: 14px; font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-menu .am-item {
  display: flex; align-items: center; width: 100%; text-align: left;
  background: none; border: none; color: var(--text);
  font: inherit; font-size: 14px; min-height: var(--control-h); padding: 0 12px;
  border-radius: 7px; cursor: pointer;
}
.avatar-menu .am-item:hover { background: var(--card-hover); }

/* Page heading pattern — a big title with a muted subtitle under it,
   then a clear gap before body content. Used by every page so the type
   rhythm is identical rather than re-invented per screen. */
.page-head { margin-bottom: var(--sp-5); }
.page-head h1, .page-title {
  font-size: var(--fs-title); font-weight: 700;
  letter-spacing: -0.6px; line-height: 1.2; color: var(--text);
}
.page-head p, .page-sub {
  color: var(--text-muted); font-size: var(--fs-sub);
  margin-top: var(--sp-2); line-height: 1.55;
}

/* ---------- landing ---------- */
.hero { text-align: center; padding: 120px 20px var(--sp-6); max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: 46px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; }
.hero h1 .accent { color: var(--mint); }
.hero p.sub { color: var(--text-muted); font-size: 19px; margin-top: var(--sp-4); line-height: 1.6; }
.hero .cta { margin-top: 36px; display: flex; gap: 14px; justify-content: center; }
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  max-width: 880px;
  margin: var(--sp-6) auto 0;
  padding: 0 20px;
}
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: var(--sp-5) var(--sp-4);
  text-align: left;
}
.feature .icon { font-size: 26px; }
.feature h3 { font-size: 17px; margin: 12px 0 8px; }
.feature p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.how {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 64px auto;
  color: var(--muted);
  font-size: 15px;
}
.how b { color: var(--text); }
.how .num {
  display: inline-flex; width: 26px; height: 26px;
  border-radius: 50%; background: var(--surface-active); color: var(--text);
  align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; margin-right: 8px;
}
footer { text-align: center; color: #55555e; font-size: 13px; padding: 40px 0 32px; }
@media (max-width: 720px) {
  .features { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
  .how { flex-direction: column; gap: 14px; align-items: center; }
}

/* ---------- auth ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 80px 20px; }
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: var(--sp-6);
  width: 100%;
  max-width: 420px;
}
.auth-card h2 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-muted); font-size: var(--fs-sub);
                  margin-bottom: var(--sp-5); line-height: 1.55; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: var(--sp-3) 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--border-light); }
.auth-msg { font-size: 14px; margin-top: 14px; min-height: 20px; }
.auth-msg.error { color: var(--red); }
.auth-msg.ok { color: var(--text); }
.auth-switch { color: var(--muted); font-size: 14px; margin-top: 18px; text-align: center; }
.auth-switch a:hover { color: var(--accent); }
.auth-switch a { color: var(--text); cursor: pointer; text-decoration: underline;
                 text-underline-offset: 3px; }

/* OAuth (Continue with Google) */
.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid var(--border);
}
.btn-oauth:hover { border-color: var(--border-light); background: var(--bg-hover); }
.btn-oauth:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.g-icon { flex-shrink: 0; }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  margin: 18px 0;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- dashboard ---------- */
.shell { display: flex; min-height: calc(100vh - 67px); }
.sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.sidebar .btn { margin-bottom: 14px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--control-h);
  padding: 0 var(--sp-3);
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  text-align: left;
  width: 100%;
}
.nav-item:hover { color: var(--text); background: var(--card); }
.nav-ic { width: 18px; margin-right: 6px; text-align: center; font-size: 13px; }
.nav-item.active { color: var(--text); background: var(--surface-active); font-weight: 600; }
.content { flex: 1; padding: var(--sp-6) var(--sp-5); max-width: 860px; }
.content h2 {
  font-size: var(--fs-title); font-weight: 700;
  letter-spacing: -0.6px; line-height: 1.2; margin-bottom: var(--sp-2);
}
.content .sub { color: var(--text-muted); font-size: var(--fs-sub);
                margin-bottom: var(--sp-5); line-height: 1.55; }

/* video card grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-4);
}
.vcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.vcard:hover, .vcard:focus-within { background: var(--card-hover); border-color: var(--border-light); transform: translateY(-1px); }
.vcard .thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.vcard .thumb-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.vcard .thumb-missing {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  color: var(--text-dim); font-size: 12.5px;
}
.vcard .thumb-missing .tm-icon { font-size: 26px; opacity: .5; }
.vcard .row-menu-btn {
  background: #ffffff;
  color: #111111;
  border-color: #ffffff;
}
.vcard .row-menu-btn:hover { background: #e5e5e5; border-color: #e5e5e5; color: #000; }
.vcard .overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 150ms ease;
}
.vcard:hover .overlay, .vcard:focus-within .overlay { opacity: 1; }
.vcard .info { padding: var(--sp-3) 14px var(--sp-4); }
.vcard .title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.vcard .row-menu-wrap { position: absolute; top: 8px; right: 8px; }
.vcard { cursor: pointer; }
.edit-expired {
  color: rgba(255, 255, 255, 0.75);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  cursor: default;
}

/* player modal: adapt to the video's aspect ratio, never overfill the screen */
#playerModal .modal {
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
#playerModal video {
  max-height: 68vh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  display: block;
}
@media (max-width: 720px) {
  .vcard .overlay { opacity: 1; background: rgba(0, 0, 0, 0.35); }
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
  }
  .sidebar .btn { margin-bottom: 0; width: 100%; }
  .nav-item { width: auto; padding: 8px 12px; font-size: 14px; }
  .content { padding: 20px 16px; }
  .topbar .usage-note { display: none; }
  .plan-pill small { display: none; }
}

/* plan pill + usage (topbar) */
.plan-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-active);
  color: var(--text);
  font-size: 13px; font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 999px;
  min-height: var(--control-h); padding: 0 12px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
  font-family: inherit;
}
.plan-pill:hover { border-color: var(--border-light); background: var(--bg-hover); }
.plan-pill small { color: var(--muted); font-weight: 500; font-size: 11px; }
.plan-pill .fa-crown { font-size: 11px; margin-right: 2px; }
.usage-note { color: var(--text-dim); font-size: 12.5px; }

/* deferred dashboard-save banner (failures must surface in the UI) */
.save-pending-banner {
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: #f5c46b;
  margin-bottom: 14px;
}

/* usage bar (subscription/settings) */
.usage-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 10px 0 6px; }
.usage-bar .fill { height: 100%; background: var(--text-muted); border-radius: 4px; transition: width 300ms ease; }
/* red only when it MEANS something — you are at the edge of your quota */
.usage-bar .fill.near-limit { background: var(--accent); }

.empty {
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: 20px;
  padding: 64px 24px;
  color: var(--muted);
}
.empty .icon { font-size: 40px; margin-bottom: 12px; }
.empty h3 { color: var(--text); font-size: 18px; margin-bottom: 6px; }

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 12px;
}
.settings-card h3 { font-size: 16px; margin-bottom: 6px; }
.settings-card p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.settings-card .btn { margin-top: 14px; }
.pill {
  display: inline-block;
  background: var(--surface-active);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ---------- row ⋯ menu ---------- */
.row-menu-wrap { position: relative; flex-shrink: 0; }
.row-menu-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--control-h); padding: 0 12px;
  cursor: pointer;
}
.row-menu-btn:hover { color: var(--text); border-color: var(--border-light); background: var(--bg-hover); }
.row-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  min-width: 140px;
  z-index: 20;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.row-menu.open { display: block; }
.row-menu button,
.row-menu a {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}
.row-menu button:hover,
.row-menu a:hover { background: var(--card-hover); }
.row-menu button.danger { color: var(--red); }
.row-menu button.danger:hover { background: var(--red-dim); }

/* inline rename */
.title-edit {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 6px 10px;
}
.title-edit:focus { outline: none; }

/* ---------- modal / popup ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 9, 0.7);
  backdrop-filter: blur(2px);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  width: 100%;
  max-width: 440px;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal h3 { font-size: 19px; margin-bottom: 8px; }
.modal p { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 20px; }
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.modal .field input, .modal .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
}
.modal .field textarea { resize: none; height: 96px; }
.modal .field input:focus, .modal .field textarea:focus { outline: none; border-color: var(--border-light); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.modal-msg { font-size: 14px; margin-top: 12px; min-height: 18px; }
.modal-msg.error { color: var(--red); }
.modal-msg.ok { color: var(--text); }
.btn-danger { background: var(--danger); color: #2a0808; border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); box-shadow: 0 0 20px rgba(239, 68, 68, 0.35); transform: translateY(-1px); }
.btn-danger:disabled { opacity: 0.4; cursor: default; box-shadow: none; transform: none; }
