/*
 * Identidade visual Farlo — "Ouro Executivo" (carvão + ouro).
 * Tokens portados de farlo-design/tokens/globals.css. Escuro é o padrão.
 * Regras: sem sombras/glow, ouro só em ações/destaques, alertas com ícone + texto.
 */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 0.625rem;

  /* tema claro */
  --background: oklch(0.979 0.007 88.6);
  --foreground: oklch(0.192 0.016 89.9);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.192 0.016 89.9);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.192 0.016 89.9);
  --primary: oklch(0.825 0.17 79.8);
  --primary-foreground: oklch(0.153 0.005 248.2);
  --secondary: oklch(0.952 0.015 90.2);
  --secondary-foreground: oklch(0.192 0.016 89.9);
  --muted: oklch(0.952 0.015 90.2);
  --muted-foreground: oklch(0.451 0.027 87.2);
  --accent: oklch(0.973 0.035 91.1);
  --accent-foreground: oklch(0.471 0.099 76.3);
  --destructive: oklch(0.469 0.165 28.5);
  --border: oklch(0.916 0.018 89.4);
  --input: oklch(0.855 0.026 89.2);
  --ring: oklch(0.713 0.151 74.5);
  --success: oklch(0.468 0.101 159.9);
  --danger: oklch(0.469 0.165 28.5);
  --warning: oklch(0.513 0.147 44.7);
  --info: oklch(0.488 0.217 264.4);
  --gold: oklch(0.825 0.17 79.8);
  --gold-text: oklch(0.471 0.099 76.3);
  --gold-border: #e3cf9a;
  color-scheme: light;
}

