/* --- Formulario de encargos (envía por WhatsApp) · dentro de la franja burdeos --- */

.pedido {
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  padding: clamp(1.5rem, 4vw, 3.25rem);
  border: 1px solid rgb(239 237 232 / 0.3);
  border-radius: clamp(1.25rem, 2.4vw, 2rem);
  background: rgb(239 237 232 / 0.05);
}

.pedido__titulo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 1.2rem + 2vw, 3rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variation-settings: "opsz" 144, "SOFT" 30, "WONK" 0;
}

.pedido__intro {
  max-width: 38rem;
  margin: 0.9rem 0 0;
  font-weight: 300;
  line-height: 1.6;
  opacity: 0.88;
}

.pedido__rejilla {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem clamp(1.25rem, 3vw, 2.5rem);
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.campo {
  display: grid;
  gap: 0.45rem;
  align-content: start;
  min-width: 0;
}

.campo--ancho {
  grid-column: 1 / -1;
}

.campo label {
  font-family: var(--font-condensada);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rosa-viejo);
}

.campo__opcional {
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0.8;
}

.campo input,
.campo select,
.campo textarea {
  width: 100%;
  padding: 0.7rem 0;
  border: 0;
  border-bottom: 1px solid rgb(239 237 232 / 0.5);
  border-radius: 0;
  background: transparent;
  color: var(--papel);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 300;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  transition: border-color var(--dur-fast);
}

.campo textarea {
  resize: vertical;
  min-height: 5rem;
  line-height: 1.5;
}

.campo ::placeholder {
  color: rgb(239 237 232 / 0.45);
}

.campo input:hover,
.campo select:hover,
.campo textarea:hover {
  border-bottom-color: var(--papel);
}

.campo input:focus-visible,
.campo select:focus-visible,
.campo textarea:focus-visible {
  outline: 0;
  border-bottom: 2px solid var(--rosa-viejo);
  padding-bottom: calc(0.7rem - 1px);
}

.campo [aria-invalid="true"] {
  border-bottom-color: #ffb3a7;
}

.campo__error {
  min-height: 0;
  margin: 0;
  font-size: 0.86rem;
  color: #ffb3a7;
}

.campo__error:empty {
  display: none;
}

.pedido__acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
}

.pedido button.boton {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.pedido__estado {
  min-height: 1.4em;
  margin: 1rem 0 0;
  font-weight: 400;
}

.pedido__estado[data-tipo="error"] {
  color: #ffb3a7;
}

.pedido__estado[data-tipo="ok"] {
  color: var(--rosa-viejo);
}

@media (max-width: 680px) {
  .pedido__rejilla {
    grid-template-columns: 1fr;
  }

  .pedido__acciones .boton {
    width: 100%;
    justify-content: space-between;
  }
}

/* --- Desplegable propio (selector.js) --- */

.campo {
  position: relative;
}

.combo {
  position: relative;
}

.combo__boton {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0.7rem 0;
  border: 0;
  border-bottom: 1px solid rgb(239 237 232 / 0.5);
  background: transparent;
  color: var(--papel);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 300;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast);
}

.combo.is-vacio .combo__valor {
  color: rgb(239 237 232 / 0.45);
}

.combo__boton:hover {
  border-bottom-color: var(--papel);
}

.combo__boton:focus-visible,
.combo.is-abierto .combo__boton {
  outline: 0;
  border-bottom: 2px solid var(--rosa-viejo);
  padding-bottom: calc(0.7rem - 1px);
}

.combo__boton[aria-invalid="true"] {
  border-bottom-color: #ffb3a7;
}

.combo__flecha {
  flex: none;
  width: 0.8rem;
  transition: transform var(--dur) var(--ease-out);
}

.combo.is-abierto .combo__flecha {
  transform: rotate(180deg);
}

.combo__lista {
  position: absolute;
  z-index: 20;
  inset: calc(100% + 0.5rem) 0 auto 0;
  max-height: 16rem;
  margin: 0;
  padding: 0.4rem;
  overflow-y: auto;
  list-style: none;
  border: 1px solid rgb(239 237 232 / 0.28);
  border-radius: 1rem;
  background: #3d1416;
  box-shadow: 0 22px 44px -12px rgb(0 0 0 / 0.6), 0 2px 6px rgb(0 0 0 / 0.3);
  animation: combo-entra 0.22s var(--ease-out);
}

.combo__lista:focus {
  outline: 0;
}

@keyframes combo-entra {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
}

.combo__opcion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.65rem;
  color: var(--papel);
  font-size: 1rem;
  font-weight: 300;
  cursor: pointer;
}

.combo__opcion.is-activa {
  background: rgb(239 237 232 / 0.12);
}

.combo__opcion[aria-selected="true"] {
  font-weight: 500;
  color: #fff;
}

