@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #14161b;
  --panel: #1c1f26;
  --panel-raised: #23262e;
  --line: #33363f;
  --text: #edeae3;
  --text-dim: #9ba0ac;
  --accent: #f2a93b;
  --accent-dim: #7a5a24;
  --live: #e4572e;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

/* ---------- Header ---------- */
.top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.on-air {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.on-air .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #55585f; /* apagada por padrão: não estou ao vivo (ou status desconhecido) */
  transition: background 0.3s ease;
}

/* Só acende de verdade quando a YouTube API confirma live ativa */
.on-air[data-live="yes"] {
  color: var(--text);
}

.on-air[data-live="yes"] .dot {
  background: var(--live);
  box-shadow: 0 0 8px 2px rgba(228, 87, 46, 0.6);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.brand {
  font-weight: 600;
  font-size: 15px;
}

a.brand {
  color: inherit;
  text-decoration: none;
}

.top-tag {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

/* ---------- Layout principal ---------- */
.wrap {
  max-width: 460px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

@media (max-width: 560px) {
  .wrap {
    padding: 32px 18px 56px;
  }
}

/* ---------- Coluna do texto / waveform ---------- */
.intro h1 {
  font-size: clamp(32px, 4.4vw, 46px);
  line-height: 1.08;
  margin: 0 0 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.intro p {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 46ch;
  margin: 0 0 32px;
}

.waveform {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 90px;
  padding: 0 2px;
}

.waveform span {
  flex: 1;
  background: linear-gradient(to top, var(--accent-dim), var(--accent));
  border-radius: 3px 3px 0 0;
  animation: wave 1.6s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { height: 18%; }
  50% { height: 85%; }
}

.how-it-works {
  margin-top: 44px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.how-it-works h2 {
  font-size: 13px;
  text-transform: none;
  color: var(--text-dim);
  font-weight: 500;
  margin: 0 0 14px;
}

.how-it-works ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text-dim);
  font-size: 14px;
}

.how-it-works li { margin-bottom: 8px; }
.how-it-works li::marker {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--accent);
}

/* ---------- Painel do formulário ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.panel-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  margin-top: 20px;
}

label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: 'IBM Plex Sans', sans-serif;
}

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

.char-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
}

/* Seletor de tipo de mensagem (texto/áudio) */
.msg-type {
  display: flex;
  gap: 8px;
}

.msg-type button {
  flex: 1;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 10px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
}

.msg-type button.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(242, 169, 59, 0.09);
}

.hidden { display: none !important; }

/* Gravador de áudio */
.recorder {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.rec-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--live);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.rec-btn::after {
  content: '';
  position: absolute;
  inset: 14px;
  background: var(--text);
  border-radius: 2px;
}

.rec-btn.recording {
  animation: pulse 1s ease-in-out infinite;
}

.rec-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--text-dim);
}

.rec-status .time { color: var(--text); }

.preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
}

.preview-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #17140b;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 34px;
  text-align: center;
}

.preview-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preview-time {
  font-size: 13px;
  color: var(--text-dim);
}

/* Botão principal */
.submit-btn {
  width: 100%;
  margin-top: 26px;
  padding: 14px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #17140b;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.submit-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback {
  margin-top: 14px;
  font-size: 13px;
  font-family: 'IBM Plex Mono', monospace;
}

.feedback.ok { color: #7bd88f; }
.feedback.err { color: var(--live); }

/* ---------- Painel de login / gate de acesso ---------- */
.gate-text {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 22px;
}

.gate-text strong {
  color: var(--accent);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--text);
  color: #17140b;
}

.signed-in-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #7bd88f;
  margin-bottom: 6px;
}

.link-btn { white-space: nowrap; }

.link-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: 'IBM Plex Sans', sans-serif;
}

.link-btn:hover {
  border-color: var(--live);
  color: var(--text);
}

.test-mode-flag {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

/* ---------- Consentimento no formulário ---------- */
.consent-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 18px 0 4px;
  font-size: 13px;
  color: var(--text-dim);
}

.consent-row input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.consent-row a {
  color: var(--accent);
}

