/* ============================================================
   MONCHIS · componentes.css
   Botones, tarjetas, badges, toasts. Todo movil-primero y con
   objetivos tactiles >= 48px. Nada depende de :hover.
   ============================================================ */

/* --- Botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-min);
  padding: 0 20px;
  border: none;
  border-radius: var(--radio);
  background: var(--surface-2);
  color: var(--texto);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-rapida), background var(--t-rapida), opacity var(--t-rapida);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-acento {
  background: var(--acento);
  color: #fff;
  box-shadow: 0 6px 18px var(--acento-tenue);
}
.btn-fantasma {
  background: transparent;
  border: 1px solid var(--borde);
}
.btn-bloque { width: 100%; }
.btn-lg { min-height: 56px; font-size: var(--fs-lg); }

/* Foco visible para accesibilidad */
.btn:focus-visible,
input:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

/* --- Tarjetas --- */
.tarjeta {
  background: var(--surface);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: var(--gap-lg);
  box-shadow: var(--sombra-sm);
}

/* --- Campo de texto --- */
.campo {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  color: var(--texto);
  font: inherit;
}
.campo::placeholder { color: var(--texto-mut); }
.campo:focus { border-color: var(--acento); }

/* --- Badge / etiqueta de estado --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 700;
  background: var(--surface-2);
  color: var(--texto-mut);
}
.badge.ok      { background: color-mix(in srgb, var(--ok) 18%, transparent);      color: var(--ok); }
.badge.error   { background: color-mix(in srgb, var(--peligro) 18%, transparent); color: var(--peligro); }
.badge.aviso   { background: color-mix(in srgb, var(--aviso) 18%, transparent);   color: var(--aviso); }

/* Punto-indicador (semaforo) */
.punto {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--texto-mut); flex: none;
}
.punto.ok    { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.punto.error { background: var(--peligro); }
.punto.cargando { background: var(--aviso); animation: latido 1s infinite; }

@keyframes latido { 50% { opacity: .35; } }

/* --- Lista de chequeo (healthcheck) --- */
.chequeo {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chequeo li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
}
.chequeo li .etq { flex: 1; }

/* --- Toast --- */
#toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  width: min(92%, 460px);
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--borde);
  border-left: 4px solid var(--acento);
  border-radius: var(--radio-sm);
  padding: 12px 16px;
  box-shadow: var(--sombra);
  animation: subir var(--t-media);
}
.toast.ok    { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--peligro); }

@keyframes subir {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Lobby / Salas (Sesión 2)
   ============================================================ */

/* Item de sala en la lista del lobby */
.sala-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  color: var(--texto);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-rapida), border-color var(--t-rapida);
}
.sala-item:active { transform: scale(0.98); border-color: var(--acento-borde); }

/* Código de sala en grande (pantalla de sala) */
.codigo-grande {
  font-size: var(--fs-xl);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--acento);
}

/* Input de código: monoespaciado y centrado */
.codigo-input {
  text-align: center;
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

/* Item de jugador en la sala */
.jugador-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
}

/* --- Chat de sala (Sesion 2B) --- */
.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-mensajes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
  max-height: 38vh;
  overflow-y: auto;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
  -webkit-overflow-scrolling: touch;
}
.chat-linea {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 10px;
  background: var(--surface-2);
  border-radius: var(--radio-sm);
  align-self: flex-start;
  max-width: 88%;
}
.chat-linea.yo {
  align-self: flex-end;
  background: color-mix(in srgb, var(--acento) 22%, var(--surface-2));
}
.chat-nombre {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--acento);
}
.chat-linea.yo .chat-nombre { color: var(--texto); opacity: .85; }
.chat-texto {
  color: var(--texto);
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-barra {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.chat-barra .campo { flex: 1; }

/* --- Botón de silencio (chimes) --- */
.btn-sonido {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  background: var(--surface-2);
  border: 1px solid var(--borde);
  border-radius: 999px;
  color: var(--texto);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform var(--t-rapida), border-color var(--t-rapida);
}
.btn-sonido:active { transform: scale(0.92); border-color: var(--acento-borde); }
.btn-sonido[aria-pressed="true"] { opacity: .65; }
