/* =====================================================================
 *  CALCULADORA DE IVA · RECEPCIÓN · HOTEL DORADO PLAZA BOCAGRANDE
 *  estilos.css — diseño de la página: el mismo sistema del Listado de
 *  reservas, del Manual de turnos y del Web Check-in (marfil, oro y
 *  bronce) + modo noche en NEGRO de verdad (pedido de JX).
 *
 *  Primero el celular (desde 320 px) y luego tableta, computador y TV.
 *  Los colores salen SIEMPRE de las variables de la sección 1: no meter
 *  colores sueltos en el resto del archivo (así el modo noche funciona solo).
 *
 *  Índice: 1 variables, temas y letra · 2 base · 3 encabezado ·
 *  4 secciones y tarjetas · 5 campo del valor · 6 botones ·
 *  7 opciones (caso y huésped) · 8 resultado · 9 historial · 10 guía ·
 *  11 pie y crédito · 12 diálogo y aviso · 13 pantalla de carga de noche ·
 *  14 pantallas más grandes y más chicas · 15 accesibilidad y movimiento
 * ===================================================================== */

/* ---------- 1. Variables, temas y letra ----------
   Tema claro = el de las otras webs. Tema oscuro = «modo noche» en negro
   puro con dorado (lo pone js/tema.js antes de pintar). */
:root {
  --fondo: #FBF8F1;
  --fondo-2: #F6EFE1;
  --fondo-borde: #F1E9D8;
  --superficie: #FFFDF8;          /* tarjetas */
  --superficie-2: #FBF6EA;        /* recuadros dentro de tarjetas */
  --campo: #FFFFFF;               /* fondo de los campos */
  --linea: #EFE4CD;
  --linea-2: #DCC9A3;
  --oro: #D9B266;
  --oro-claro: #EFCB80;
  --oro-palido: #F8EDD3;
  --bronce: #A87B3F;              /* el monto del resultado */
  --texto: #6B5228;               /* textos generales (contraste AA) */
  --texto-fuerte: #3E2E14;        /* títulos y texto de botones dorados */
  --texto-suave: #7F6435;         /* ayudas y etiquetas pequeñas (≥ 4.5:1 sobre los fondos claros) */
  --tinta: #2E2414;               /* lo que escribe la persona */
  --error: #B03A2E;
  --error-fondo: #FCEEEA;
  --s-verde: #2F9E5B;             /* puntos de la guía */
  --s-gris: #B4A281;
  --radio: 18px;
  --radio-campo: 14px;
  --sombra: 0 1px 2px rgba(107, 82, 40, .05), 0 10px 28px rgba(107, 82, 40, .07);
  --sombra-boton: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 6px 16px rgba(168, 123, 63, .26);
  --boton-oro: linear-gradient(180deg, #F4D690 0%, #EFCB80 42%, #D9B266 100%);
  --boton-oro-borde: #C99C57;
  --texto-en-oro: #3E2E14;        /* letra sobre los botones dorados (en los dos temas) */
  --aviso-fondo: rgba(46, 36, 20, .95);
  --aviso-texto: #FBF8F1;
  --velo-dialogo: rgba(30, 22, 10, .45);
  --karla: "Karla Dorado", "Karla", system-ui, sans-serif;
  --sistema: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --grano: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .4 0 0 0 0 .25 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* MODO NOCHE = NEGRO DE VERDAD (pedido de JX: «no como el que venimos
   trabajando, sino de verdad color negro»). Fondo #000 puro, tarjetas
   apenas despegadas del fondo, grises neutros (no café) y el dorado de la marca. */
html[data-tema="oscuro"] {
  --fondo: #000000;
  --fondo-2: #000000;
  --fondo-borde: #000000;
  --superficie: #0D0D0D;
  --superficie-2: #141414;
  --campo: #050505;
  --linea: #232323;
  --linea-2: #3A3A3A;
  --oro: #D9B266;
  --oro-claro: #EFCB80;
  --oro-palido: rgba(217, 178, 102, .13);
  --bronce: #E2BE72;
  --texto: #D4D4D4;
  --texto-fuerte: #FFFFFF;
  --texto-suave: #A3A3A3;
  --tinta: #FFFFFF;
  --error: #FF8A7A;
  --error-fondo: rgba(255, 138, 122, .12);
  --s-verde: #46C27A;
  --s-gris: #6B6B6B;
  --sombra: none;
  --sombra-boton: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 18px rgba(217, 178, 102, .18);
  --aviso-fondo: rgba(242, 242, 242, .97);
  --aviso-texto: #000000;
  --velo-dialogo: rgba(0, 0, 0, .75);
  --grano: none;
  color-scheme: dark;
}

/* Karla: títulos de sección (la letra pequeña del logo) */
@font-face {
  font-family: "Karla Dorado";
  src: url("fuentes/karla-regular-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sistema);
  font-size: 16px;
  line-height: 1.5;
  color: var(--texto);
  background-color: var(--fondo);
  background-image:
    var(--grano),
    radial-gradient(140vmax 120vmax at 50% 0%, var(--fondo) 0%, var(--fondo-2) 45%, var(--fondo-borde) 100%);
  background-size: 180px 180px, 100% 100%;
  background-attachment: scroll, fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 18px;
  transition: background-color .3s, color .3s;
}
html[data-tema="oscuro"] body { background-image: none; }     /* negro liso, sin degradado ni grano */
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { color: var(--texto-fuerte); margin: 0; line-height: 1.25; }
p { margin: 0; }
strong { color: var(--texto-fuerte); }

.saltar {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--texto-fuerte); color: var(--fondo); padding: 10px 14px; border-radius: 10px; text-decoration: none;
}
.saltar:focus { top: 12px; }
.solo-lector {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. Encabezado ---------- */
.encabezado {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px 6px;
}
.encabezado__logo { width: clamp(200px, 60vw, 270px); height: auto; }
.encabezado__titulo { margin-top: 16px; font-size: clamp(23px, 6.4vw, 30px); letter-spacing: -.01em; }
.encabezado__sub { margin-top: 6px; font-size: 14.5px; color: var(--texto-suave); max-width: 30em; text-wrap: balance; }
.ajustes-rapidos { display: flex; justify-content: center; margin-top: 14px; }
.boton-mini {
  display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px;
  font-size: 14px; font-weight: 650; color: var(--texto-fuerte);
  background: var(--superficie); border: 1px solid var(--linea-2); border-radius: 999px; cursor: pointer;
}
.boton-mini svg { width: 18px; height: 18px; flex: none; }

/* ---------- 4. Secciones y tarjetas ---------- */
main { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px; }
.seccion { padding-top: 24px; }
.seccion__titulo {
  display: flex; align-items: center; gap: 12px; margin: 0 0 14px;
  font-family: var(--karla); font-weight: 400; font-size: 13.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--texto-suave);
}
.seccion__titulo::before, .seccion__titulo::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(201, 161, 90, 0), rgba(201, 161, 90, .75));
}
.seccion__titulo::after { background: linear-gradient(90deg, rgba(212, 174, 102, .75), rgba(212, 174, 102, 0)); }
.tarjeta {
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio);
  box-shadow: var(--sombra); padding: 16px;
}
.nota { font-size: 14px; color: var(--texto-suave); }

