/*
 * CarpeIoT Display Player — sitio 100% estático, sin dependencias
 * externas (nada de CDNs: un dispositivo de señalización puede quedar
 * instalado años sin actualizarse, más vale no depender de terceros).
 * Paleta igual a la de display.carpeiot.com (marca fija de CarpeIoT):
 * oscuro #0F172A, turquesa #14B8A6, azul #2563EB.
 */

* {
  box-sizing: border-box;
}

/* Un selector por ID (usado más abajo para el layout de cada pantalla)
   pesa más que la regla por defecto del navegador para [hidden], así
   que sin esto el atributo hidden queda sin efecto y las tres pantallas
   (setup/player/error) se ven superpuestas en vez de alternarse. */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---- pantallas de setup / error (instalación, las ve un técnico de cerca) ---- */

#pantallaSetup,
#pantallaError {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0F172A 0%, #1e293b 60%, #0F172A 100%);
}

.setup-card {
  width: 100%;
  max-width: 420px;
  padding: 2rem;
  border-radius: .75rem;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
  text-align: center;
}

.setup-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: #0F172A;
  margin-bottom: 1rem;
}

.setup-brand-icon {
  color: #14B8A6;
  font-size: 1.4rem;
}

.setup-card h1 {
  font-size: 1.3rem;
  color: #0F172A;
  margin: 0 0 .5rem;
}

.setup-card p {
  color: #64748B;
  font-size: .9rem;
  margin: 0 0 1.25rem;
}

#formVincular label {
  display: block;
  text-align: left;
  font-size: .8rem;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: .3rem;
}

#formVincular input {
  width: 100%;
  padding: .65rem .75rem;
  border: 1px solid #CBD5E1;
  border-radius: .5rem;
  font-size: 1rem;
  margin-bottom: 1rem;
}

#formVincular button,
#btnReintentarVinculo {
  width: 100%;
  padding: .7rem;
  border: none;
  border-radius: .5rem;
  background: #2563EB;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

#btnReintentarVinculo {
  margin-top: .5rem;
}

.setup-error {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
  border-radius: .5rem;
  padding: .5rem .75rem;
  font-size: .85rem;
  margin-bottom: 1rem;
  text-align: left;
}

/* ---- reproductor ---- */

#pantallaPlayer {
  position: fixed;
  inset: 0;
  background: #000;
}

#lienzo {
  position: relative;
  width: 100%;
  height: 100%;
}

.zona {
  position: absolute;
  overflow: hidden;
  background: #000;
}

.zona-item {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .6s ease;
}

.zona-item.activo {
  opacity: 1;
}

.zona-item img,
.zona-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.zona-item iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.zona-item .zona-texto {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  padding: 4%;
  font-size: 3.2vw;
  font-weight: 600;
  line-height: 1.3;
  background: #0F172A;
}

.zona-item .zona-vacia {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
  font-size: 1.4vw;
  background: #05070d;
}

/* pequeño indicador de reconexión, discreto — no debe alarmar al que ve la TV */
.zona-reconectando::after {
  content: '';
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #F59E0B;
  z-index: 5;
}
