/* ============================================================
   Pilar Garijo — Modal de reserva online (assets/reservas.js)
   Clases con prefijo .rsv- y variables --pgh-* del header compartido.
   ============================================================ */
.rsv-lock, .rsv-lock body { overflow: hidden; }

/* Marrón de los títulos de la web (css/home.css, --title): se usa donde el
   marrón oscuro del header se veía casi negro, como el día elegido. */
.rsv-backdrop { --rsv-marron: #5C441A; }

.rsv-backdrop {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(28, 21, 5, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s;
}
.rsv-backdrop.rsv-open { opacity: 1; visibility: visible; }

.rsv-dialog {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  width: 100%; max-width: 560px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  background: var(--pgh-bg); color: var(--pgh-ink); border-radius: 24px;
  box-shadow: 0 40px 90px -30px rgba(28, 21, 5, .55);
  font-family: var(--pgh-sans); font-size: 16px; line-height: 1.5; text-align: left;
  transform: translateY(12px) scale(.985); transition: transform .25s ease, max-width .2s ease;
}
.rsv-open .rsv-dialog { transform: none; }
.rsv-dialog[data-paso="calendario"] { max-width: 880px; }

/* ---------- Cabecera del modal ---------- */
.rsv-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px 22px; border-bottom: 1px solid var(--pgh-line); }
.rsv-top h2 { flex: 1; margin: 0; font-family: var(--pgh-serif); font-size: 19px; font-weight: 500; letter-spacing: -.01em; line-height: 1.2; }
.rsv-top h2:focus { outline: none; }
.rsv-back, .rsv-close {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--pgh-line); border-radius: 999px; background: var(--pgh-surface); color: var(--pgh-ink);
  transition: border-color .2s ease;
}
.rsv-back:hover, .rsv-close:hover { border-color: var(--pgh-primary); }
.rsv-back[hidden] { display: none; }
.rsv-back svg, .rsv-close svg { width: 18px; height: 18px; }
.rsv-mock {
  padding: 6px 12px; text-align: center; background: #FFF1C2; color: #6B4E00;
  font-family: var(--pgh-label); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
}
.rsv-body { padding: 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

/* ---------- Tipografía ---------- */
.rsv-lead { margin: 0 0 16px; font-size: 18px; }
.rsv-h { margin: 18px 0 8px; font-family: var(--pgh-serif); font-size: 24px; font-weight: 500; line-height: 1.2; letter-spacing: -.01em; }
.rsv-p { margin: 0 0 14px; color: var(--pgh-soft); }
.rsv-link {
  padding: 0; border: 0; background: none; cursor: pointer; white-space: nowrap;
  font: inherit; font-size: 14px; font-weight: 700; color: var(--pgh-primary);
  text-decoration: underline; text-underline-offset: 3px;
}
.rsv-link:hover { color: var(--pgh-accent); }
.rsv-link:disabled { opacity: .5; cursor: default; }
.rsv-link-c { display: block; margin: 14px auto 0; }

/* ---------- Paso 1: centro ---------- */
.rsv-centros { display: grid; gap: 12px; }
.rsv-centro {
  position: relative; display: grid; gap: 2px; width: 100%; padding: 16px 52px 16px 18px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--pgh-line); border-radius: 16px; background: var(--pgh-surface); color: inherit; font: inherit;
  transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.rsv-centro:hover { border-color: var(--pgh-primary); box-shadow: 0 14px 30px -20px rgba(28, 21, 5, .5); transform: translateY(-1px); }
.rsv-centro-n { font-family: var(--pgh-serif); font-size: 20px; font-weight: 500; line-height: 1.25; }
.rsv-centro-z { font-family: var(--pgh-label); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--pgh-accent); }
.rsv-centro-d { font-size: 14px; color: var(--pgh-soft); }
.rsv-centro-s { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; color: var(--pgh-soft); }
.rsv-centro-s svg { width: 14px; height: 14px; }
.rsv-centro-go { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--pgh-primary); line-height: 0; }
.rsv-centro-go svg { width: 20px; height: 20px; }

/* ---------- Paso 2: calendario ---------- */
.rsv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rsv-kicker { font-family: var(--pgh-serif); font-size: 22px; font-weight: 500; line-height: 1.2; }
.rsv-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: 4px 0 16px; font-size: 14px; color: var(--pgh-soft); }
.rsv-sub-i { display: inline-flex; align-items: center; gap: 5px; } /* icono y texto nunca se separan */
.rsv-sub svg { width: 14px; height: 14px; flex: none; }