/* ---------- 5. Campo del valor (grande, con $ y los puntos automáticos) ---------- */
.campo { display: block; margin: 0 0 16px; min-width: 0; }
.campo__etiqueta { display: block; margin: 0 0 8px; font-size: 14px; font-weight: 650; color: var(--texto); }
.valor__caja { position: relative; display: flex; align-items: center; }
.valor__signo {
  position: absolute; left: 16px; top: 50%; transform: translateY(-52%);
  font-size: 26px; font-weight: 700; color: var(--texto-suave); pointer-events: none;
}
#valor {
  display: block; width: 100%; min-width: 0; height: 66px; padding: 0 54px 0 42px;
  font-size: 30px; font-weight: 750; letter-spacing: .01em; font-variant-numeric: tabular-nums;
  color: var(--tinta); background: var(--campo);
  border: 1.5px solid var(--linea-2); border-radius: var(--radio-campo);
  outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s, background-color .3s;
}
#valor::placeholder { color: var(--texto-suave); opacity: .45; }
#valor:focus { border-color: var(--oro); box-shadow: 0 0 0 4px rgba(217, 178, 102, .28); }
.valor__borrar {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 0; border-radius: 12px; background: transparent; color: var(--texto-suave);
}
.valor__borrar svg { width: 22px; height: 22px; }
.valor__ayuda { margin-top: 8px; }
.valor__aviso { margin-top: 8px; font-size: 14px; font-weight: 650; color: var(--error); }