.combo__opcion[aria-selected="true"]::after {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.9rem;
  margin-right: 0.15rem;
  border: solid var(--rosa-viejo);
  border-width: 0 2px 2px 0;
  transform: translateY(-2px) rotate(45deg);
}

@media (prefers-reduced-motion: reduce) {
  .combo__lista { animation: none; }
  .combo__flecha { transition: none; }
}

/* --- Aviso de privacidad bajo el formulario --- */
.pedido__privacidad {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  font-weight: 300;
  opacity: 0.75;
}

.pedido__privacidad a { color: inherit; text-underline-offset: 3px; }

/* --- Panel de reserva: el formulario en una ventana sobre la carta --- */
.reserva {
  width: min(44rem, calc(100vw - 1.5rem));
  max-height: calc(100svh - 1.5rem);
  margin: auto;
  padding: clamp(1.1rem, 3vw, 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgb(239 237 232 / 0.3);
  border-radius: clamp(1.1rem, 2.4vw, 1.75rem);
  background: var(--burdeos);
  color: var(--papel);
  box-shadow: 0 40px 90px -20px rgb(0 0 0 / 0.65);
}

.reserva[open] { animation: reserva-entra 0.35s var(--ease-out); }

.reserva::backdrop {
  background: rgb(28 21 19 / 0.62);
  backdrop-filter: blur(3px);
}

@keyframes reserva-entra {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
}

.reserva__cerrar {
  position: sticky;
  top: 0;
  float: right;
  z-index: 3;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 0 0 0.5rem;
  border: 1px solid rgb(239 237 232 / 0.4);
  border-radius: 50%;
  background: var(--burdeos);
  color: var(--papel);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.reserva__cerrar:hover,
.reserva__cerrar:focus-visible { background: var(--papel); color: var(--burdeos); outline: 0; }

.reserva__producto {
  margin: 0;
  font-family: var(--font-condensada);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rosa-viejo);
}

.reserva__producto:empty { display: none; }

.reserva .pedido {
  margin-top: 0.4rem;
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 1;
  transform: none;
}

@media (max-width: 40rem) {
  .reserva { width: 100vw; max-width: none; max-height: 100svh; margin: 0; border-radius: 0; border: 0; }
  .reserva .pedido__rejilla { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .reserva[open] { animation: none; }
}

/* --- Panel de reserva · orden y aire (móvil incluido) --- */
.reserva {
  max-height: calc(100dvh - 1.5rem);
  padding: 0 clamp(1.25rem, 4vw, 2.25rem) calc(1.75rem + env(safe-area-inset-bottom));
}

/* Barra superior fija: el producto a la izquierda y la × a la derecha, sin tapar nunca un campo */
.reserva__barra {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  margin: 0 calc(-1 * clamp(1.25rem, 4vw, 2.25rem));
  padding: 0.9rem clamp(1.25rem, 4vw, 2.25rem);
  background: var(--burdeos);
  border-bottom: 1px solid rgb(239 237 232 / 0.16);
}

.reserva__producto { flex: 1; min-width: 0; line-height: 1.35; }
.reserva__cerrar { position: static; float: none; flex: none; margin: 0 0 0 auto; }

.reserva .pedido { margin-top: 1.5rem; }
.reserva .pedido__titulo { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); }
.reserva .pedido__intro { margin-top: 0.7rem; font-size: 1rem; line-height: 1.55; }
.reserva .pedido__rejilla { gap: 1.6rem clamp(1.25rem, 3vw, 2.5rem); margin-top: 1.75rem; }

/* Todos los campos con la misma altura y la misma línea, también los de fecha y hora de iOS */
.reserva .campo input,
.reserva .campo textarea,
.reserva .combo__boton {
  min-height: 3rem;
  line-height: 1.4;
}

.reserva .campo input[type="date"],
.reserva .campo input[type="time"] {
  display: block;
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
}

.reserva .campo input[type="date"]::-webkit-date-and-time-value,
.reserva .campo input[type="time"]::-webkit-date-and-time-value {
  min-height: 1.4em;
  text-align: left;
}

.reserva .pedido__acciones { display: grid; gap: 0.9rem; margin-top: 2rem; }
.reserva .pedido__acciones .boton { width: 100%; justify-content: space-between; }
.reserva .pedido__estado { margin-top: 1rem; }
.reserva .pedido__privacidad { margin-top: 1.5rem; }

@media (max-width: 40rem) {
  /* Ventana con marco propio y esquinas redondeadas, no pegada a los bordes del móvil */
  .reserva {
    width: calc(100vw - 1.25rem);
    max-width: none;
    max-height: calc(100dvh - 1.25rem);
    margin: auto;
    border: 1px solid rgb(239 237 232 / 0.3);
    border-radius: 1.4rem;
  }

  .reserva .pedido__rejilla { grid-template-columns: 1fr; gap: 1.5rem; }
  .reserva .campo--ancho { grid-column: auto; }
}
