/* =====================================================================
   Barbers — estilos de la página pública (reserva y "mi turno")
   Mobile first. Un solo momento llamativo: la tarjeta de turno.
   ===================================================================== */

:root {
  color-scheme: light;
  --ink: #1b2333;        /* texto y acciones principales */
  --steel: #5b6475;      /* texto secundario */
  --line: #dadde5;       /* bordes */
  --surface: #f3f4f7;    /* fondos de apoyo */
  --paper: #ffffff;
  --pole-red: #d7263d;   /* franja de barbería (solo en la tarjeta y el foco) */
  --pole-blue: #2b4c9b;
  --ok: #1f7a4d;
  --danger: #b3261e;

  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-cond: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --pad: 16px;
  --bar-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
a { color: var(--ink); }
img { display: block; max-width: 100%; }

:focus-visible { outline: 3px solid var(--pole-red); outline-offset: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Estructura */

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + 24px);
}

.app--plain { padding-bottom: 32px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar[hidden] { display: none; }

.topbar__title {
  flex: 1; min-width: 0;
  font-weight: 600; font-size: 16px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn[hidden] { display: none; }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- Cabecera de la barbería */

.shop { padding: 20px var(--pad) 8px; }

.shop__cover {
  max-width: none; /* en el celular ocupa todo el ancho, más allá del margen */
  width: calc(100% + 2 * var(--pad));
  margin: -20px calc(-1 * var(--pad)) 16px;
  aspect-ratio: 16 / 7; object-fit: cover;
  background: var(--surface);
}

/* Logo: se muestra entero (contain) en un cuadrado; con portada, se apoya sobre su borde inferior */
.shop__logo {
  width: 76px; height: 76px; border-radius: var(--r-md);
  object-fit: contain; padding: 6px; margin-bottom: 12px;
  background: var(--paper); border: 1px solid var(--line);
}
.shop__cover + .shop__logo {
  position: relative; margin-top: -54px;
  box-shadow: 0 2px 10px rgba(27, 35, 51, 0.12);
}

.shop__name {
  margin: 0;
  font-family: var(--font-cond); font-weight: 700;
  font-size: 2.35rem; line-height: 1.02; letter-spacing: -0.005em;
}

.shop__desc { margin: 8px 0 0; color: var(--steel); max-width: 60ch; }
.shop__place { margin: 6px 0 0; color: var(--steel); }

.shop__links {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 14px 0 0; padding: 0; list-style: none;
}

.chip-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; font-size: 15px; font-weight: 500;
}
.chip-link:hover { border-color: var(--ink); }
.chip-link svg { width: 16px; height: 16px; }

/* ---------- Pasos */

.steps {
  display: flex; gap: 4px;
  margin: 16px var(--pad) 0; padding: 0; list-style: none;
  counter-reset: step;
}

.steps li {
  flex: 1;
  padding-top: 8px;
  border-top: 3px solid var(--line);
  font-size: 13px; color: var(--steel);
  counter-increment: step;
}
.steps li::before { content: counter(step) ". "; }
.steps li[aria-current='step'] { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.steps li.is-done { border-color: var(--ink); }

/* ---------- Contenido de cada paso */

.panel { padding: 20px var(--pad) 0; }

.panel__title {
  margin: 0 0 16px;
  font-family: var(--font-cond); font-weight: 600;
  font-size: 1.75rem; line-height: 1.1;
}
.panel__title:focus { outline: none; }

.subhead {
  margin: 24px 0 10px;
  font-size: 15px; font-weight: 600; color: var(--steel);
}

/* Lista de opciones (servicios y barberos): radios reales, accesibles con teclado */
.choices { margin: 0; padding: 0; border: 0; }

.choice {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 12px 14px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.choice:first-of-type { border-top: 1px solid var(--line); }
.choice:hover { background: var(--surface); }

.choice input {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 22px; height: 22px; margin: 0;
  border: 2px solid var(--steel); border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
}
.choice input::after {
  content: ''; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink); transform: scale(0); transition: transform 0.12s ease;
}
.choice input:checked { border-color: var(--ink); }
.choice input:checked::after { transform: scale(1); }
.choice:has(input:checked) { background: var(--surface); box-shadow: inset 3px 0 0 var(--ink); }

.choice__main { flex: 1; min-width: 0; }
.choice__title { display: block; font-weight: 600; }
.choice__sub { display: block; margin-top: 2px; font-size: 15px; color: var(--steel); }

.choice__aside { text-align: right; flex: none; }
.choice__price { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
.choice__dur { display: block; font-size: 15px; color: var(--steel); }

.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--font-cond); font-weight: 600; font-size: 18px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--any { background: var(--paper); border-style: dashed; }
.avatar--any svg { width: 22px; height: 22px; }

/* ---------- Tira de días */

.days {
  display: flex; gap: 8px;
  margin: 0 calc(-1 * var(--pad)); padding: 4px var(--pad) 12px;
  overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.days::-webkit-scrollbar { display: none; }

.day {
  flex: none; width: 62px; padding: 8px 0 10px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--paper); cursor: pointer; scroll-snap-align: start;
}
.day__wd { font-size: 13px; color: var(--steel); }
.day__num { font-family: var(--font-cond); font-weight: 600; font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.day__mo { font-size: 13px; color: var(--steel); }

.day:hover:not(:disabled) { border-color: var(--ink); }
.day[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.day[aria-pressed='true'] .day__wd,
.day[aria-pressed='true'] .day__mo { color: rgba(255, 255, 255, 0.75); }
.day:disabled { cursor: default; background: var(--surface); border-color: transparent; }
.day:disabled .day__num { color: #a3a9b6; text-decoration: line-through; text-decoration-thickness: 1px; }

/* ---------- Horarios */

.slots {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px;
}

.slot {
  height: 46px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); cursor: pointer;
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.slot:hover { border-color: var(--ink); }
.slot[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.status-line { margin: 8px 0 0; color: var(--steel); }

.notice {
  margin: 0 0 16px; padding: 12px 14px;
  border-left: 3px solid var(--pole-red);
  background: #fdf1f2; border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

/* ---------- Resumen y formulario */

.summary {
  margin: 0 0 20px; padding: 14px;
  background: var(--surface); border-radius: var(--r-md);
}
.summary__when { margin: 0; font-weight: 600; }
.summary__what { margin: 2px 0 0; color: var(--steel); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 15px; }
.field .hint { font-weight: 400; color: var(--steel); }

.field input, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid #b9bfcc; border-radius: var(--r-sm);
  background: var(--paper);
  font-size: 17px; /* 16px o más evita el zoom de iOS al enfocar */
}
.field textarea { min-height: 84px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.field [aria-invalid='true'] { border-color: var(--danger); }
.field__error { margin: 6px 0 0; color: var(--danger); font-size: 15px; }
.field__error:empty { display: none; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 20px; font-size: 15px; color: var(--steel); }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); }

.captcha { min-height: 65px; margin-bottom: 8px; }

.form-error {
  margin: 12px 0 0; padding: 12px 14px;
  border-left: 3px solid var(--danger); background: #fcefee;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.form-error:empty { display: none; }

.fine { font-size: 14px; color: var(--steel); }

/* ---------- Barra inferior */

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--paper); border-top: 1px solid var(--line);
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
}
.bar__inner { max-width: calc(560px - 2 * var(--pad)); margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.bar__info { flex: 1; min-width: 0; }
.bar__main { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__sub { display: block; font-size: 14px; color: var(--steel); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Botones */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px;
  border: 1px solid var(--ink); border-radius: var(--r-sm);
  background: var(--ink); color: var(--paper);
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: #2a3550; }
.btn:disabled { background: #c4c8d1; border-color: #c4c8d1; color: var(--paper); cursor: not-allowed; }
.btn--ghost { background: var(--paper); color: var(--ink); }
.btn--ghost:hover { background: var(--surface); }
.btn--danger { background: var(--paper); color: var(--danger); border-color: currentColor; }
.btn--danger:hover { background: #fcefee; }
.btn--block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

/* ---------- Estados de página completa */

.state { padding: 48px var(--pad); }
.state h1 { margin: 0 0 8px; font-family: var(--font-cond); font-size: 2rem; line-height: 1.1; }
.state p { margin: 0 0 20px; color: var(--steel); max-width: 46ch; }

.loading { padding: 48px var(--pad); color: var(--steel); }

.foot { padding: 32px var(--pad) 8px; font-size: 13px; color: var(--steel); }
.foot a { color: inherit; }

/* ---------- Animación al reservar */

.booking-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.2s ease;
}
.booking-overlay.is-open { opacity: 1; }
.booking-overlay__box { display: grid; justify-items: center; gap: 18px; padding: 24px; }
.booking-overlay__text {
  margin: 0;
  font-family: var(--font-cond); font-weight: 600; font-size: 1.5rem;
}

.loader { width: 88px; height: 88px; overflow: visible; }
.loader__track, .loader__arc, .loader__check { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.loader__track { stroke: var(--line); stroke-width: 6; }
/* Arco que gira mientras se reserva */
.loader__arc {
  stroke: var(--ink); stroke-width: 6;
  stroke-dasharray: 60 179; /* circunferencia ≈ 239 */
  transform-origin: 44px 44px;
  animation: loader-spin 0.9s linear infinite;
}
/* Al confirmar: el círculo se llena y se dibuja el tilde */
.loader__fill {
  fill: var(--ink); stroke: none;
  transform-origin: 44px 44px; transform: scale(0);
}
.loader__check {
  stroke: var(--paper); stroke-width: 7;
  stroke-dasharray: 60; stroke-dashoffset: 60;
}

.is-done .loader__arc { animation: none; opacity: 0; transition: opacity 0.15s ease; }
.is-done .loader__track { opacity: 0; transition: opacity 0.15s ease; }
.is-done .loader__fill { animation: loader-pop 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.is-done .loader__check { animation: loader-draw 0.35s ease-out 0.3s forwards; }

@keyframes loader-spin { to { transform: rotate(360deg); } }
@keyframes loader-pop { from { transform: scale(0.4); } to { transform: scale(1); } }
@keyframes loader-draw { to { stroke-dashoffset: 0; } }

/* Turno recién reservado: la tarjeta sale como un ticket impreso */
.ticket--new { animation: ticket-print 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes ticket-print {
  from { clip-path: inset(0 0 100% 0); transform: translateY(-12px); }
  to { clip-path: inset(0 0 0 0); transform: none; }
}

/* =====================================================================
   Tarjeta de turno (turno.html)
   ===================================================================== */

.ticket-head { padding: 28px var(--pad) 0; }
.ticket-head h1 { margin: 0; font-family: var(--font-cond); font-weight: 700; font-size: 2.1rem; line-height: 1.05; }
.ticket-head p { margin: 6px 0 0; color: var(--steel); }

.ticket {
  --notch: 13px;
  position: relative;
  margin: 20px var(--pad) 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

/* Franja de poste de barbería */
.ticket__pole {
  height: 16px;
  background: repeating-linear-gradient(
    -45deg,
    var(--pole-red) 0 10px,
    var(--paper) 10px 20px,
    var(--pole-blue) 20px 30px,
    var(--paper) 30px 40px
  );
  border-bottom: 1px solid var(--line);
}

.ticket__top { padding: 18px 20px 20px; }
.ticket__shop { margin: 0; font-weight: 600; }
.ticket__date { margin: 14px 0 0; color: var(--steel); }
.ticket__date::first-letter { text-transform: uppercase; }
.ticket__time {
  margin: 0;
  font-family: var(--font-cond); font-weight: 700;
  font-size: 4.4rem; line-height: 0.95; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.ticket__until { margin: 4px 0 0; color: var(--steel); }

/* Línea troquelada con muescas a los lados */
.ticket__perf { position: relative; height: 0; border-top: 2px dashed var(--line); margin: 0 18px; }
.ticket__perf::before, .ticket__perf::after {
  content: ''; position: absolute; top: calc(-1 * var(--notch) - 1px);
  width: calc(var(--notch) * 2); height: calc(var(--notch) * 2);
  border-radius: 50%; background: var(--paper); border: 1px solid var(--line);
}
.ticket__perf::before { left: calc(-18px - var(--notch) - 1px); }
.ticket__perf::after { right: calc(-18px - var(--notch) - 1px); }

.ticket__rows { margin: 0; padding: 16px 20px 20px; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }
.ticket__rows dt { color: var(--steel); }
.ticket__rows dd { margin: 0; font-weight: 600; text-align: right; }
.ticket__rows .paid-at { display: block; font-weight: 400; font-size: 14px; color: var(--steel); }

/* Sello de estado sobre la tarjeta */
.stamp {
  position: absolute; top: 58px; right: 14px;
  padding: 4px 10px;
  border: 3px solid currentColor; border-radius: var(--r-sm);
  font-family: var(--font-cond); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.04em;
  transform: rotate(-8deg);
  background: rgba(255, 255, 255, 0.85);
}
.stamp--cancelled { color: var(--danger); }
.stamp--done { color: var(--ok); }
.stamp--missed { color: var(--steel); }
.ticket.is-void .ticket__time { color: #a3a9b6; text-decoration: line-through; text-decoration-thickness: 3px; }

.actions { margin: 24px var(--pad) 0; display: grid; gap: 10px; }
.actions .btn { width: 100%; }
.actions__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions__label { margin: 6px 0 -2px; font-size: 15px; font-weight: 600; color: var(--steel); }

.help { margin: 20px var(--pad) 0; color: var(--steel); }

/* Diálogo de confirmación */
dialog {
  width: min(420px, calc(100% - 32px));
  padding: 24px; border: 0; border-radius: var(--r-md);
  color: var(--ink);
}
dialog::backdrop { background: rgba(27, 35, 51, 0.5); }
dialog h2 { margin: 0 0 8px; font-family: var(--font-cond); font-size: 1.6rem; line-height: 1.1; }
dialog p { margin: 0 0 20px; color: var(--steel); }
.dialog__actions { display: grid; gap: 10px; }

/* ---------- Pantallas más anchas */

@media (min-width: 600px) {
  .app { padding-top: 12px; }
  .shop__cover { width: 100%; margin: 0 0 16px; border-radius: var(--r-md); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .is-done .loader__fill { transform: scale(1); }
  .is-done .loader__check { stroke-dashoffset: 0; }
}

/* ---------- Pie con la marca Barbers */
.foot__brand { display: inline-flex; align-items: center; gap: 8px; color: var(--steel); }
.foot__logo { display: inline-block; line-height: 0; color: var(--steel); }
.foot__logo svg { height: 16px; width: auto; display: block; }
@media (min-width: 600px) {
  .shop__cover + .shop__logo { margin-left: 16px; }
}
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.foot__links { display: inline-flex; gap: 14px; }

/* ---------- Reseñas (dejar una y verlas en la página de la barbería) */
.rv-head { padding: 28px var(--pad) 0; text-align: center; }
.rv-head__logo { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.rv-head__shop { margin: 0; font-weight: 600; }
.rv-head__meta { margin: 2px 0 0; font-size: 15px; color: var(--steel); }
.rv { padding: 8px var(--pad) 0; }
.rv__title { margin: 18px 0 6px; text-align: center; font-family: var(--font-cond); font-weight: 700; font-size: 2rem; line-height: 1.1; }
.rv-pick { display: flex; justify-content: center; gap: 4px; margin: 10px 0 0; padding: 0; border: 0; }
.rv-pick__star { cursor: pointer; font-size: 46px; line-height: 1; color: #d5d8e0; padding: 4px; border-radius: var(--r-sm); transition: color .12s, transform .12s; }
.rv-pick__star.is-on { color: #f2a900; }
.rv-pick__star:hover { transform: scale(1.08); }
.rv-pick input:focus-visible + .rv-pick__star { outline: 3px solid var(--pole-red); outline-offset: 1px; }
.rv-pick__label { margin: 4px 0 18px; text-align: center; font-weight: 600; min-height: 1.5em; }
.rv-count { margin: 4px 0 0; text-align: right; font-size: 13px; color: var(--steel); }
.rv-stars { color: #f2a900; letter-spacing: 1px; white-space: nowrap; }
.rv-stars__off { color: #d5d8e0; }
.rv-card { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); text-align: left; }
.rv-card .rv-stars { font-size: 22px; }
.rv-card__text { margin: 8px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.rv-card__reply { margin-top: 12px; padding: 10px 12px; background: var(--surface); border-radius: var(--r-sm); font-size: 15px; }
.rv-card__reply p { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

/* En la página de la barbería */
.shop__rating { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 15px; color: var(--steel); text-decoration: none; }
.shop__rating strong { color: var(--ink); }
.shop__rating .rv-stars { font-size: 16px; }
.reviews { margin: 28px var(--pad) 0; scroll-margin-top: 16px; }
.reviews__title { margin: 0 0 4px; font-size: 1.15rem; }
.reviews__sum { margin: 0 0 8px; color: var(--steel); font-size: 15px; }
.reviews__list { margin: 0; padding: 0; list-style: none; }
.reviews__item { padding: 14px 0; border-top: 1px solid var(--line); }
.reviews__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.reviews__who { font-weight: 600; }
.reviews__when { font-size: 13px; color: var(--steel); }
.reviews__text { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.reviews__reply { margin: 8px 0 0; padding: 8px 12px; background: var(--surface); border-radius: var(--r-sm); font-size: 15px; }
.reviews__reply p { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.reviews__more { margin-top: 6px; }
.choice__rating { color: var(--steel); font-weight: 500; font-size: 14px; white-space: nowrap; }
.choice__rating span { color: #f2a900; }
.link-btn { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-decoration: underline; cursor: pointer; }
.rv__title:focus, .rv__title:focus-visible { outline: none; }
