/* Noted — demo styles. Deaf-therapist-first: big, high-contrast, minimal. */

:root {
  --bg:        #0a0a0f;
  --panel:    #12131a;
  --panel-2:  #1b1d25;
  --text:     #e6edf3;
  --muted:    #8b949e;
  --accent:   #1f6feb;
  --danger:   #d9534f;
  --warn:     #d29922;
  --therapist:#1f6feb;
  --client:   #d29922;
  --border:   #23252e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--accent); }
u { text-decoration-color: var(--warn); }

/* DEMO banner */
#demo-banner {
  background: #3a2a05;
  border-bottom: 2px solid var(--warn);
  color: #fff3d6;
  padding: 10px 18px;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}
#demo-banner strong { color: var(--warn); letter-spacing: .5px; }
#demo-banner a { color: #fff3d6; text-decoration: underline; margin-left: 6px; }

#app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px clamp(12px, 3vw, 32px) 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ffffff14;
  padding-bottom: 10px;
}
header h1 { margin: 0; font-size: 28px; letter-spacing: .5px; }
.tag { color: var(--muted); font-size: 13px; }
header nav { display: flex; gap: 14px; }
.nav-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.nav-link:hover { color: var(--text); }

.card {
  background: var(--panel);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.card-head h2 { margin: 0; font-size: 18px; }
button.collapse {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
}

/* First-time card */
#first-time ol { margin: 6px 0 0 20px; padding: 0; line-height: 1.6; }
#first-time code { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; }

/* Controls */
#controls .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
#controls .row + .row { margin-top: 14px; }
#controls .row.buttons { align-items: center; }
#controls label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1 1 180px; min-width: 150px; }
.lbl { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
#controls input, #controls select {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px;
  font-size: 15px;
  min-width: 130px;
}
#controls input:focus, #controls select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  background: #2a2d36;
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); }
button.danger  { background: var(--danger); }

/* Help ? button */
/* Inline video embed (only works for iframable URLs: Jitsi, Whereby, custom). */
#video-embed iframe {
  width: 100%;
  height: 60vh;
  min-height: 360px;
  border: 0;
  border-radius: 8px;
  background: #000;
}

/* Auto-minimise mode for info-heavy cards while a session is live. */
body.session-active #first-time { display: none; }
body.session-active #controls { padding: 8px 12px; }
body.session-active #controls .row:first-child { display: none; }       /* hide fields row */
body.session-active #video-row { display: none; }                       /* hide video launcher grid */
body.session-active #controls .hint { display: none; }
body.session-active #controls label .lbl .info { display: none; }

/* Mute button state */
#mute.muted { background: var(--warn); color: #000; }

/* Mic status indicator — visible dot + label so users don't wonder if it's listening */
.mic-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 4px 10px;
  background: #1b1d25; border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px;
}
.mic-indicator .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #555;
  box-shadow: 0 0 0 0 rgba(217,83,79,0);
  transition: background .2s, box-shadow .2s;
}
.mic-indicator.active .dot {
  background: #d9534f;
  animation: mic-pulse 1.3s ease-in-out infinite;
}
.mic-indicator.active .label { color: #ff8a87; }
.mic-indicator.error .dot   { background: var(--warn); }
.mic-indicator .label { font-weight: 600; }
.mic-indicator .sub   { font-size: 12px; }
@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(217,83,79,.55); }
  70%  { box-shadow: 0 0 0 10px rgba(217,83,79,0);   }
  100% { box-shadow: 0 0 0 0   rgba(217,83,79,0);    }
}

.video-btn {
  background: #1b1d25; color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.video-btn:hover { background: var(--panel-2); border-color: var(--accent); }

button.info {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  cursor: pointer;
  flex: 0 0 auto;
}
button.info:hover { color: var(--text); border-color: var(--text); }
button.info.big { width: 34px; height: 34px; font-size: 18px; align-self: center; margin-left: auto; }

.muted { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

/* Captions */
.cap {
  background: rgba(0,0,0,.78);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 500;
}
.cap .ts {
  display: inline-block;
  margin-right: 6px;
  color: #8b949e;
  font-family: "Consolas", "SF Mono", monospace;
  font-size: 11px;
  vertical-align: baseline;
  font-weight: 500;
  letter-spacing: 0;
}
.cap .spk {
  display: inline-block;
  margin-right: 6px;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 11px;
  vertical-align: baseline;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.cap.therapist .spk { background: var(--therapist); color: #fff; }
.cap.client    .spk { background: var(--client);    color: #000; }
.cap.partial { opacity: .7; font-style: italic; }

/* Note */
#note pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #0c0d13;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-family: "Consolas", "SF Mono", monospace;
  font-size: 14px;
  line-height: 1.55;
  color: #dbe1e8;
}
#copy-note { margin-top: 8px; }

footer {
  display: flex; justify-content: space-between;
  color: var(--muted); font-size: 12px; padding-top: 16px;
  border-top: 1px solid #ffffff14;
}
footer a { color: var(--muted); }

/* Three-column session grid: captions on the left, patient file on the right. */
#session-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  #session-grid { grid-template-columns: 1fr; }
}

/* Captions column — hard height cap, scrollable. Latest at top. */
#captions-wrapper { display: flex; flex-direction: column; }
#caption-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* Patient-file sidebar */
#patient-file { display: flex; flex-direction: column; min-height: 0; }
#patient-file-meta { font-size: 12px; margin-bottom: 8px; }
#patient-file-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #0c0d13;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  font-family: "Consolas", "SF Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #dbe1e8;
  overflow-y: auto;
  max-height: 62vh;
  margin: 0;
}

/* Patient-identity modal (same visual language as help modal) */
#patient-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 101;
}
#patient-modal[hidden] { display: none; }
#patient-modal .modal-inner {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 480px;
  width: 100%;
}
.lbl-col { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.lbl-col input {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; font-size: 15px;
}
.lbl-col input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Help modal */
#help-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
/* HTML `hidden` attr = display:none, but our `display:flex` above
   would win on specificity. Explicit override so JS `modal.hidden=true`
   actually closes it. */
#help-modal[hidden] { display: none; }
.modal-inner {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 82vh;
  overflow: auto;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; }
#help-close {
  background: transparent; border: none; color: var(--muted);
  font-size: 26px; cursor: pointer; line-height: 1; padding: 0 4px;
}
#help-body { padding: 14px 18px; line-height: 1.55; font-size: 15px; }
#help-body p { margin: 0 0 10px; }

@media (max-width: 480px) {
  header h1 { font-size: 22px; }
  .tag { display: none; }
  #controls label { flex-basis: 100%; }
}
