/* Estilos principales — Estética Reservas */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: #F5F5F7;
  color: #1D1D1F;
  min-height: 100dvh;
}

/* ——— Navegación ——— */
.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fff;
  border-bottom: 1px solid #E5E5EA;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
}

.nav__marca {
  display: flex;
  align-items: center;
  gap: 6px;
  /* Permite que la marca ceda espacio a los botones */
  min-width: 0;
  flex-shrink: 1;
}

.nav__nombre {
  font-size: 14px;
  font-weight: 600;
  color: #1D1D1F;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav__badge {
  font-size: 11px;
  font-weight: 500;
  color: #2563D9;
  background: #EFF4FF;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav__acciones {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-nav {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid #E5E5EA;
  background: transparent;
  color: #6E6E73;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.btn-nav:hover,
.btn-nav--activo {
  border-color: #2563D9;
  color: #2563D9;
}

/* ——— Toast ——— */
.toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  width: max-content;
}

.toast__inner {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  white-space: normal;
  word-break: break-word;
  text-align: center;
}

.toast__inner--ok {
  background: #F0FDF4;
  color: #15803D;
  border: 1px solid #BBF7D0;
}

.toast__inner--error {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}

.toast--oculto {
  display: none;
}

/* ——— Layout principal ——— */
.contenedor {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vista {
  display: none;
}

.vista--activa {
  display: block;
}

/* ——— Tarjeta ——— */
.tarjeta {
  background: #fff;
  border: 1px solid #E5E5EA;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tarjeta__titulo {
  font-size: 13px;
  font-weight: 500;
  color: #1D1D1F;
}

/* ——— Título de sección ——— */
.titulo-seccion {
  font-size: 18px;
  font-weight: 600;
  color: #1D1D1F;
}

/* ——— Grid de servicios ——— */
.servicios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.btn-servicio {
  border-radius: 14px;
  border: 1px solid #E5E5EA;
  background: transparent;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  touch-action: manipulation;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.btn-servicio:hover {
  border-color: #2563D9;
}

.btn-servicio--seleccionado {
  border-color: #2563D9;
  background: #EFF4FF;
}

.btn-servicio__nombre {
  font-size: 13px;
  font-weight: 500;
  color: #1D1D1F;
  word-break: break-word;
  overflow-wrap: break-word;
}

.btn-servicio__duracion {
  font-size: 11px;
  color: #6E6E73;
  margin-top: 2px;
}

.btn-servicio__precio {
  font-size: 11px;
  color: #2563D9;
  margin-top: 2px;
}

/* ——— Error inline ——— */
.aviso-error {
  font-size: 12px;
  color: #DC2626;
}

.aviso-error--oculto {
  display: none;
}

/* ——— Botón primario ——— */
.btn-primario {
  width: 100%;
  background: #2563D9;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-primario:hover {
  background: #1D4FB8;
}

.btn-primario:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ——— Botón secundario ——— */
.btn-secundario {
  width: 100%;
  background: transparent;
  color: #6E6E73;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 999px;
  border: 1px solid #E5E5EA;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-secundario:hover {
  border-color: #2563D9;
  color: #2563D9;
}

/* ——— Pasos ocultos ——— */
.paso--oculto {
  display: none;
}

/* ——— Campos de texto ——— */
.campo {
  width: 100%;
  border: 1px solid #E5E5EA;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 16px;
  color: #1D1D1F;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

.campo:focus {
  outline: none;
  border-color: #2563D9;
  box-shadow: 0 0 0 3px rgba(37,99,217,0.15);
}

.campo::placeholder {
  color: #A1A1A6;
}

.campo--error {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.12);
}

.campo--error:focus {
  border-color: #DC2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.18);
}

/* ——— Grid de profesionales ——— */
.profesionales-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.btn-profesional {
  border-radius: 14px;
  border: 1px solid #E5E5EA;
  background: transparent;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  color: #1D1D1F;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-profesional:hover {
  border-color: #2563D9;
}

.btn-profesional--seleccionado {
  border-color: #2563D9;
  background: #EFF4FF;
}

/* ——— Grid de horarios ——— */
.horarios-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.btn-hora {
  border-radius: 10px;
  border: 1px solid #E5E5EA;
  background: transparent;
  padding: 8px 4px;
  font-size: 13px;
  color: #1D1D1F;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-hora:hover {
  border-color: #2563D9;
}

.btn-hora--seleccionado {
  border-color: #2563D9;
  background: #EFF4FF;
}

.horarios-vacio {
  grid-column: 1 / -1;
  font-size: 13px;
  color: #6E6E73;
}

/* ——— Modal ——— */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.30);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal--oculto {
  display: none;
}

.modal__caja {
  background: #fff;
  border: 1px solid #E5E5EA;
  border-radius: 16px;
  padding: 24px;
  max-width: min(360px, calc(100vw - 32px));
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal__confirmado {
  font-size: 13px;
  font-weight: 500;
  color: #15803D;
  background: #F0FDF4;
  border-radius: 999px;
  padding: 4px 14px;
  display: inline-block;
}

.modal__label {
  font-size: 15px;
  font-weight: 600;
  color: #1D1D1F;
  margin-top: 4px;
}

.modal__codigo {
  font-size: 30px;
  font-weight: 600;
  color: #2563D9;
  letter-spacing: 6px;
  margin-top: 4px;
  word-break: break-all;
  overflow-wrap: break-word;
}

.modal__detalle {
  font-size: 13px;
  color: #6E6E73;
  text-align: center;
}

.modal__cabecera {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.modal__nota {
  font-size: 12px;
  color: #A1A1A6;
  text-align: center;
}

/* ——— Panel / login ——— */
.panel-login {
  max-width: 320px;
  margin: 0 auto;
}

.panel-login__titulo {
  font-size: 15px;
  font-weight: 600;
  color: #1D1D1F;
  text-align: center;
}

.panel-login__subtitulo {
  font-size: 13px;
  color: #6E6E73;
  text-align: center;
}

/* ——— Agenda ——— */
.agenda-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.agenda-prof-titulo {
  font-size: 11px;
  font-weight: 500;
  color: #6E6E73;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cita-card {
  background: #fff;
  border: 1px solid #E5E5EA;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cita-card__info {
  flex: 1;
  min-width: 0;
}

.cita-card__nombre {
  font-size: 14px;
  font-weight: 500;
  color: #1D1D1F;
}

.cita-card__detalle {
  font-size: 12px;
  color: #6E6E73;
  margin-top: 2px;
}

.cita-card__acciones {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
}

.badge--pendiente { background: #FFFBEB; color: #B45309; }
.badge--atendida  { background: #F0FDF4; color: #15803D; }
.badge--cancelada { background: #FEF2F2; color: #DC2626; }
.badge--nuevo     { background: #EFF4FF; color: #2563D9; }

.btn-atendida {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #E5E5EA;
  color: #6E6E73;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  min-height: 36px;
  white-space: nowrap;
}

.btn-atendida:hover {
  border-color: #2563D9;
  color: #2563D9;
}

.agenda-vacio {
  font-size: 13px;
  color: #A1A1A6;
}

/* ——— Resultado consulta ——— */
.resultado-cita {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resultado-cita__encabezado {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.resultado-cita__nombre {
  font-size: 14px;
  font-weight: 500;
  color: #1D1D1F;
}

.resultado-cita__info {
  font-size: 13px;
  color: #6E6E73;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-cancelar-cita {
  width: 100%;
  background: transparent;
  border: 1px solid #E5E5EA;
  color: #6E6E73;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 24px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  min-height: 44px;
  touch-action: manipulation;
}

.btn-cancelar-cita:hover {
  border-color: #EF4444;
  color: #DC2626;
}

/* ——— Flex util ——— */
.flex-buscar {
  display: flex;
  gap: 8px;
}

.flex-buscar .campo {
  flex: 1;
}

.btn-buscar {
  background: #2563D9;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
  min-height: 44px;
  white-space: nowrap;
  touch-action: manipulation;
}

.btn-buscar:hover {
  background: #1D4FB8;
}

/* ——— Bloqueo panel ——— */
.bloqueo-msg {
  font-size: 13px;
  color: #DC2626;
  text-align: center;
}

/* ——— Responsivo 360 px y orientación horizontal ——— */

/* En pantallas muy pequeñas (≤399 px): nav compacta y servicios en columna única */
@media (max-width: 399px) {
  /* Navbar: ocultar badge para liberar espacio a los botones */
  .nav {
    padding: 6px 8px;
    gap: 4px;
  }

  .nav__badge {
    display: none;
  }

  .nav__nombre {
    font-size: 13px;
  }

  .nav__acciones {
    gap: 3px;
  }

  .btn-nav {
    font-size: 11px;
    padding: 10px 8px;
    min-height: 44px;
  }

  /* Servicios en columna única para evitar texto cortado */
  .servicios-grid {
    grid-template-columns: 1fr;
  }

  .btn-servicio {
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    padding: 12px 14px;
    text-align: left;
  }

  .btn-servicio__nombre {
    font-size: 14px;
    flex: 1;
  }

  .btn-servicio__duracion,
  .btn-servicio__precio {
    font-size: 12px;
    margin-top: 0;
  }

  .horarios-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .modal__codigo {
    font-size: 22px;
    letter-spacing: 3px;
  }

  .contenedor {
    padding: 16px 12px;
  }
}

/* Orientación horizontal: reducir padding vertical para dejar más espacio al contenido */
@media (orientation: landscape) and (max-height: 500px) {
  .nav {
    padding: 6px 12px;
  }

  .nav__badge {
    display: none;
  }

  .btn-nav {
    font-size: 11px;
    padding: 10px 8px;
    min-height: 44px;
  }

  .contenedor {
    padding: 12px 16px;
    gap: 12px;
  }

  .tarjeta {
    padding: 12px;
    gap: 10px;
  }

  .toast {
    top: 52px;
  }
}

/* Asegurar que ningún elemento cree scroll horizontal */
body {
  overflow-x: hidden;
}

.contenedor {
  overflow-x: hidden;
}
