/* Estética de ronquidoyapneas.com: SIEMPRE oscura, con la foto de fondo, el velo índigo «de noche» y tarjetas de cristal
   (PageBackground.tsx, index.css y Booking.tsx de la web). La web no cambia con el modo claro/oscuro del sistema; esta tampoco. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
}

:root {
  --foreground: 210 25% 97%;
  --primary: 187 85% 53%; /* cian-400, el de los enlaces de la web */
  --ring: 187 85% 60%;
  --muted-foreground: 215 22% 80%;
  --ok: 152 60% 58%;
  --aviso: 40 95% 66%;
  --peligro: 0 90% 74%;
  --radius: 0.875rem;
  --cristal: rgb(30 58 95 / 0.42); /* #1e3a5f al 42 %: el cristal de las tarjetas de la web */
  --cristal-claro: rgb(255 255 255 / 0.08);
  --linea: rgb(255 255 255 / 0.2);
  --noche: 22 18 70; /* índigo noche */
  --sombra-suave: 0 8px 28px -10px rgb(0 0 0 / 0.5);
  --sombra-fuerte: 0 25px 50px -12px rgb(0 0 0 / 0.55);
  --premium-desde: #0e7490; /* cyan-700 */
  --premium-hasta: #1d4ed8; /* blue-700 */
  --brillo: 0 0 30px rgba(6, 182, 212, 0.4);
  --video-fondo: #0b1220;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}
html {
  background: rgb(var(--noche));
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: hsl(var(--foreground));
  background: transparent;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* La foto fija de la web y, encima, el velo índigo con la luz cálida de lámpara, el brillo cian y la viñeta suave. */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body::before {
  z-index: -2;
  background: url('/fondo-noche.webp') center / cover no-repeat;
}
body::after {
  z-index: -1;
  background:
    radial-gradient(ellipse 120% 95% at 50% 45%, transparent 58%, rgb(10 8 36 / 0.42) 100%),
    radial-gradient(70% 50% at 12% 0%, rgb(255 176 96 / 0.22), transparent 62%),
    radial-gradient(55% 45% at 100% 100%, rgb(34 211 238 / 0.1), transparent 70%),
    linear-gradient(180deg, rgb(var(--noche) / 0.5), rgb(var(--noche) / 0.68));
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}
h1 {
  font-size: clamp(1.6rem, 1.2rem + 2vw, 2.2rem);
  font-weight: 700;
}
h2 {
  font-size: 1.25rem;
  font-weight: 650;
}
p {
  margin: 0 0 0.75rem;
}
a {
  color: hsl(var(--primary));
  text-underline-offset: 3px;
}
.suave {
  color: hsl(var(--muted-foreground));
}
.pequeno {
  font-size: 0.875rem;
}

:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Cabecera y marco ---------- */
.cabecera {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.75rem;
  max-width: 64rem;
  margin: 0 auto;
}
.cabecera img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  display: block;
}
.cabecera .marca {
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.cabecera .marca small {
  display: block;
  font-weight: 450;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}
.cabecera .candado {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: hsl(var(--ok));
  background: hsl(var(--ok) / 0.1);
  border: 1px solid hsl(var(--ok) / 0.25);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.5rem 1rem 3rem;
}
.centrado {
  max-width: 30rem;
  margin: 1.5rem auto 0;
}

.tarjeta {
  background: var(--cristal);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--linea);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--sombra-suave);
  padding: clamp(1.25rem, 4vw, 2rem);
}
.tarjeta.destacada {
  box-shadow: var(--sombra-fuerte);
}

.perfil {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}
.perfil img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgb(var(--noche));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.35), var(--sombra-suave);
}
.perfil strong {
  display: block;
  font-size: 1.05rem;
}

/* ---------- Formularios ---------- */
label {
  display: block;
  font-weight: 550;
  font-size: 0.92rem;
  margin: 0 0 0.35rem;
}
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='password'] {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.9rem;
  font: inherit;
  color: inherit;
  background: var(--cristal-claro);
  border: 1px solid var(--linea);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:hover {
  border-color: hsl(var(--primary) / 0.4);
}
input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.25);
}
input::placeholder {
  color: rgb(255 255 255 / 0.45);
}
.campo {
  margin-bottom: 1rem;
}
.consentimiento {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem 0.9rem;
  background: var(--cristal-claro);
  border-radius: var(--radius);
  margin: 1.1rem 0 0.6rem;
}
.consentimiento input {
  width: 22px;
  height: 22px;
  margin: 0.15rem 0 0;
  flex: none;
  accent-color: hsl(var(--primary));
}
.consentimiento label {
  margin: 0;
  font-weight: 450;
  font-size: 0.92rem;
}
details.legal {
  margin: 0 0 1.1rem;
  font-size: 0.88rem;
  color: hsl(var(--muted-foreground));
}
details.legal summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: hsl(var(--primary));
}
details.legal ul {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
}
details.legal li {
  margin-bottom: 0.35rem;
}