.rsv-cal-wrap { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.rsv-cal { padding: 14px; background: var(--pgh-surface); border: 1px solid var(--pgh-line); border-radius: 18px; }
.rsv-cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rsv-cal-mes { display: inline-block; font-weight: 700; font-size: 16px; }
.rsv-cal-mes::first-letter { text-transform: uppercase; }
.rsv-nav {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--pgh-line); border-radius: 999px; background: transparent; color: var(--pgh-ink);
}
.rsv-nav:hover:not(:disabled) { border-color: var(--pgh-primary); }
.rsv-nav:disabled { opacity: .3; cursor: default; }
.rsv-nav svg { width: 16px; height: 16px; }

.rsv-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.rsv-wd { padding: 6px 0; text-align: center; font-family: var(--pgh-label); font-size: 12px; letter-spacing: .08em; color: var(--pgh-soft); }
.rsv-day {
  position: relative; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 999px;
  background: transparent; font: inherit; font-size: 15px; color: rgba(28, 21, 5, .28); cursor: default;
}
.rsv-day.is-libre {
  font-weight: 700; color: var(--pgh-primary); cursor: pointer;
  background: color-mix(in srgb, var(--pgh-accent) 16%, transparent); transition: background .15s ease;
}
.rsv-day.is-libre:hover { background: color-mix(in srgb, var(--pgh-accent) 30%, transparent); }
.rsv-day.is-sel, .rsv-day.is-sel:hover { background: var(--rsv-marron); color: var(--pgh-bg); }
.rsv-day.is-hoy::after {
  content: ""; position: absolute; left: 50%; bottom: 12%; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: currentColor;
}

.rsv-slots { min-height: 180px; }
.rsv-slots-dia { margin: 4px 0 12px; font-weight: 700; }
.rsv-slots-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px;
  max-height: 340px; overflow-y: auto; padding: 2px;
}
.rsv-slot {
  padding: 11px 8px; cursor: pointer; border: 1.5px solid var(--pgh-primary); border-radius: 12px;
  background: var(--pgh-surface); color: var(--pgh-primary); font: inherit; font-size: 15px; font-weight: 700;
  transition: background .15s ease, color .15s ease;
}
.rsv-slot:hover { background: var(--pgh-primary); color: var(--pgh-bg); }

.rsv-estado {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 18px;
  border: 1px dashed var(--pgh-line); border-radius: 16px; font-size: 15px; color: var(--pgh-soft);
}
.rsv-spin {
  display: inline-block; flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: rsv-spin .7s linear infinite;
}
@keyframes rsv-spin { to { transform: rotate(360deg); } }

/* ---------- Paso 3: acceso / registro ---------- */
.rsv-resumen {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px;
  background: var(--pgh-surface); border: 1px solid var(--pgh-line); border-radius: 14px; font-size: 14px;
}
.rsv-resumen > svg { width: 18px; height: 18px; flex: none; color: var(--pgh-accent); }
.rsv-resumen > span { flex: 1; min-width: 0; }

.rsv-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 18px 0 16px;
  background: color-mix(in srgb, var(--pgh-line) 75%, transparent); border-radius: 999px;
}
.rsv-tab {
  padding: 10px 12px; cursor: pointer; border: 0; border-radius: 999px; background: transparent;
  font: inherit; font-size: 15px; font-weight: 700; color: var(--pgh-soft);
}
.rsv-tab.is-on { background: var(--pgh-surface); color: var(--pgh-ink); box-shadow: 0 4px 14px -8px rgba(28, 21, 5, .4); }

.rsv-form { display: grid; gap: 12px; }
.rsv-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rsv-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 12px; }
.rsv-field { display: grid; gap: 5px; min-width: 0; align-content: start; } /* con error en la columna vecina no se desplaza */
.rsv-field > label { font-size: 14px; font-weight: 700; }
.rsv-field input[type="text"], .rsv-field input[type="email"], .rsv-field input[type="password"],
.rsv-field input[type="tel"], .rsv-field input[type="date"] {
  width: 100%; min-width: 0; padding: 12px 14px; border: 1.5px solid var(--pgh-line); border-radius: 12px;
  background: var(--pgh-surface); color: var(--pgh-ink); font: inherit; font-size: 16px; /* 16px: evita el zoom de iOS */
  transition: border-color .15s ease;
}
.rsv-field input:focus { outline: none; border-color: var(--pgh-primary); }
.rsv-field.has-error input { border-color: #B3261E; }
.rsv-err { font-size: 13px; color: #B3261E; }
.rsv-ayuda { font-size: 13px; color: var(--pgh-soft); }
/* botón de mostrar / ocultar contraseña, dentro del campo */
.rsv-pass { position: relative; }
.rsv-field .rsv-pass input { padding-right: 52px; }
.rsv-ver {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--pgh-soft); cursor: pointer;
}
.rsv-ver:hover { color: var(--pgh-ink); background: color-mix(in srgb, var(--pgh-line) 55%, transparent); }
.rsv-ver:focus-visible { outline: 2px solid var(--pgh-accent); outline-offset: 1px; }
.rsv-ver svg { width: 20px; height: 20px; }
.rsv-check > label { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 400; cursor: pointer; }
.rsv-check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--pgh-primary); }
.rsv-check a { color: var(--pgh-primary); }
.rsv-opc summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--pgh-primary); }
.rsv-olvide { justify-self: start; }

