/* Pantalla de la junta. El color principal se carga desde la marca. */
:root {
  --primary: #E5A50A;
  --primary-text: #1F1A10;
  --record: #E5484D;
  --room-bg: #141312;
  --tile-bg: #24221F;
  --bar-bg: #1C1B19;
  --text-light: #F4F2EE;
  --muted-light: #A8A39A;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--room-bg);
  color: var(--text-light);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }

.icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ---------- Antes de entrar / al salir ---------- */
.prejoin, .ended {
  min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}
.prejoin-card {
  width: 100%; max-width: 420px; background: #1E1C1A; border: 1px solid #2E2B28;
  border-radius: 16px; padding: 28px 24px; text-align: center;
}
.brand-logo-lg { width: 96px; height: 96px; object-fit: contain; margin-bottom: 8px; }
.prejoin-card h1 { margin: 6px 0 6px; font-size: 21px; }
.muted { color: var(--muted-light); margin: 0 0 16px; line-height: 1.5; }
.prejoin-preview {
  width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; object-fit: cover;
  transform: scaleX(-1); margin-bottom: 14px;
}
.input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid #3A3733;
  background: #141312; outline: none; margin-bottom: 12px;
}
.input:focus { border-color: var(--primary); }
.prejoin-toggles { display: flex; gap: 18px; justify-content: center; margin-bottom: 16px; color: var(--muted-light); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--primary); width: 16px; height: 16px; }
.btn {
  border: 0; border-radius: 10px; padding: 12px 18px; font-weight: 600; cursor: pointer;
  transition: filter 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-block { width: 100%; }
.error { color: #FF8A8E; margin: 12px 0 0; line-height: 1.4; }

/* ---------- La junta ---------- */
.room { height: 100%; display: flex; flex-direction: column; }
.room-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid #2A2826;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { width: 32px; height: 32px; object-fit: contain; }
.brand-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-info { display: flex; align-items: center; gap: 12px; color: var(--muted-light); font-size: 13px; }
.rec-badge {
  display: inline-flex; align-items: center; gap: 6px; color: #fff;
  background: rgba(229, 72, 77, 0.18); border: 1px solid rgba(229, 72, 77, 0.5);
  padding: 3px 10px; border-radius: 999px; font-variant-numeric: tabular-nums; font-weight: 600;
}
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--record); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.grid {
  flex: 1; min-height: 0; padding: 12px; display: grid; gap: 10px;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}
.tile {
  position: relative; background: var(--tile-bg); border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; min-height: 0;
  outline: 3px solid transparent; outline-offset: -3px; transition: outline-color 0.15s;
}
.tile.is-speaking { outline-color: var(--primary); }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.is-local video { transform: scaleX(-1); }
.tile.no-video video { display: none; }
.tile-avatar {
  width: 84px; height: 84px; border-radius: 50%; background: #3A3733;
  display: none; align-items: center; justify-content: center; font-size: 32px; font-weight: 650;
}
.tile.no-video .tile-avatar { display: flex; }
.tile-name {
  position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px);
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, 0.55); padding: 4px 10px; border-radius: 8px; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-name .icon { width: 14px; height: 14px; color: #FF8A8E; display: none; }
.tile.is-muted .tile-name .icon { display: inline-flex; }

.room-bar {
  display: flex; justify-content: center; gap: 10px; padding: 12px 16px 16px;
  background: var(--bar-bg); border-top: 1px solid #2A2826; flex-wrap: wrap;
}
.ctrl {
  display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 78px; padding: 8px 10px; border: 0; border-radius: 12px; cursor: pointer;
  background: #2C2A27; color: var(--text-light); transition: background 0.15s;
}
.ctrl:hover { background: #383532; }
.ctrl-label { font-size: 12px; }
.ctrl.is-off { background: #4A2224; color: #FFB3B5; }
.ctrl.is-active { background: var(--record); color: #fff; }
.ctrl-leave { background: var(--record); color: #fff; }
.ctrl-leave:hover { background: var(--record); filter: brightness(1.08); }
.ctrl:disabled { opacity: 0.5; cursor: default; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: #F4F2EE; color: #1F1E1C; padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); font-weight: 500; max-width: calc(100% - 32px); text-align: center;
}

@media (max-width: 640px) {
  .ctrl { min-width: 60px; padding: 8px 6px; }
  .ctrl-label { font-size: 11px; }
  .grid { padding: 8px; gap: 8px; }
}
