/* Identidade Altitude Educação Empresarial
   grafite #14161B · papel #F4F1EC · dourado #B68A3E · pedra #7E848C · Instrument Sans */
:root {
  --ink: #14161B;
  --ink-2: #1D2027;
  --ink-3: #262A32;
  --paper: #F4F1EC;
  --paper-2: #E9E4DC;
  --gold: #B68A3E;
  --gold-hover: #C69A4D;
  --stone: #7E848C;
  --line: rgba(126, 132, 140, .28);

  --bg: var(--ink);
  --surface: var(--ink-2);
  --surface-2: var(--ink-3);
  --text: var(--paper);
  --muted: #A3A8AE;
  --primary: var(--gold);
  --danger: #C2473D;
  --radius: 6px;
  --font: "Instrument Sans", "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --brand: var(--gold);
  --brand-contrast: var(--ink);
  --ctl-bg: var(--ink-3);
  --ctl-hover: #31363F;
  --bar-bg: rgba(29, 32, 39, .82);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
a { color: var(--gold); }

.eyebrow {
  margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--gold);
}
.gold-rule { width: 56px; height: 2px; background: var(--gold); margin: 22px 0; }

input {
  background: var(--ink-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 3px; padding: 13px 14px; font: inherit; width: 100%; outline: none; transition: border-color .15s;
}
input::placeholder { color: var(--stone); }
input:focus { border-color: var(--gold); }

.btn {
  background: transparent; color: var(--paper); border: 1px solid rgba(244, 241, 236, .35); border-radius: 3px;
  padding: 12px 20px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--paper); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn.big { padding: 14px 26px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- topo ---------- */
.topbar {
  height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px; border-bottom: 1px solid var(--line);
}
.topbar .logo { height: 22px; width: auto; max-width: 70vw; display: block; }
.topbar .product { font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--stone); }

/* ---------- home ---------- */
.home { display: flex; flex-direction: column; min-height: 100%; }
.home main { flex: 1; display: grid; place-items: center; padding: 48px 16px; }
.home-card { width: 100%; max-width: 560px; }
.home h1 {
  font-size: clamp(32px, 6vw, 46px); font-weight: 400; line-height: 1.1; letter-spacing: -.01em;
  margin: 14px 0 0; text-wrap: balance;
}
.home h1 em { font-style: normal; color: var(--gold); }
.sub { color: var(--muted); margin: 0 0 28px; max-width: 46ch; }
.join-row { display: flex; gap: 8px; margin-top: 14px; }
.recs { margin-top: 48px; border-top: 1px solid var(--line); padding-top: 24px; }
.recs h2 { margin: 0 0 8px; }
.recs ul { list-style: none; padding: 0; margin: 0; }
.recs li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; word-break: break-all; color: var(--muted); }
.recs li a:first-child { color: var(--paper); text-decoration: none; }
.recs li a:first-child:hover { color: var(--gold); }
.footer { padding: 20px 24px; border-top: 1px solid var(--line); color: var(--stone); font-size: 12px; }

/* ---------- lobby ---------- */
.room .topbar { position: absolute; inset: 0 0 auto; z-index: 2; background: var(--ink); }
.lobby { min-height: 100%; display: grid; place-items: center; padding: 96px 16px 32px; }
.lobby-card { display: flex; gap: 48px; align-items: center; flex-wrap: wrap; justify-content: center; }
.preview-wrap { position: relative; width: min(600px, 100%); }
.preview-wrap .btn {
  position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; background: rgba(20, 22, 27, .7);
}
.lobby video {
  width: 100%; aspect-ratio: 16/9; background: var(--ink-2); border-radius: var(--radius); object-fit: cover;
  transform: scaleX(-1); display: block; box-shadow: inset 0 0 0 1px var(--line);
}
.lobby-form { width: 320px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; }
.lobby-form h2 { margin: 8px 0 0; font-size: 30px; font-weight: 400; line-height: 1.15; }
.lobby-form .gold-rule { margin: 4px 0 8px; }