.mensaje {
  margin: 0.9rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.93rem;
  border: 1px solid transparent;
}
.mensaje.error {
  color: hsl(var(--peligro));
  background: hsl(var(--peligro) / 0.09);
  border-color: hsl(var(--peligro) / 0.25);
}
.mensaje.aviso {
  color: hsl(var(--aviso));
  background: hsl(var(--aviso) / 0.1);
  border-color: hsl(var(--aviso) / 0.3);
}

/* ---------- Botones (button.tsx de la web) ---------- */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.65rem 1.4rem;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  color: hsl(var(--foreground));
  background: var(--cristal);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--linea);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out, background 0.25s, border-color 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.boton:hover {
  border-color: rgb(255 255 255 / 0.4);
  background: rgb(255 255 255 / 0.14);
}
.boton:active {
  transform: translateY(1px);
}
.boton.premium {
  color: #fff;
  border: 0;
  background: linear-gradient(90deg, var(--premium-desde), var(--premium-hasta));
}
.boton.premium:hover {
  background: linear-gradient(90deg, #155e75, #1e40af);
  box-shadow: var(--brillo);
  transform: translateY(-2px);
}
.boton.peligro {
  color: #fff;
  border: 0;
  background: hsl(0 72% 46%);
}
.boton.peligro:hover {
  background: hsl(0 72% 40%);
  box-shadow: 0 0 24px hsl(0 72% 46% / 0.35);
}
.boton.completo {
  width: 100%;
}
.boton[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.boton.grande {
  min-height: 56px;
  font-size: 1.05rem;
  border-radius: 1rem;
}

/* ---------- Espera ---------- */
.sep-arriba {
  margin-top: 0.9rem;
}
.sep-poco {
  margin-top: 0.4rem;
}
.pastilla {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
  border-radius: 999px;
}
.punto {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  animation: latido 1.8s ease-in-out infinite;
}
@keyframes latido {
  0%,
  100% {
    transform: scale(0.85);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

.pasos {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0;
  display: grid;
  gap: 0.6rem;
}
.pasos li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.9rem;
  background: var(--cristal-claro);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.pasos .marca-paso {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: hsl(var(--muted-foreground));
  background: var(--cristal);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--linea);
}
.pasos li.hecho .marca-paso {
  color: #fff;
  background: hsl(var(--ok));
  border-color: transparent;
}
.ensayo {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 46vh;
  width: 100%;
  background: var(--video-fondo);
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  margin: 0.4rem 0 0.6rem;
}
.ensayo video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.medidor {
  height: 8px;
  border-radius: 999px;
  background: var(--cristal-claro);
  overflow: hidden;
  margin: 0.2rem 0 0.8rem;
}
.medidor > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--premium-desde), #22d3ee);
  transition: width 0.08s linear;
}

/* ---------- Llamada ---------- */
.escena {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--video-fondo);
  color: #fff;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}
.escena .remoto {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--video-fondo);
}
.escena .propio {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: 0.75rem;
  width: clamp(92px, 24vw, 200px);
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid rgb(255 255 255 / 0.55);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.45);
  background: #111;
  transform: scaleX(-1);
}
.escena .etiqueta {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  left: 0.75rem;
  max-width: calc(100% - clamp(92px, 24vw, 200px) - 2rem);
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: rgb(10 18 32 / 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.escena .aviso-llamada {
  position: absolute;
  left: 50%;
  top: 4.5rem;
  transform: translateX(-50%);
  width: min(92vw, 28rem);
  text-align: center;
  padding: 0.6rem 0.9rem;
  font-size: 0.92rem;
  font-weight: 550;
  color: #1c1303;
  background: #fbbf24;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}
.escena .conectando {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
  font-size: 1.05rem;
  background: radial-gradient(circle at 50% 40%, #12223d, var(--video-fondo));
}
.controles {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  padding: 1rem 1rem max(1.2rem, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgb(0 0 0 / 0.55), transparent);
}
.control {
  display: grid;
  justify-items: center;
  gap: 0.3rem;
  min-width: 64px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 550;
  color: #fff;
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.control .icono {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgb(255 255 255 / 0.25);
  transition: background 0.2s, transform 0.2s;
}
.control:hover .icono {
  background: rgb(255 255 255 / 0.28);
}
.control:active .icono {
  transform: scale(0.94);
}
.control.apagado .icono {
  background: #fff;
  color: #111;
}
.control.colgar .icono {
  background: hsl(0 72% 48%);
  border-color: transparent;
}
.control.colgar:hover .icono {
  background: hsl(0 72% 42%);
}

/* ---------- Panel del médico ---------- */
.lista {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}
.espera-fila {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--linea);
  border-radius: calc(var(--radius) + 2px);
  background: var(--cristal);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--sombra-suave);
  animation: entra 0.35s ease-out;
}
@keyframes entra {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
.espera-fila .quien {
  flex: 1;
  min-width: 0;
}
.espera-fila strong {
  display: block;
  font-size: 1.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vacio {
  text-align: center;
  padding: 2.5rem 1rem;
  color: hsl(var(--muted-foreground));
}
.vacio .grande-icono {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 0.4rem;
}
.encabezado-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .espera-fila {
    flex-wrap: wrap;
  }
  .espera-fila .boton {
    width: 100%;
  }
  .cabecera .candado span.texto {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Iconos ---------- */
.svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}
.control .svg {
  width: 26px;
  height: 26px;
}
.tachon {
  display: none;
}
.control.apagado .tachon {
  display: inline;
}

/* ---------- Citas de hoy (panel del médico) ---------- */
.citas-hoy {
  margin-top: 2rem;
}
.citas-lista {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.cita-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.45rem 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--cristal);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--linea);
  border-radius: 999px;
  box-shadow: var(--sombra-suave);
}
.cita-chip small {
  font-weight: 450;
  color: hsl(var(--muted-foreground));
}
.cita-chip.en-sala {
  color: hsl(var(--ok));
  background: hsl(var(--ok) / 0.1);
  border-color: hsl(var(--ok) / 0.3);
}
.cita-chip.en-sala small {
  color: inherit;
}
.cita-chip.pasada {
  opacity: 0.55;
}

/* ---------- Página de texto legal ---------- */
.texto-legal {
  max-width: 44rem;
  margin: 0 auto;
  background: var(--cristal);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--linea);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--sombra-suave);
  padding: clamp(1.25rem, 4vw, 2.25rem);
}
.texto-legal h2 {
  margin-top: 1.6rem;
  font-size: 1.1rem;
}
.texto-legal ul {
  padding-left: 1.2rem;
  margin: 0 0 0.8rem;
}
.texto-legal li {
  margin-bottom: 0.45rem;
}
.urgencia {
  margin: 0.2rem 0 1rem;
  font-size: 0.88rem;
  color: hsl(var(--muted-foreground));
}

.botonera {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ---------- Página de reserva ---------- */
.reserva {
  max-width: 40rem;
  margin: 1.5rem auto 0;
}
.paso-titulo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.6rem 0 0.8rem;
  font-size: 1.08rem;
}
.paso-titulo small {
  font-weight: 450;
  font-size: 0.82rem;
}
.paso-titulo .num {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--premium-desde), var(--premium-hasta));
}
.dias {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding: 0.2rem 0.1rem 0.6rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.horas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
}
.opcion {
  display: grid;
  justify-items: center;
  gap: 0.1rem;
  min-height: 48px;
  min-width: 84px;
  padding: 0.55rem 0.8rem;
  font: inherit;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: hsl(var(--foreground));
  background: var(--cristal-claro);
  border: 1px solid var(--linea);
  border-radius: 0.85rem;
  cursor: pointer;
  scroll-snap-align: start;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.opcion .semana {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: capitalize;
  color: hsl(var(--muted-foreground));
}
.opcion:hover {
  border-color: rgb(255 255 255 / 0.45);
  transform: translateY(-1px);
}
.opcion[aria-selected='true'] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--premium-desde), var(--premium-hasta));
  box-shadow: var(--brillo);
}
.opcion[aria-selected='true'] .semana {
  color: rgb(255 255 255 / 0.85);
}
.elegido {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: hsl(var(--primary) / 0.12);
  border: 1px solid hsl(var(--primary) / 0.3);
  font-weight: 550;
}
.elegido::first-letter {
  text-transform: uppercase;
}
.centro {
  text-align: center;
  margin-top: 0.6rem;
}
.campo .pequeno {
  display: block;
  margin-top: 0.3rem;
}
.pastilla.ok {
  color: hsl(var(--ok));
  background: hsl(var(--ok) / 0.12);
}
.condiciones {
  margin-top: 0.4rem;
}
