:root {
  --rojo: #e10600;
  --rojo-oscuro: #b80500;
  --azul-bloque: #3db5e6;
  --azul-hover: #e8f7fd;
  --oscuro: #111111;
  --texto: #1f2937;
  --texto-suave: #64748b;
  --fondo: #f1f5f9;
  --blanco: #ffffff;
  --borde: #e2e8f0;
  --ocupado: #cbd5e1;
  --hoy: #fff8dc;
  --sombra: 0 4px 24px rgba(17, 17, 17, 0.08);
  --radio: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--rojo); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 0.75rem 2.5rem;
}

body.embedded .wrap {
  max-width: none;
  padding: 0 0 0.5rem;
}

body.embedded .site-header {
  margin-left: 0;
  margin-right: 0;
}

html.embedded,
body.embedded {
  background: var(--blanco);
}

body.embedded .site-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
}

/* —— Header —— */
.site-header {
  background: var(--blanco);
  margin: 0 -0.75rem 1.5rem;
  padding: 1.25rem 0.75rem 1rem;
  border-bottom: 3px solid var(--rojo);
}

.site-header .inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--oscuro);
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0.35rem 0 0;
  color: var(--texto-suave);
  font-size: 0.95rem;
}

/* —— Info chips —— */
.info-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  justify-content: center;
}

.chip {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--texto);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.chip strong { color: var(--rojo); }

/* —— Calendario —— */
.seccion {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.seccion-titulo {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--oscuro);
}

.toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.toolbar button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--borde);
  background: var(--blanco);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--texto);
  transition: background 0.15s, border-color 0.15s;
}

.toolbar button:hover {
  background: var(--fondo);
  border-color: #cbd5e1;
}

.toolbar button.primary {
  background: var(--rojo);
  color: var(--blanco);
  border-color: var(--rojo);
}

.toolbar button.primary:hover {
  background: var(--rojo-oscuro);
  border-color: var(--rojo-oscuro);
}

.toolbar .rango {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--oscuro);
}

.grid {
  display: grid;
  grid-template-columns: 40px repeat(7, minmax(0, 1fr));
  width: 100%;
}

.calendario-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--borde);
  border-radius: 8px;
  background: #fafbfc;
}

/* scroll hint on narrow screens */
@media (max-width: 768px) {
  .calendario-wrap::after {
    content: "← desliza →";
    display: block;
    text-align: center;
    font-size: 0.7rem;
    color: var(--texto-suave);
    padding: 0.35rem;
    background: #f8fafc;
    border-top: 1px solid var(--borde);
  }
}

.calendario-wrap.cargando { opacity: 0.55; pointer-events: none; }

@media (min-width: 769px) {
  .grid {
    grid-template-columns: 44px repeat(7, minmax(72px, 1fr));
    min-width: 640px;
  }
}

.corner, .day-head, .hour-label, .slot {
  border-bottom: 1px solid var(--borde);
  border-right: 1px solid var(--borde);
}

.corner {
  height: 40px;
  background: #f8fafc;
}

.day-head {
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  background: #f8fafc;
  color: var(--texto-suave);
  line-height: 1.2;
  padding: 2px;
}

.day-head .dia-num {
  font-size: 0.85rem;
  color: var(--texto);
}

.day-head.hoy {
  background: var(--hoy);
  color: var(--oscuro);
}

.day-head.hoy .dia-num {
  color: var(--rojo);
}

.hour-label {
  height: 32px;
  font-size: 0.68rem;
  color: var(--texto-suave);
  text-align: right;
  padding: 6px 4px 0 0;
  background: #f8fafc;
  font-weight: 500;
}

.slot {
  height: 32px;
  transition: background 0.12s, transform 0.08s;
}

.slot.libre {
  cursor: pointer;
  background: var(--blanco);
}

.slot.libre:hover {
  background: var(--azul-hover);
}

.slot.ocupado {
  background: var(--ocupado);
  cursor: not-allowed;
}

.slot.pasado {
  background: #f1f5f9;
  cursor: not-allowed;
  opacity: 0.45;
}