/* ---------- reunião ---------- */
.meeting { height: 100%; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 1fr auto; }
.stage { position: relative; padding: 16px; min-height: 0; overflow: hidden; }
.grid {
  height: 100%; display: grid; gap: 10px;
  grid-template-columns: repeat(var(--cols, 1), 1fr); grid-auto-rows: 1fr;
}
.tile {
  position: relative; background: var(--ink-2); border-radius: var(--radius); overflow: hidden; min-height: 0;
  box-shadow: inset 0 0 0 1px var(--line);
}
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--ink-2); }
.tile.me video { transform: scaleX(-1); }
.tile.me.screen video, .tile.screen video { transform: none; object-fit: contain; background: #0E0F13; }
.tile .avatar {
  display: none; position: absolute; inset: 0; margin: auto; width: 96px; height: 96px; border-radius: 50%;
  background: var(--ink-3); color: var(--gold); font-size: 38px; font-weight: 500; place-items: center;
  box-shadow: 0 0 0 1px rgba(182, 138, 62, .45);
}
.tile.cam-off video { visibility: hidden; }
.tile.cam-off .avatar { display: grid; }
.tile .label {
  position: absolute; left: 10px; bottom: 10px; font-size: 13px; font-weight: 500; display: flex; gap: 6px; align-items: center;
  background: rgba(20, 22, 27, .72); padding: 4px 10px; border-radius: 3px;
}
.tile.connecting::after { content: "Conectando…"; position: absolute; top: 12px; right: 12px; font-size: 12px; color: var(--muted); }

.captions {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: min(800px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
.cap {
  background: rgba(20, 22, 27, .88); padding: 10px 16px; border-radius: 3px; font-size: 18px;
  border-left: 2px solid var(--gold);
}
.cap b { color: var(--gold); font-weight: 600; }
.cap.interim { opacity: .8; }

select {
  appearance: none; width: 100%; background: var(--ink-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237E848C' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center;
  color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 12px 38px 12px 14px;
  font: inherit; font-size: 14px; outline: none; cursor: pointer; text-overflow: ellipsis;
}
select:focus { border-color: var(--gold); }

/* Medidor de volume do microfone */
.mic-meter {
  position: absolute; left: 14px; bottom: 14px; width: 120px; height: 6px; border-radius: 3px;
  background: rgba(20, 22, 27, .7); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line);
}
.mic-meter span {
  display: block; height: 100%; width: calc(var(--level, 0) * 100%); background: var(--gold);
  transition: width .08s linear;
}
#micBtn:not(.off) { box-shadow: 0 0 0 calc(var(--level, 0) * 5px) rgba(182, 138, 62, .55); transition: box-shadow .08s linear, background .15s; }

.mic-warn {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center;
  width: max-content; max-width: calc(100% - 32px); padding: 10px 10px 10px 16px; border-radius: 3px;
  background: var(--ink-3); border-left: 2px solid var(--danger); box-shadow: 0 8px 24px rgba(0,0,0,.35); font-size: 14px;
}
.mic-warn .btn { padding: 8px 14px; font-size: 13px; }
.sound-unlock { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; }

.cc-status {
  position: absolute; top: 24px; left: 50%; transform: translateX(-50%); z-index: 3; max-width: calc(100% - 48px);
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 3px;
  background: rgba(20, 22, 27, .85); box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; color: var(--muted);
}
.cc-status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--stone); }
.cc-status.ok::before { background: var(--gold); animation: pulse 1.6s infinite; }
.cc-status.warn { color: var(--paper); box-shadow: inset 0 0 0 1px rgba(182, 138, 62, .6); }
.cc-status.warn::before { background: #E0A43A; }

.rec-banner {
  position: fixed; top: 12px; left: 12px; z-index: 5; background: var(--danger); color: #fff;
  padding: 5px 12px; border-radius: 3px; font-size: 12px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .6; } }

/* ---------- painel ---------- */
.panel {
  grid-row: 1; grid-column: 2; width: 360px; margin: 16px 16px 16px 0; background: var(--paper); color: var(--ink);
  border-radius: var(--radius); display: flex; flex-direction: column; min-height: 0;
}
.tabs { display: flex; align-items: center; padding: 6px 8px 0; gap: 4px; border-bottom: 1px solid var(--paper-2); }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 10px; font: inherit;
  font-size: 14px; font-weight: 600; color: var(--stone); cursor: pointer;
}
.tab.active { color: var(--ink); border-bottom-color: var(--gold); }
.icon-btn { margin-left: auto; background: none; border: 0; font-size: 16px; cursor: pointer; color: var(--stone); padding: 8px; }
.icon-btn:hover { color: var(--ink); }
.tab-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.msgs { list-style: none; margin: 0; padding: 14px 16px; overflow-y: auto; flex: 1; }
.msgs li { margin-bottom: 14px; font-size: 14px; }
.msgs .who { font-weight: 600; font-size: 13px; }
.msgs time { font-weight: 400; color: var(--stone); margin-left: 6px; }
.chat-form { padding: 12px; border-top: 1px solid var(--paper-2); }
.chat-form input { background: #fff; color: var(--ink); border: 1px solid var(--paper-2); }
.chat-form input:focus { border-color: var(--gold); }
.small-btn { margin: 12px; text-align: center; background: var(--ink); border-color: var(--ink); color: var(--paper); }
.small-btn:hover { background: var(--ink-3); border-color: var(--ink-3); }

/* ---------- controles ---------- */
.controls {
  grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 8px 16px 16px; gap: 8px;
}
.controls .left {
  color: var(--text); font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums;
}
.controls .left .sep { width: 1px; height: 14px; background: var(--muted); opacity: .5; }
.controls .center {
  display: flex; gap: 10px; padding: 8px; border-radius: 22px;
  background: var(--bar-bg); backdrop-filter: blur(12px); box-shadow: 0 8px 24px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.06);
}
.controls .right { display: flex; gap: 8px; justify-content: flex-end; }