.rsv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 4px;
  padding: 14px 22px; cursor: pointer; border: 0; border-radius: 999px; background: var(--pgh-primary); color: #fff;
  font-family: var(--pgh-sans); font-size: 16px; font-weight: 700;
  transition: background .2s ease, transform .15s ease, border-color .2s ease;
}
.rsv-btn:hover:not(:disabled) { background: #3D2D0A; transform: translateY(-1px); }
.rsv-btn:disabled { opacity: .7; cursor: progress; }
.rsv-btn svg { width: 18px; height: 18px; flex: none; }
.rsv-btn-sec { background: transparent; color: var(--pgh-ink); border: 1.5px solid var(--pgh-line); }
.rsv-btn-sec:hover:not(:disabled) { background: transparent; border-color: var(--pgh-primary); }

.rsv-aviso { margin: 14px 0; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.rsv-aviso.is-error { background: #FCEDEC; color: #8C1D18; }
.rsv-aviso.is-info { background: color-mix(in srgb, var(--pgh-accent) 16%, var(--pgh-surface)); color: var(--pgh-ink); }
.rsv-aviso.is-ok { background: #E7F6EC; color: #1D5B33; }

/* ---------- Pasos 4 y 5: confirmar / hecho ---------- */
.rsv-card {
  display: grid; gap: 14px; margin: 16px 0; padding: 18px;
  background: var(--pgh-surface); border: 1px solid var(--pgh-line); border-radius: 18px;
}
.rsv-row { display: flex; align-items: flex-start; gap: 12px; }
.rsv-row > svg { flex: none; width: 20px; height: 20px; margin-top: 2px; color: var(--pgh-accent); }
.rsv-row > div { display: grid; min-width: 0; }
.rsv-row b { font-weight: 700; }
.rsv-row span { font-size: 14px; color: var(--pgh-soft); }
.rsv-exito { text-align: center; }
.rsv-exito .rsv-h { margin-top: 12px; }
.rsv-ok-ic {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 6px auto 0;
  border-radius: 50%; background: #E7F6EC; color: var(--pgh-wa);
}
.rsv-ok-ic svg { width: 32px; height: 32px; stroke-width: 2.5; }
.rsv-acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rsv-acciones .rsv-btn { margin-top: 0; }

/* ---------- Foco visible ---------- */
.rsv-day:focus-visible, .rsv-slot:focus-visible, .rsv-centro:focus-visible, .rsv-btn:focus-visible,
.rsv-link:focus-visible, .rsv-nav:focus-visible, .rsv-tab:focus-visible, .rsv-back:focus-visible,
.rsv-close:focus-visible, .rsv-opc summary:focus-visible {
  outline: 2px solid var(--pgh-accent); outline-offset: 2px;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .rsv-cal-wrap { grid-template-columns: 1fr; }
  .rsv-slots { min-height: 0; }
  .rsv-slots-grid { max-height: none; }
}
@media (max-width: 560px) {
  .rsv-backdrop { padding: 0; align-items: stretch; }
  .rsv-dialog, .rsv-dialog[data-paso="calendario"] { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .rsv-body { padding: 14px 16px calc(32px + env(safe-area-inset-bottom, 0px)); } /* barra de inicio del iPhone */
  .rsv-cal { padding: 10px; }
  .rsv-day { aspect-ratio: auto; width: 42px; height: 42px; justify-self: center; } /* calendario más compacto: las horas asoman antes */
  .rsv-2col, .rsv-3col, .rsv-acciones { grid-template-columns: 1fr; }
  .rsv-sub { margin-bottom: 12px; }
  .rsv-cal-nav { margin-bottom: 2px; }
  .rsv-wd { padding: 2px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .rsv-backdrop, .rsv-dialog { transition: none; }
}
