/* Thrivecast Studio — design system v2
   Direction: bold, minimal, editorial (matches thrivecast.studio). Heavy headings, lots of
   whitespace, high-contrast. White dashboard; dark stages for the recording views (function). */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  /* CR-13: dark mode (permanent, no toggle). Tokens flipped to dark; the whole app follows. */
  --ink: #f1f2e9;            /* light text */
  --ink-2: #c9d1bd;
  --paper: #14160f;          /* dark background */
  --paper-2: #1c1f16;        /* surfaces */
  --line: #2c3024;
  --muted: #9aa089;
  --sage: #6f8163;           /* lightened so sage reads on dark */
  --sage-2: #829473;
  --coral: #C37967;
  --coral-dk: #a8624f;

  /* dark studio palette */
  --stage: #0e0f0a;
  --stage-2: #16180f;
  --stage-3: #20231a;
  --stage-line: #2c3024;
  --stage-ink: #f1f2e9;
  --stage-muted: #969b86;

  --r: 16px;
  --shadow: 0 18px 50px rgba(20, 22, 15, .10);
  --ui: 'Outfit', system-ui, sans-serif;
  --body: 'DM Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--ui); letter-spacing: -.03em; }

.wordmark { font-family: var(--ui); font-weight: 800; letter-spacing: -.03em; }
.wordmark b { color: var(--ink); font-weight: 800; }
.wordmark span { color: var(--coral); }

/* brand logo */
.logo { height: 38px; width: auto; display: block; }
.studio-bar .logo { height: 32px; }
.bar-brand { display: flex; align-items: center; gap: 12px; }
.bar-brand .role { font-family: var(--ui); font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

/* recording countdown overlay */
.countdown { position: absolute; inset: 0; z-index: 8; display: none; place-items: center;
  background: rgba(10, 11, 7, .66); backdrop-filter: blur(2px); }
.countdown:not(.hidden) { display: grid; }
.countdown span { font-family: var(--ui); font-weight: 900; font-size: clamp(110px, 22vw, 240px);
  color: #fff; line-height: 1; letter-spacing: -.04em; text-shadow: 0 8px 40px rgba(0,0,0,.6);
  animation: cdpop .9s ease both; }
@keyframes cdpop { 0% { transform: scale(.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1.15); opacity: .85; } }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--ui); font-weight: 700; font-size: 15px; line-height: 1; letter-spacing: -.01em;
  padding: 13px 20px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--paper); color: var(--ink); cursor: pointer; transition: .16s ease;
  display: inline-flex; align-items: center; gap: 9px;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--sage); color: #fff; border-color: var(--sage); }
.btn-primary:hover:not(:disabled) { background: var(--sage-2); }
.btn-coral { background: var(--coral); color: #fff; border-color: var(--coral); }
.btn-coral:hover:not(:disabled) { background: var(--coral-dk); }
.btn-ghost-dark { background: var(--paper); color: var(--ink); border-color: var(--line); font-weight: 600; }
.btn-ghost-dark:hover:not(:disabled) { background: var(--paper-2); border-color: var(--ink); }

/* ---------- dashboard ---------- */
.shell { max-width: 1120px; margin: 0 auto; padding: 0 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 26px 0; }
.topbar .wordmark { font-size: 22px; }
.topbar > div:last-child { font-family: var(--ui); font-weight: 600; font-size: 13px; color: var(--muted); }

.hero { padding: 60px 0 30px; }
.hero .eyebrow { font-family: var(--ui); text-transform: uppercase; letter-spacing: .22em; font-size: 12px; color: var(--coral-dk); font-weight: 700; }
.hero h1 { font-weight: 900; font-size: clamp(42px, 7vw, 84px); line-height: .96; margin: 18px 0 16px; color: var(--ink); }
.hero p { font-size: 18px; line-height: 1.5; color: var(--ink-2); max-width: 52ch; margin: 0; font-weight: 500; }

.create { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); margin-top: 30px; }
.create .row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-family: var(--ui); font-size: 12px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .1em; }
.field input { font-family: var(--body); font-size: 15px; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--paper-2); min-width: 240px; font-weight: 500; }
.field input:focus { outline: 2.5px solid var(--coral); border-color: transparent; }