/* ---------- Rodapé com links legais ---------- */
.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.site-footer a {
  color: var(--text-dim);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

/* ---------- Páginas de texto legal ---------- */
.legal {
  max-width: 780px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.legal a { color: var(--accent); }

.legal h1 {
  font-size: 24px;
  margin: 0 0 4px;
}

.legal .updated {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.legal h2 {
  font-size: 16px;
  margin: 32px 0 8px;
  color: var(--text);
}

.legal p, .legal li {
  font-size: 14px;
  color: #d5d2cb;
}

.legal ul, .legal ol {
  padding-left: 20px;
}

.legal li {
  margin-bottom: 6px;
}

.legal .draft-note {
  border: 1px solid var(--accent-dim);
  background: rgba(242, 169, 59, 0.06);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 28px;
}

.legal .back {
  display: inline-block;
  margin-top: 36px;
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
}

.legal .back:hover { color: var(--text); }

.legal h3 {
  font-size: 14px;
  margin: 18px 0 6px;
  color: var(--text);
  font-weight: 600;
}

/* ---------- Ações na linha "você vai aparecer como" ---------- */
.signed-in-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- Painel do dono (admin.html) ---------- */
.admin {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}

.admin-intro {
  font-size: 14px;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.admin-warn {
  border: 1px solid var(--accent-dim);
  background: rgba(242, 169, 59, 0.07);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 24px;
}

.voice-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.voice-card-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.voice-card-head .v-name {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
}

.v-remove {
  flex-shrink: 0;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin: 12px 0 5px;
}

.param-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

@media (max-width: 620px) {
  .param-groups { grid-template-columns: 1fr; }
}

.param-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px 14px;
  margin: 0;
}

.param-group legend {
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--accent);
  padding: 0 6px;
  text-transform: uppercase;
}

.slider-row {
  display: grid;
  grid-template-columns: 74px 1fr 40px;
  align-items: center;
  gap: 8px;
  margin: 9px 0;
}

.slider-label {
  font-size: 12px;
  color: var(--text-dim);
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.slider-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text);
  text-align: right;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  margin: 10px 0 2px;
}

.check-row input[type="checkbox"] {
  accent-color: var(--accent);
}

.btn-secondary {
  background: var(--panel-raised);
  border: 1px dashed var(--line);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--text);
}

.admin-actions {
  position: sticky;
  bottom: 0;
  margin-top: 20px;
  padding-top: 16px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-actions .submit-btn {
  margin-top: 0;
  width: auto;
  padding: 12px 22px;
}

.admin-actions .feedback {
  margin-top: 0;
}

/* ---------- Painel do dono: seções, alertas ---------- */
.admin-section {
  margin-bottom: 34px;
}

.admin-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.admin-section-head h2 {
  margin: 0;
  font-size: 16px;
}

.admin-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.btn-inline {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
}

.voice-picker-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.voice-picker-row select {
  flex: 1;
  min-width: 160px;
}

.ed-field {
  margin-bottom: 4px;
}

/* Lista de alertas */
.alert-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--panel);
}

.alert-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.alert-when {
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.alert-name {
  font-weight: 600;
  font-size: 13px;
}

.alert-msg {
  font-size: 13px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.alert-noaudio {
  font-size: 11px;
  color: var(--accent-dim);
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  padding: 1px 5px;
}

.btn-replay {
  flex-shrink: 0;
  border: 1px solid var(--accent);
  background: rgba(242, 169, 59, 0.12);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: 'IBM Plex Sans', sans-serif;
  cursor: pointer;
}

.btn-replay:hover { background: rgba(242, 169, 59, 0.22); }
.btn-replay:disabled { opacity: 0.6; cursor: default; }

/* ---------- Feed de alertas: badges, popout ---------- */
.admin-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.feed-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}
.feed-filter input { accent-color: var(--accent); }

.alert-side {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.alert-badge {
  font-size: 11px;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}
.alert-badge.new {
  color: var(--accent);
  border: 1px solid var(--accent-dim);
}
.alert-badge.shown {
  color: #7bd88f;
  border: 1px solid #375c40;
}

.alert-row.is-shown {
  opacity: 0.62;
}

/* Janelinha do popout (/feed.html) */
.feed-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px 28px;
}

.feed-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  margin-bottom: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.feed-head strong { font-size: 14px; margin-right: auto; }

.feed-wrap .alert-row { flex-wrap: wrap; }
.feed-wrap .alert-msg { white-space: normal; }

/* ---------- Botão liga/desliga do envio de mensagens ---------- */
.svc-toggle {
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-family: 'IBM Plex Sans', sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.svc-toggle:disabled { opacity: 0.6; cursor: default; }
.svc-toggle.on {
  border-color: #375c40;
  color: #7bd88f;
  background: rgba(123, 216, 143, 0.08);
}
.svc-toggle.off {
  border-color: var(--live);
  color: var(--live);
  background: rgba(228, 87, 46, 0.1);
}
.svc-toggle.paused {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(242, 169, 59, 0.12);
}

.alert-voice {
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
}

/* ---------- Controle universal de parâmetros ---------- */
.bulk-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 16px;
  margin-bottom: 16px;
  background: var(--panel);
}
.bulk-panel[open] { padding-bottom: 14px; }
.bulk-panel > summary {
  cursor: pointer;
  padding: 12px 0;
  font-size: 13px;
  color: var(--text-dim);
  list-style: none;
}
.bulk-panel > summary::-webkit-details-marker { display: none; }
.bulk-panel > summary:hover { color: var(--text); }

.bulk-scope {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 12px;
}
.bulk-scope .check-row { margin: 0; }
