/* Adsoft Meet - tema oscuro, una sola hoja para lobby y sala */

:root {
  --bg: #0e1116;
  --bg-soft: #161b22;
  --bg-raised: #1d232c;
  --border: #2a323d;
  --text: #e6edf3;
  --text-dim: #9aa7b4;
  --accent: #2d7dd2;        /* azul corporativo de Adsoft */
  --accent-soft: #1a3a5c;   /* navy corporativo de Adsoft */
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --bar: 76px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

/* ------------------------------------------------------------- utilidades */

.hidden { display: none !important; }

.btn {
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 600;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: #262e39; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #2569b4; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.input, select.input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  outline: none;
}
.input:focus { border-color: var(--accent); }

.msg {
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.msg-error { background: rgba(239, 68, 68, .12); border-color: #7f1d1d; color: #fca5a5; }
.msg-info { background: rgba(59, 130, 246, .12); border-color: var(--accent-soft); color: #93c5fd; }

/* ------------------------------------------------------------------ lobby */

.lobby {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(45, 125, 210, .18), transparent 60%),
    radial-gradient(700px 500px at 110% 10%, rgba(34, 197, 94, .10), transparent 55%);
}

.lobby-card {
  width: min(940px, 100%);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.lobby-hero { padding: 44px 40px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 11px;
  display: block; flex: none;
}
.brand h1 {
  font-size: 21px; margin: 0; letter-spacing: -.3px; font-weight: 800;
}
.brand h1 span { font-weight: 300; color: var(--accent); }

.lobby-hero h2 { font-size: 30px; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.5px; }
.lobby-hero p { color: var(--text-dim); margin: 0 0 26px; }

.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 11px; }
.feature-list li {
  display: flex; gap: 10px; align-items: flex-start;
  color: var(--text-dim); font-size: 14px;
}
.feature-list svg { flex: none; margin-top: 2px; color: var(--ok); }

.lobby-form {
  padding: 40px 36px;
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
}
.lobby-form h3 { margin: 0 0 20px; font-size: 17px; }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-dim); font-size: 12px; margin: 22px 0;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

.row { display: flex; gap: 10px; }
.row > .input { flex: 1; }

@media (max-width: 800px) {
  .lobby-card { grid-template-columns: 1fr; }
  .lobby-hero { padding: 32px 26px 8px; }
  .lobby-form { border-left: 0; border-top: 1px solid var(--border); padding: 28px 26px 34px; }
}

/* -------------------------------------------------------- sala de espera */

.prejoin {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 20px;
}
.prejoin-card {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 28px;
  align-items: center;
}
.preview-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #05070a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.preview-wrap video {
  width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
}
.preview-off {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--text-dim); font-size: 14px; gap: 10px;
  background: #05070a;
}
.preview-controls {
  position: absolute; left: 0; right: 0; bottom: 14px;
  display: flex; justify-content: center; gap: 12px;
}
.prejoin-panel h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.3px; }
.prejoin-panel .room-code {
  color: var(--text-dim); margin: 0 0 22px; font-size: 14px;
}
.room-code b { color: var(--text); font-family: ui-monospace, monospace; }

/* ------------------------------------------------------------------ sala */

.room {
  height: 100%;
  display: grid;
  grid-template-rows: 1fr var(--bar);
  overflow: hidden;
}
.stage { display: flex; min-height: 0; }

.grid-wrap { flex: 1; min-width: 0; padding: 14px; overflow: hidden; }
#grid {
  height: 100%;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  align-content: center;
}

.tile {
  position: relative;
  background: #05070a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
  container-type: inline-size;
  transition: border-color .18s, box-shadow .18s;
}
/* Quien comparte pantalla ocupa una fila entera cuando hay varios. */
.tile.spotlight { grid-column: 1 / -1; }
.tile.speaking {
  border-color: var(--ok);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .35);
}
.tile video {
  width: 100%; height: 100%; object-fit: cover; display: block;
  background: #05070a;
}
.tile.mirror video { transform: scaleX(-1); }
.tile.sharing video { object-fit: contain; }