.links { margin-top: 18px; display: none; gap: 10px; flex-direction: column; }
.linkrow { display: flex; align-items: center; gap: 11px; background: var(--paper-2); border: 1.5px dashed var(--line); border-radius: 12px; padding: 11px 13px; }
.linkrow .tag { font-family: var(--ui); font-weight: 700; font-size: 11px; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; }
.tag.prod { background: var(--sage); color: #fff; } .tag.guest { background: var(--coral); color: #fff; }
.linkrow code { flex: 1; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--body); }

.section-h { font-family: var(--ui); font-weight: 800; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 54px 0 16px; }
.rec-list { display: grid; gap: 12px; padding-bottom: 70px; }
.rec { background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--r); padding: 18px 20px; transition: .15s; }
.rec:hover { border-color: var(--ink); }
.rec h3 { font-weight: 800; font-size: 21px; margin: 0 0 4px; color: var(--ink); }
.rec .meta { font-size: 13px; color: var(--muted); margin-bottom: 12px; font-weight: 500; }
.rec .files { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--ui); font-size: 13px; font-weight: 600; text-decoration: none; color: var(--ink); background: var(--paper-2); border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 14px; }
.chip:hover { border-color: var(--ink); }
.empty { color: var(--muted); font-size: 15px; padding: 18px 0; font-weight: 500; }