.dark {
  --background: oklch(0.153 0.005 248.2);
  --foreground: oklch(0.948 0.003 247.9);
  --card: oklch(0.185 0.008 248.2);
  --card-foreground: oklch(0.948 0.003 247.9);
  --popover: oklch(0.185 0.008 248.2);
  --popover-foreground: oklch(0.948 0.003 247.9);
  --primary: oklch(0.825 0.17 79.8);
  --primary-foreground: oklch(0.153 0.005 248.2);
  --secondary: oklch(0.229 0.007 248.1);
  --secondary-foreground: oklch(0.948 0.003 247.9);
  --muted: oklch(0.229 0.007 248.1);
  --muted-foreground: oklch(0.703 0.011 248);
  --accent: oklch(0.229 0.007 248.1);
  --accent-foreground: oklch(0.863 0.149 84.7);
  --destructive: oklch(0.744 0.155 21.5);
  --border: oklch(0.272 0.006 258.4);
  --input: oklch(0.359 0.008 255.5);
  --ring: oklch(0.825 0.17 79.8);
  --success: oklch(0.794 0.114 163.8);
  --danger: oklch(0.744 0.155 21.5);
  --warning: oklch(0.779 0.143 50.2);
  --info: oklch(0.786 0.109 258);
  --gold: oklch(0.825 0.17 79.8);
  --gold-text: oklch(0.863 0.149 84.7);
  --gold-border: #483915;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
option { background: var(--popover); color: var(--popover-foreground); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.titulo { font-size: 36px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.dark .titulo-prata {
  background: linear-gradient(180deg, #ffffff, #a9afb5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.muted { color: var(--muted-foreground); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 10px;
  border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap;
  cursor: pointer; user-select: none; text-decoration: none;
  transition: filter .15s, background-color .15s, color .15s;
  background: transparent; color: var(--foreground);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-lg { height: 40px; padding: 0 14px; }
.btn-block { width: 100%; }
.btn-default {
  background-color: var(--primary);
  background-image: linear-gradient(135deg, #ffd84d, #ffb70a);
  color: var(--primary-foreground); font-weight: 600;
}
.btn-default:hover { filter: brightness(1.05); }
.btn-outline { border-color: var(--input); }
.btn-outline:hover, .btn-ghost:hover { background: var(--muted); }
.btn-destructive { background: color-mix(in oklch, var(--destructive) 15%, transparent); color: var(--destructive); }
.btn-link { color: var(--gold-text); padding: 0; height: auto; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.btn-icon { width: 32px; padding: 0; }

/* ---------- formulário ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 13px; font-weight: 500; }
.hint { font-size: 12px; color: var(--muted-foreground); }
.input {
  height: 44px; width: 100%; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--input);
  background: var(--background); color: var(--foreground);
  font: inherit; font-size: 14px;
}
.input::placeholder { color: var(--muted-foreground); }
.input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--destructive); }

/* ---------- card / badge / alerta ---------- */
.card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: 18px; padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.card-destaque { border-color: var(--gold-border); }
.card-title { font-size: 16px; font-weight: 600; }
.card-desc { font-size: 14px; color: var(--muted-foreground); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px; border-radius: 26px;
  font-size: 12px; font-weight: 500; border: 1px solid transparent; white-space: nowrap;
}
.badge-gold { border-color: color-mix(in oklch, var(--gold) 40%, transparent); background: color-mix(in oklch, var(--gold) 15%, transparent); color: var(--gold-text); }
.badge-muted { background: var(--muted); color: var(--muted-foreground); }

.alert {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.alert-danger { background: color-mix(in oklch, var(--danger) 15%, transparent); color: var(--danger); }
.alert-info { background: color-mix(in oklch, var(--info) 15%, transparent); color: var(--info); }

/* ---------- layout ---------- */
.auth-page {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 24px; padding: 32px 16px;
}
.auth-card { width: 100%; max-width: 400px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--muted); border-radius: 12px; }
.tab { height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted-foreground); font: inherit; font-weight: 500; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--card); color: var(--foreground); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 24px; border-bottom: 1px solid var(--border);
}
.page { max-width: 1040px; margin: 0 auto; padding: 40px 24px; display: flex; flex-direction: column; gap: 32px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

.marca { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.marca svg { height: 32px; width: auto; flex-shrink: 0; }
.marca-nome { display: flex; flex-direction: column; line-height: 1; }
.marca-nome strong { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.marca-nome .eyebrow { font-size: 0.625rem; margin-top: 4px; }

.rodape { font-size: 12px; color: var(--muted-foreground); text-align: center; padding: 16px; }
.rodape a { text-decoration: underline; text-decoration-color: color-mix(in oklch, var(--gold) 50%, transparent); text-underline-offset: 3px; }
.rodape a:hover { color: var(--gold-text); }

.loading { min-height: 100%; display: grid; place-items: center; color: var(--muted-foreground); }

/* ---------- início: lista de salas ---------- */
.lista-salas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item-sala {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--card);
}
.item-sala-nome { font-weight: 600; text-decoration: none; }
.item-sala-nome:hover { color: var(--gold-text); }
.item-sala .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- app do Windows ---------- */
.app-atualizacao { display: flex; align-items: center; gap: 8px; }
.app-atualizacao .btn { height: 32px; }
.app-versao { font-size: 12px; color: var(--muted-foreground); }
.app-erro { color: var(--destructive); }

/* Sons na transmissão (app do Windows) */
.sons-fundo {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgb(0 0 0 / .55);
}
.sons { width: min(100%, 520px); max-height: min(90vh, 640px); display: flex; flex-direction: column; gap: 14px; }
.sons-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; min-height: 60px; }
.sons-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px;
}
.sons-nome { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sons-nome strong, .sons-nome .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sons-chave { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; flex-shrink: 0; }
.sons-chave input { width: 16px; height: 16px; accent-color: var(--gold); }

/* Aviso de versão nova do site */
.aviso-versao {
  position: fixed; left: 16px; bottom: 16px; z-index: 60; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px 10px 16px; border: 1px solid var(--gold-border); border-radius: 14px;
  background: var(--card); color: var(--card-foreground); font-size: 14px;
}

/* ---------- sala ---------- */
.sala { height: 100%; display: flex; flex-direction: column; }
.sala .topbar { flex-shrink: 0; }
.sala-titulo { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; padding-left: 16px; border-left: 1px solid var(--border); }
.sala-titulo strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sala-corpo { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 360px; }
.palco {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 16px; background: var(--background); min-height: 0; min-width: 0;
}
.palco-alerta { position: absolute; left: 24px; right: 24px; bottom: 76px; display: flex; justify-content: center; z-index: 5; }
.palco-controles {
  flex-shrink: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--card);
}
.palco-controles .check { margin-top: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--gold); }
.volume { width: 90px; accent-color: var(--gold); }

/* Mosaico: grade de blocos 16:9; no foco, um bloco grande e os outros numa faixa. */
.mosaico {
  flex: 1; min-height: 0; overflow-y: auto;
  display: grid; gap: 10px; align-content: center;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
}
.mosaico.sozinho { justify-items: center; }
.mosaico.sozinho .bloco { width: min(100%, 960px); }
.bloco {
  --cor-bloco: #2a2c31;
  position: relative; aspect-ratio: 16 / 9; min-width: 0; overflow: hidden;
  border-radius: 12px; background: var(--cor-bloco); color: #fff;
  outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s;
}
.bloco.ao-vivo { cursor: pointer; outline-color: color-mix(in oklch, var(--gold) 55%, transparent); }
.bloco.com-video { background: #000; cursor: zoom-in; }
.bloco.com-video.em-foco { cursor: zoom-out; }
.bloco-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; }
.bloco.com-video .bloco-video { display: block; }
.bloco-perfil {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
}
.bloco-avatar {
  width: clamp(48px, 22%, 112px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: rgb(255 255 255 / .12); border: 2px solid rgb(255 255 255 / .18);
  font-size: clamp(18px, 3vw, 44px); font-weight: 700; letter-spacing: -.02em; user-select: none;
}
.bloco.ao-vivo .bloco-avatar { border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in oklch, var(--gold) 25%, transparent); }
.bloco-rodape {
  position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px);
  display: flex; align-items: center; gap: 6px; pointer-events: none;
}
.bloco-nome {
  padding: 3px 8px; border-radius: 6px; background: rgb(0 0 0 / .55); font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge-aovivo {
  flex-shrink: 0; padding: 3px 7px; border-radius: 6px; background: var(--gold); color: var(--primary-foreground);
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
}
.bloco-aviso {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font-size: 14px; text-align: center; padding: 16px; background: rgb(0 0 0 / .35);
}
.bloco-aviso .btn-outline { color: #fff; border-color: rgb(255 255 255 / .4); background: transparent; }
.bloco-som { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2; }
.bloco-barra {
  position: absolute; top: 8px; right: 8px; left: 8px; z-index: 3;
  display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex-wrap: wrap;
  opacity: 0; transition: opacity .15s;
}
.bloco:hover .bloco-barra, .bloco:focus-within .bloco-barra { opacity: 1; }
@media (hover: none) { .bloco-barra { opacity: 1; } }
.bloco-barra .btn { height: 30px; padding: 0 10px; font-size: 12px; }
.bloco-barra .btn-ghost { background: rgb(0 0 0 / .6); color: #fff; }
.bloco-barra .btn-ghost:hover { background: rgb(0 0 0 / .8); }
.bloco-barra .btn-outline { background: rgb(0 0 0 / .6); color: #fff; border-color: rgb(255 255 255 / .3); }
.bloco-barra .volume { padding: 0 6px; height: 30px; border-radius: 8px; background: rgb(0 0 0 / .6); }
.bloco:fullscreen { border-radius: 0; aspect-ratio: auto; outline: 0; }

.mosaico.foco {
  align-content: stretch;
  grid-template-columns: minmax(0, 1fr) clamp(160px, 18vw, 240px);
  /* Uma linha por miniatura + uma linha que estica; o bloco em foco ocupa todas. */
  grid-template-rows: repeat(var(--linhas), auto) minmax(0, 1fr);
}
.mosaico.foco.sozinho { grid-template-columns: minmax(0, 1fr); justify-items: stretch; }
.mosaico.foco.sozinho .bloco { width: auto; }
.mosaico.foco .bloco.em-foco { grid-column: 1; grid-row: 1 / -1; aspect-ratio: auto; }
.mosaico.foco .bloco:not(.em-foco) .bloco-barra,
.mosaico.foco .bloco:not(.em-foco) .bloco-perfil .btn { display: none; }
.mosaico.foco .bloco:not(.em-foco) .bloco-nome { font-size: 11px; }

.lateral { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--border); background: var(--card); }

.participantes { padding: 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.participantes ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow-y: auto; }
.participantes li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: color-mix(in oklch, var(--gold) 15%, transparent); color: var(--gold-text); font-size: 12px; font-weight: 700;
}

.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.chat.arrastando { outline: 2px dashed var(--ring); outline-offset: -8px; }
.chat-lista { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.msg { display: flex; flex-direction: column; gap: 2px; max-width: 92%; }
.msg-minha { align-self: flex-end; align-items: flex-end; }
.msg-cabeca { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.msg-minha .msg-cabeca strong { color: var(--gold-text); }
.msg-texto {
  padding: 8px 12px; border-radius: 12px; background: var(--muted);
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px;
}
.msg-minha .msg-texto { background: color-mix(in oklch, var(--gold) 15%, transparent); }
.msg-img { display: block; max-width: 100%; max-height: 240px; border-radius: 12px; border: 1px solid var(--border); }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-texto { height: 44px; min-height: 44px; max-height: 140px; padding: 11px 12px; resize: none; line-height: 1.4; overflow-y: hidden; }

@media (max-width: 900px) {
  .sala { height: auto; min-height: 100%; }
  .sala-corpo { grid-template-columns: 1fr; }
  .palco { min-height: 320px; padding: 12px; }
  .mosaico { overflow: visible; }
  .mosaico.foco {
    grid-template-columns: repeat(var(--linhas), minmax(0, 1fr));
    grid-template-rows: auto auto;
  }
  .mosaico.foco .bloco.em-foco { grid-column: 1 / -1; grid-row: 1; aspect-ratio: 16 / 9; }
  .lateral { border-left: 0; border-top: 1px solid var(--border); }
  .chat { min-height: 420px; }
}

@media (max-width: 600px) {
  .titulo { font-size: 28px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .page { padding: 24px 16px; }
  .hide-sm, .marca-nome { display: none; }
  .sala-titulo { padding-left: 8px; }
  .mosaico:not(.foco) { grid-template-columns: minmax(0, 1fr); }
}