.ctl {
  width: 52px; height: 48px; border-radius: 16px; border: 0; background: var(--ctl-bg); color: var(--text);
  cursor: pointer; position: relative; display: grid; place-items: center;
  transition: background .15s ease, transform .1s ease, border-radius .2s ease, color .15s ease;
}
.ctl svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; pointer-events: none;
}
.ctl:hover { background: var(--ctl-hover); }
.ctl:active { transform: scale(.94); }
.ctl:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ctl:disabled { opacity: .4; cursor: default; }

/* Alterna ícone ligado/desligado */
.ctl .i-off, .ctl.off .i-on { display: none; }
.ctl.off .i-off { display: block; }

.ctl.off { background: var(--danger); color: #fff; border-radius: 24px; }
.ctl.off:hover { background: #d33a2c; }
.ctl.active { background: var(--brand); color: var(--brand-contrast); }
.ctl.active:hover { filter: brightness(1.08); }
.ctl.rec { background: var(--danger); color: #fff; }
.ctl.rec svg { animation: pulse 1.6s infinite; }
.ctl.leave { width: 68px; background: var(--danger); color: #fff; border-radius: 24px; }
.ctl.leave svg { width: 26px; height: 26px; }
.ctl.leave:hover { background: #d33a2c; }
.ctl.ghost { background: transparent; width: 48px; border-radius: 50%; }
.ctl.ghost:hover { background: var(--ctl-bg); }
.ctl.badge::after {
  content: ""; position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 2px var(--bg);
}

.toast {
  position: fixed; right: 16px; top: 16px; z-index: 30; background: var(--ink-3); color: var(--paper);
  padding: 12px 16px; border-radius: 3px; border-left: 2px solid var(--gold); font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); max-width: min(380px, calc(100% - 32px));
}

@media (max-width: 720px) {
  .stage { padding: 8px; }
  .controls { grid-template-columns: 1fr; justify-items: center; }
  .controls .left { display: none; }
  .controls .right { position: absolute; right: 8px; top: 8px; flex-direction: column; }
  .controls .center { gap: 6px; padding: 6px; max-width: calc(100vw - 16px); }
  .cc-status { left: 16px; top: 16px; transform: none; max-width: calc(100% - 88px); }
  .toast { left: 16px; right: 16px; max-width: none; }
  .ctl { width: 44px; height: 44px; border-radius: 14px; }
  .ctl.leave { width: 56px; }
  .ctl svg { width: 20px; height: 20px; }
  .panel { position: fixed; inset: 0; width: auto; margin: 0; border-radius: 0; z-index: 20; }
  .grid { grid-template-columns: 1fr; }
}