.tile-avatar {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #1b2430, #0d1218);
}
.avatar-circle {
  width: clamp(56px, 22%, 104px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #dbeafe;
  display: grid; place-items: center;
  font-size: clamp(20px, 7cqw, 38px);
  font-weight: 700;
}

.tile-label {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 7px;
  max-width: calc(100% - 20px);
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(5, 7, 10, .68);
  backdrop-filter: blur(6px);
  font-size: 13px;
}
.tile-label .name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 9px; border-radius: 8px; font-size: 12px;
  background: rgba(5, 7, 10, .68);
  color: var(--text-dim);
}
.tile-badge.warn { color: var(--warn); }
.icon-muted { color: var(--danger); flex: none; }

/* ------------------------------------------------------------- panel lat. */

.panel {
  width: 340px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
}
.panel-tabs { display: flex; border-bottom: 1px solid var(--border); }
.panel-tab {
  flex: 1; padding: 14px 8px; background: none; border: 0;
  color: var(--text-dim); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.panel-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.panel-body { flex: 1; overflow-y: auto; padding: 14px; }
.panel-foot { padding: 12px; border-top: 1px solid var(--border); }

.chat-msg { margin-bottom: 14px; font-size: 14px; }
.chat-msg .meta { font-size: 12px; color: var(--text-dim); margin-bottom: 3px; }
.chat-msg .meta b { color: var(--accent); font-weight: 600; }
.chat-msg.own .meta b { color: var(--ok); }
.chat-msg .body {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  padding: 8px 11px; border-radius: 10px;
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.chat-system {
  text-align: center; color: var(--text-dim);
  font-size: 12.5px; margin: 10px 0;
}
.chat-form { display: flex; gap: 8px; }
.chat-form .input { flex: 1; }

.people-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px; border-radius: 9px;
}
.people-item:hover { background: var(--bg-raised); }
.people-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: #dbeafe;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.people-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people-icons { display: flex; gap: 6px; color: var(--text-dim); }

/* ------------------------------------------------------------ barra ctrl. */

.controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
}
.controls-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bar-mark { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.controls-left .meta { min-width: 0; }
.controls-left .meta div:first-child {
  font-weight: 600; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.controls-left .meta div:last-child { font-size: 12px; color: var(--text-dim); }
.controls-center { display: flex; gap: 10px; justify-content: center; }
.controls-right { display: flex; gap: 10px; justify-content: flex-end; }

.ctrl {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  display: grid; place-items: center;
  position: relative;
  transition: background .15s, border-color .15s;
}
.ctrl:hover { background: #2a323d; }
.ctrl.off { background: var(--danger); border-color: var(--danger); color: #fff; }
.ctrl.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.ctrl.leave { width: 62px; border-radius: 24px; background: var(--danger); border-color: var(--danger); color: #fff; }
.ctrl .badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}

@media (max-width: 860px) {
  :root { --bar: 68px; }
  .panel { position: absolute; inset: 0 0 var(--bar); width: 100%; z-index: 20; }
  .controls { grid-template-columns: 1fr auto; }
  .controls-left { display: none; }
  .ctrl { width: 44px; height: 44px; }
}

/* ---------------------------------------------------------------- toasts */

#toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 50;
  pointer-events: none;
}
.toast {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 10px 16px; border-radius: 10px; font-size: 14px;
  animation: toast-in .18s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------- aviso de pantalla compartida */
/* Ocupa la baldosa de quien comparte, en lugar de devolverle su propia
   pantalla: al compartir la pestana de la reunion se veria la sala dentro de
   la sala, repetida sin fin. */

.tile-share {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 18px;
  background: linear-gradient(160deg, #16283c, #0d1218);
  overflow: auto;
}

.share-notice {
  text-align: center;
  max-width: 460px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

.share-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center;
  background: rgba(45, 125, 210, .18);
  color: var(--accent);
  border: 1px solid rgba(45, 125, 210, .35);
}

.share-notice h3 {
  margin: 0; font-size: clamp(15px, 2.4cqw, 20px); letter-spacing: -.2px;
}

.share-notice ul {
  margin: 0; padding: 0; list-style: none;
  display: grid; gap: 7px;
  text-align: left;
  color: var(--text-dim);
  font-size: clamp(11.5px, 1.6cqw, 13.5px);
  line-height: 1.45;
}

.share-notice li { position: relative; padding-left: 16px; }
.share-notice li::before {
  content: "";
  position: absolute; left: 0; top: .55em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

.share-notice .btn { margin-top: 4px; }

/* En baldosas pequenas solo caben el icono y el titulo. */
@container (max-height: 240px) {
  .share-notice ul { display: none; }
  .share-icon { width: 40px; height: 40px; border-radius: 12px; }
}