/* per-client projects (CR-15) */
.proj-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pchip { font-family: var(--ui); font-weight: 600; font-size: 13px; padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper-2); color: var(--ink); cursor: pointer; }
.pchip:hover { border-color: var(--ink); }
.pchip.active { background: var(--sage); color: #fff; border-color: var(--sage); }
.proj-group { margin-bottom: 28px; }
.proj-title { font-family: var(--ui); font-weight: 800; font-size: 15px; color: var(--ink); margin: 0 0 10px; display: flex; align-items: baseline; gap: 10px; }
.proj-title span { font-weight: 500; font-size: 12px; color: var(--muted); }
.proj-group .rec { margin-bottom: 10px; }

/* ---------- studio (light chrome, matches dashboard; video frame stays dark) ---------- */
.studio { height: 100vh; height: 100dvh; overflow: hidden; background: var(--paper); color: var(--ink); display: flex; flex-direction: column; }
.studio-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1.5px solid var(--line); background: var(--paper); }
.studio-bar .wordmark { color: var(--ink); font-size: 19px; }
.studio-bar .wordmark span { color: var(--coral); }
.sess-name { font-family: var(--ui); font-size: 13px; color: var(--muted); font-weight: 600; }
.pill { font-family: var(--ui); font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: .06em; }
@keyframes blink { 50% { opacity: .3; } }
.pill.rec { background: var(--coral); color: #fff; } .pill.rec::before { content:''; width:8px;height:8px;border-radius:50%;background:#fff;display:inline-block;animation: blink 1s infinite; }
.pill.warn { background: rgba(186,117,23,.24); color: #efb45f; } .pill.warn::before { content:''; width:7px;height:7px;border-radius:50%;background:#efb45f;display:inline-block;animation: blink 1s infinite; }

.stage-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 20px; }
.frame { position: relative; height: 100%; width: auto; max-width: min(100%, 1320px); max-height: 100%; aspect-ratio: 16/9; background: #000; border-radius: 20px; overflow: hidden; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* mirror the self-view (client) and the producer's view of the guest — display only; the file is true orientation */
#checkVideo, #mainVideo { transform: scaleX(-1); }

.tile { position: absolute; top: 20px; right: 20px; width: 240px; aspect-ratio: 16/9; border-radius: 14px;
  overflow: hidden; border: 2.5px solid rgba(255,255,255,.55); box-shadow: 0 10px 32px rgba(0,0,0,.55); cursor: grab; background:#000; z-index: 5; touch-action: none; }
.tile.dragging { cursor: grabbing; border-color: var(--coral); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .label { position: absolute; left: 9px; bottom: 8px; font-family: var(--ui); font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,.6); padding: 4px 9px; border-radius: 7px; letter-spacing: .02em; }

.placard { position: absolute; inset: 0; display: none; place-items: center; background: var(--stage-2); flex-direction: column; gap: 12px; }
.placard.show { display: grid; }
.placard .ava { width: 92px; height: 92px; border-radius: 50%; background: var(--sage); color: #fff; display: grid; place-items: center; font-family: var(--ui); font-weight: 800; font-size: 38px; }
.placard .nm { font-family: var(--ui); font-weight: 700; font-size: 18px; color: var(--stage-ink); }
.tile .placard .ava { width: 46px; height: 46px; font-size: 18px; }

/* teleprompter — a movable box (producer drags it, position syncs to the client) */
.prompter { position: absolute; left: 10%; top: 6px; width: 80%; height: 34%; padding: 20px 26px 0;
  background: rgba(8,9,6,.74); border: 1px solid rgba(255,255,255,.14); border-radius: 12px;
  overflow: hidden; display: none; z-index: 6; pointer-events: none; touch-action: none; }
.prompter.show { display: block; }
.prompter.movable { pointer-events: auto; cursor: grab; }
.prompter.movable::before { content: 'drag to reposition'; position: absolute; top: 6px; left: 0; right: 0;
  text-align: center; font-family: var(--ui); font-size: 11px; font-weight: 600; color: rgba(255,255,255,.5); }
.prompter.movable.dragging { cursor: grabbing; border-color: var(--coral); }
.prompter .scroll { font-family: var(--ui); font-weight: 800; font-size: 32px; line-height: 1.4; color: #fff;
  text-align: center; text-shadow: 0 2px 14px rgba(0,0,0,.8); white-space: pre-wrap; will-change: transform; letter-spacing: -.01em; }

/* mic level meter */
.meter { height: 9px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sage-2), var(--coral)); transition: width .05s linear; }
.meter-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.meter-row .mlabel { font-family: var(--ui); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.meter-row .meter { flex: 1; }

/* session-ended overlay (client) */
.ended { position: absolute; inset: 0; z-index: 9; display: none; place-items: center; background: var(--stage);
  flex-direction: column; gap: 12px; text-align: center; padding: 28px; }
.ended.show { display: grid; }
.ended h2 { font-family: var(--ui); font-weight: 800; font-size: 26px; color: var(--stage-ink); margin: 0; }
.ended p { color: var(--stage-muted); margin: 0; font-weight: 500; }

/* headphone / echo prompt on the join screen */
.hp-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 14px;
  font-family: var(--body); font-size: 14px; color: var(--stage-muted); }
.hp-row input { width: 18px; height: 18px; accent-color: var(--coral); }

.label-name { position: absolute; left: 18px; bottom: 18px; font-family: var(--ui); font-weight: 700; font-size: 15px;
  background: rgba(0,0,0,.5); padding: 6px 13px; border-radius: 9px; z-index: 3; letter-spacing: -.01em; }

/* control dock */
.dock { display: flex; align-items: center; gap: 12px; padding: 16px; justify-content: center; flex-wrap: wrap; }
.ctrl { width: 56px; height: 56px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; display: grid; place-items: center; transition: .15s; }
.ctrl:hover { background: var(--paper-2); border-color: var(--ink); }
.ctrl.off { background: var(--coral); border-color: var(--coral); color: #fff; }
.ctrl svg { width: 23px; height: 23px; }
.ctrl-label { font-family: var(--ui); font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; margin-top: 5px; }
.ctrl-group { display: flex; flex-direction: column; align-items: center; }

/* producer side panel */
.with-panel { display: grid; grid-template-columns: 1fr 360px; flex: 1; min-height: 0; overflow: hidden; }
.panel-d { background: var(--paper-2); border-left: 1.5px solid var(--line); padding: 20px; overflow-y: auto; }
.panel-d h4 { font-family: var(--ui); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 22px 0 10px; }
.panel-d h4:first-child { margin-top: 0; }
.panel-d select, .panel-d textarea, .panel-d input { width: 100%; font-family: var(--body); font-size: 14px; padding: 10px 12px; background: var(--paper); color: var(--ink); border: 1.5px solid var(--line); border-radius: 10px; }
.panel-d textarea { min-height: 130px; resize: vertical; line-height: 1.55; font-weight: 500; }
.panel-d .sub { display: flex; gap: 8px; margin-top: 9px; }
.panel-d .sub .btn { padding: 10px 12px; font-size: 13px; flex: 1; justify-content: center; }
.statline { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 7px 0; border-bottom: 1px solid var(--line); font-weight: 500; }
.statline b { color: var(--ink); font-family: var(--ui); font-weight: 700; }
.upbar { height: 9px; background: var(--paper); border-radius: 99px; overflow: hidden; margin-top: 10px; border: 1px solid var(--line); }
.upbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sage-2), var(--coral)); transition: width .3s; }