.slot.seleccionado {
  background: var(--azul-bloque);
  box-shadow: inset 0 0 0 2px #2596be;
}

.leyenda {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--texto-suave);
}

.leyenda-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.leyenda-caja {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--borde);
}

.leyenda-caja.libre { background: var(--blanco); }
.leyenda-caja.ocupado { background: var(--ocupado); }
.leyenda-caja.seleccionado { background: var(--azul-bloque); border-color: #2596be; }

.instrucciones {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--texto-suave);
  line-height: 1.45;
}

/* —— Panel reserva —— */
.resumen {
  background: linear-gradient(135deg, #fff5f5 0%, #fef2f2 100%);
  border: 1px solid #fecaca;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.resumen.vacio {
  background: var(--fondo);
  border-color: var(--borde);
}

.resumen-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--rojo);
  margin-bottom: 0.25rem;
}

.resumen-texto {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--oscuro);
  margin: 0;
}

.resumen-precio {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--texto-suave);
}

.resumen-precio strong {
  color: var(--rojo);
  font-size: 1.1rem;
}

form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0.75rem 0 0.3rem;
  color: var(--texto);
}

form input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

form input:focus {
  outline: none;
  border-color: var(--rojo);
  box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.12);
}

.opcional {
  font-weight: 400;
  color: var(--texto-suave);
}

.requerido {
  color: var(--rojo);
  font-weight: 700;
}

.consentimiento {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.85rem;
  background: var(--fondo);
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.45;
  cursor: pointer;
}

.consentimiento input {
  width: auto;
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--rojo);
}

.consentimiento a {
  font-weight: 600;
}

form button[type=submit] {
  margin-top: 1.25rem;
  width: 100%;
  padding: 0.85rem;
  background: var(--rojo);
  color: var(--blanco);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

form button[type=submit]:hover:not(:disabled) {
  background: var(--rojo-oscuro);
}

form button[type=submit]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mensaje {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  display: none;
  font-size: 0.92rem;
  line-height: 1.45;
}

.mensaje.ok {
  display: block;
  background: #f0fdf4;
  border: 1px solid #22c55e;
  color: #14532d;
}

.mensaje.error {
  display: block;
  background: #fef2f2;
  border: 1px solid #ef4444;
  color: #991b1b;
}

.nota-post {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--borde);
  font-size: 0.82rem;
  color: var(--texto-suave);
  line-height: 1.5;
}

.site-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  font-size: 0.82rem;
  color: var(--texto-suave);
}

.site-footer a { font-weight: 600; }

@media (max-width: 768px) {
  .wrap {
    padding: 0;
    max-width: none;
  }

  .site-header {
    margin: 0 0 1rem;
    padding: 1rem 0.5rem;
  }

  .hero h1 { font-size: 1.2rem; }

  .info-bar {
    padding: 0 0.5rem;
    gap: 0.35rem;
  }

  .chip {
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
  }

  .seccion {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 0.65rem 0.4rem;
    box-shadow: none;
  }

  .calendario-wrap {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin: 0 -0.4rem;
  }

  .grid {
    grid-template-columns: 34px repeat(7, minmax(44px, 1fr));
    min-width: calc(100vw - 0.8rem);
  }

  .corner, .day-head { height: 44px; }
  .day-head { font-size: 0.62rem; }
  .day-head .dia-num { font-size: 0.78rem; }

  .hour-label, .slot {
    height: 40px;
    min-height: 40px;
  }

  .hour-label { font-size: 0.62rem; }

  .slot.libre:active {
    background: var(--azul-bloque);
  }

  .toolbar .rango {
    font-size: 0.78rem;
    min-width: 0;
  }

  .toolbar button {
    padding: 0.55rem 0.75rem;
    flex-shrink: 0;
  }

  .leyenda {
    gap: 0.65rem;
    padding: 0 0.25rem;
  }

  form input {
    font-size: 16px; /* evita zoom en iOS */
  }
}

@media (max-width: 600px) {
  .hero h1 { font-size: 1.15rem; }
}