/* ---------- 6. Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 16px; border-radius: 14px;
  font-size: 15.5px; font-weight: 700; text-decoration: none; text-align: center; line-height: 1.2;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .1s, box-shadow .15s, background-color .15s, opacity .15s;
}
.boton svg { width: 20px; height: 20px; flex: none; }
.boton:active:not(:disabled) { transform: translateY(1px); }
.boton:disabled { opacity: .45; cursor: not-allowed; }
.boton--primario { color: var(--texto-en-oro); background: var(--boton-oro); border-color: var(--boton-oro-borde); box-shadow: var(--sombra-boton); }
.boton--secundario { color: var(--texto-fuerte); background: var(--superficie); border-color: var(--linea-2); }
.boton--chico { min-height: 40px; padding: 0 12px; font-size: 14px; border-radius: 12px; }
.enlace {
  display: inline; padding: 4px 2px; border: 0; background: none;
  font-size: 14px; font-weight: 700; color: var(--texto-fuerte);
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--oro); cursor: pointer;
}
.enlace--peligro { color: var(--error); text-decoration-color: var(--error); }
.boton:focus-visible, .boton-mini:focus-visible, .enlace:focus-visible, .valor__borrar:focus-visible {
  outline: 3px solid rgba(201, 156, 87, .7); outline-offset: 2px;
}

/* ---------- 7. Opciones: los 2 botones del caso y los 2 del huésped ----------
   Son radios de verdad (se usan con teclado y lector de pantalla); el
   escogido se pinta en dorado. */