/* device-check / join */
.join-center { flex: 1; min-height: 0; display: grid; place-items: center; padding: 28px; overflow-y: auto; }
.join-card { width: min(100%, 760px); }
.join-card .preview { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 90px rgba(0,0,0,.5); position: relative; }
.join-card .preview video { width: 100%; height: 100%; object-fit: cover; }
.join-head { text-align: center; margin-bottom: 22px; }
.join-head .eyebrow { font-family: var(--ui); text-transform: uppercase; letter-spacing: .22em; font-size: 12px; color: var(--coral-dk); font-weight: 700; }
.join-head h1 { font-weight: 900; font-size: clamp(32px,5vw,52px); margin: 12px 0 8px; color: var(--ink); line-height: 1; }
.join-head p { color: var(--muted); margin: 0; font-weight: 500; font-size: 16px; }
.join-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
.join-controls select { font-family: var(--body); font-size: 14px; padding: 12px; background: var(--paper); color: var(--ink); border: 1.5px solid var(--line); border-radius: 11px; font-weight: 500; }
.join-card .btn-coral { width: 100%; justify-content: center; padding: 16px; font-size: 17px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--stage-2); color: var(--ink); border: 1px solid var(--stage-line);
  font-family: var(--ui); font-weight: 700; font-size: 14px; padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow); opacity: 0; transition: .25s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; }
/* in-session chat (CR-14) */
.chat-drawer { position: fixed; right: 18px; bottom: 94px; width: 320px; max-height: 52vh; background: var(--stage-2);
  border: 1px solid var(--stage-line); border-radius: 14px; display: none; flex-direction: column; overflow: hidden; z-index: 40; box-shadow: var(--shadow); }
.chat-drawer.show { display: flex; }
.chat-head { font-family: var(--ui); font-weight: 700; font-size: 13px; padding: 12px 14px; border-bottom: 1px solid var(--stage-line); color: var(--stage-ink); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.chat-msgs.panel { max-height: 170px; background: var(--stage); border: 1px solid var(--stage-line); border-radius: 10px; margin-top: 4px; }
.chat-msg { font-size: 13px; line-height: 1.4; }
.chat-msg b { color: var(--coral); font-family: var(--ui); font-weight: 700; margin-right: 6px; }
.chat-msg span { color: var(--stage-ink); }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--stage-line); }
.chat-input input { flex: 1; font-family: var(--body); font-size: 13px; padding: 9px 11px; background: var(--stage); color: var(--stage-ink); border: 1px solid var(--stage-line); border-radius: 9px; }
.chat-input .btn { padding: 9px 14px; font-size: 13px; }

.hidden { display: none !important; }

@media (max-width: 880px) { .with-panel { grid-template-columns: 1fr; } .panel-d { border-left: none; border-top: 1.5px solid var(--line); } }