.opciones { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.opciones__titulo { padding: 0; margin: 0 0 8px; font-size: 14px; font-weight: 650; color: var(--texto); }
.opciones__botones { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.opcion {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 66px; padding: 10px 10px; text-align: center; cursor: pointer;
  background: var(--superficie); border: 1.5px solid var(--linea-2); border-radius: 14px;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.opcion__nombre { font-size: 16.5px; font-weight: 750; line-height: 1.2; color: var(--texto-fuerte); }
.opcion__nota { font-size: 12.5px; line-height: 1.25; color: var(--texto-suave); }
input:checked + .opcion { background: var(--boton-oro); border-color: var(--boton-oro-borde); box-shadow: var(--sombra-boton); }
input:checked + .opcion .opcion__nombre, input:checked + .opcion .opcion__nota { color: var(--texto-en-oro); }
input:focus-visible + .opcion { outline: 3px solid rgba(201, 156, 87, .7); outline-offset: 2px; }
.opcion:active { transform: translateY(1px); }

/* ---------- 8. Resultado ---------- */
.resultado {
  padding: 18px 16px 16px; text-align: center;
  background: var(--superficie-2); border: 1.5px solid var(--linea-2); border-radius: 16px;
}
.resultado__etiqueta { font-size: 13.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--texto-suave); }
.resultado__monto {
  margin: 4px 0 4px; font-size: clamp(40px, 12.5vw, 60px); font-weight: 800; line-height: 1.08;
  color: var(--bronce); font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow-wrap: anywhere;
}
.resultado__signo { font-size: .55em; margin-right: .12em; vertical-align: .34em; }
.resultado__detalle { font-size: 15px; color: var(--texto); text-wrap: balance; }
.resultado__exacto { margin-top: 6px; font-size: 13.5px; color: var(--texto-suave); text-wrap: balance; }
.resultado__botones { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px; margin-top: 14px; }
.resultado[data-estado="vacio"] .resultado__monto { color: var(--texto-suave); opacity: .5; }
.resultado[data-estado="cero"] .resultado__monto { color: var(--texto-fuerte); }
.resultado--brilla { animation: brillo .5s ease-out; }
@keyframes brillo { from { box-shadow: 0 0 0 4px rgba(217, 178, 102, .45); } to { box-shadow: 0 0 0 0 rgba(217, 178, 102, 0); } }

/* ---------- 9. Historial ---------- */
.historial { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.historial:empty { display: none; }
.historial li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 12px 11px 14px; background: var(--superficie); border: 1px solid var(--linea); border-radius: 14px;
}
.historial__info { display: grid; gap: 1px; min-width: 0; }
.historial__cobro { font-size: 18px; font-weight: 800; color: var(--texto-fuerte); font-variant-numeric: tabular-nums; }
.historial__meta { font-size: 13.5px; color: var(--texto-suave); overflow-wrap: anywhere; }
.historial__nota { margin-top: 10px; }

/* ---------- 10. Guía: a quién se le cobra ---------- */
.guia { list-style: none; margin: 0; display: grid; gap: 10px; }
.guia__item { position: relative; padding-left: 24px; font-size: 15px; }
.guia__item::before {
  content: ""; position: absolute; left: 3px; top: .5em; width: 10px; height: 10px; border-radius: 50%;
  background: var(--s-verde);
}
.guia__item--no::before { background: transparent; border: 2px solid var(--s-gris); }
.guia__item--ojo::before { background: var(--oro); }

/* ---------- 11. Pie y crédito de JX Company ---------- */
.pie { max-width: 640px; margin: 34px auto 0; padding: 18px 16px 10px; text-align: center; border-top: 1px solid var(--linea); }
.pie__nota { font-size: 13px; color: var(--texto-suave); max-width: 34em; margin: 0 auto 6px; text-wrap: balance; }
/* Crédito con el formato EXACTO de JX (no cambiar clases ni tipografía) */
.footer-dev {
  width: 100%;
  text-align: center;
  font-weight: 800;
  letter-spacing: .18em;
  font-size: .62rem;
  margin-top: 14px;
}
.footer-dev-jx,
.footer-dev-co {
  background: linear-gradient(180deg, #E8C86A, #C9A84C);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.footer-dev-txt { color: #111; }                       /* pie claro → negro */
html[data-tema="oscuro"] .footer-dev-txt {             /* pie oscuro → plateado */
  background: linear-gradient(180deg, #F0F0F0, #A8A8A8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- 12. Diálogo y aviso flotante ---------- */
.dialogo {
  width: min(460px, calc(100vw - 24px)); padding: 0;
  border: 1px solid var(--linea); border-radius: 20px; background: var(--superficie); color: var(--texto);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.dialogo::backdrop { background: var(--velo-dialogo); }
.dialogo__caja { padding: 20px 18px 16px; }
.dialogo__texto { font-size: 16px; color: var(--texto-fuerte); margin-bottom: 16px; }
.dialogo__botones { display: flex; flex-wrap: wrap; gap: 8px; }
.dialogo__botones .boton { flex: 1 1 140px; }
.aviso {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px);
  padding: 12px 16px; border-radius: 14px; font-size: 14.5px; font-weight: 650; text-align: center;
  color: var(--aviso-texto); background: var(--aviso-fondo); box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  transition: opacity .25s, transform .25s;
}
.aviso--fuera { opacity: 0; transform: translate(-50%, 8px); }

/* ---------- 13. Pantalla de carga en modo noche ----------
   El cargador trae su velo marfil; de noche va en negro, como la página. */
html[data-tema="oscuro"] .dpl { --dpl-texto: #E6E6E6; --dpl-texto-suave: #A3A3A3; }
html[data-tema="oscuro"] .dpl--vidrio .dpl-vidrio {
  background: radial-gradient(120vmax 100vmax at 50% 46%, rgba(10, 10, 10, .97) 0%, rgba(4, 4, 4, .98) 50%, rgba(0, 0, 0, .99) 100%);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  html[data-tema="oscuro"] .dpl--vidrio .dpl-vidrio {
    background: radial-gradient(120vmax 100vmax at 50% 46%, rgba(10, 10, 10, .72) 0%, rgba(4, 4, 4, .8) 50%, rgba(0, 0, 0, .88) 100%);
  }
}

/* ---------- 14. Pantallas más grandes y más chicas ---------- */
@media (min-width: 520px) {
  .tarjeta { padding: 20px; }
  .resultado { padding: 22px 20px 18px; }
}
@media (min-width: 1000px) {
  .encabezado__logo { width: 290px; }
}
@media (min-width: 1440px) {
  html { font-size: 17px; }
  main, .pie { max-width: 680px; }
}
@media (max-width: 380px) {
  main { padding: 0 12px; }
  .tarjeta { padding: 14px; }
  .opcion { min-height: 62px; padding: 8px 6px; }
  .opcion__nombre { font-size: 15px; }
  .opcion__nota { font-size: 12px; }
  #valor { font-size: 26px; height: 62px; padding-left: 38px; }
  .valor__signo { font-size: 23px; left: 14px; }
  .resultado__botones { grid-template-columns: 1fr; }
}

/* ---------- 15. Accesibilidad y movimiento ---------- */
@media (hover: hover) {
  .boton--secundario:hover, .boton-mini:hover, .opcion:hover { border-color: var(--oro); }
  .valor__borrar:hover { color: var(--texto-fuerte); background: var(--oro-palido); }
  .boton--primario:hover:not(:disabled) { box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 8px 20px rgba(168, 123, 63, .32); }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  input:checked + .opcion { outline: 3px solid Highlight; }
}
