/* ============================================
   NEXROM V1 — Booking Page Styles
   ============================================ */

.booking-container {
  min-height: 100vh;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

/* ── Company Header ── */
.company-info {
  text-align: center;
  margin-bottom: var(--space-xl);
  animation: fadeInUp 0.5s ease forwards;
}

.company-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  margin: 0 auto var(--space-md);
}

.company-info h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-sm);
}

.company-info .badge {
  margin-bottom: var(--space-md);
}

.company-info .badge-branch {
  background: var(--booking-tag-bg, var(--status-confirmed-bg));
  color: var(--booking-tag-color, var(--status-confirmed));
  border: 1px solid var(--booking-tag-soft, transparent);
}

.company-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) auto var(--space-md);
}

.company-details p {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.btn-whatsapp-small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(37, 211, 102, 0.1);
  color: #25D366;
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 500;
  border: 1px solid rgba(37, 211, 102, 0.2);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-whatsapp-small:hover {
  background: rgba(37, 211, 102, 0.2);
}

.booking-notice {
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  margin-top: var(--space-lg);
  font-style: italic;
}

/* ── Message States ── */
.booking-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  gap: var(--space-md);
  animation: fadeIn 0.5s ease forwards;
}

.booking-message h2 {
  color: var(--text-secondary);
}

.booking-message p {
  color: var(--text-tertiary);
  max-width: 400px;
}

/* ── Login Section ── */
.login-card {
  text-align: center;
  padding: var(--space-2xl);
  max-width: 400px;
  margin: 0 auto;
  animation: fadeInUp 0.5s ease 0.3s forwards;
  opacity: 0;
}

.login-card h3 {
  margin-bottom: var(--space-sm);
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  background: var(--white);
  color: var(--black);
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 2px 12px rgba(255,255,255,0.1);
}

.btn-google:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(255,255,255,0.15);
}

/* ── Wizard Steps ── */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
  padding: 0 var(--space-md);
}

/* ── Step Content ── */
.step-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-lg);
  text-align: center;
}

/* Step 1: Services */
.service-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

.service-card {
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.service-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.service-card.selected {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.service-card-info h4 {
  font-size: var(--font-size-base);
  font-weight: 600;
  margin-bottom: 2px;
}

.service-card-info span {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
}


.provider-booking-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
}

.provider-booking-text {
  min-width: 0;
}

.provider-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: var(--bg-tertiary);
}

.provider-avatar-fallback {
  font-size: 1.2rem;
}

@media (max-width: 640px) {
  .provider-card {
    align-items: stretch;
  }

  .provider-booking-info {
    align-items: center;
  }
}

.service-card-price {
  font-size: var(--font-size-md);
  font-weight: 700;
  color: var(--text-secondary);
}

/* Step 2: Calendar */
.booking-calendar {
  animation: fadeIn 0.3s ease;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.cal-header h4 {
  font-size: var(--font-size-md);
  text-align: center;
  flex: 1;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-label {
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  font-weight: 600;
  padding: var(--space-sm);
}

.cal-day {
  text-align: center;
  padding: 10px 4px;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
}

.cal-day:hover:not(.disabled) {
  background: var(--bg-glass-strong);
}

.cal-day.today {
  color: var(--white);
  font-weight: 700;
}

.cal-day.selected {
  background: var(--white);
  color: var(--black);
  font-weight: 700;
}

.cal-day.disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

.cal-day.other {
  opacity: 0.28;
  cursor: pointer;
}

.cal-day.other.disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

/* Step 3: Time Slots */
.time-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  animation: fadeIn 0.3s ease;
}

.time-slot-btn {
  padding: 12px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.time-slot-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.time-slot-btn.selected {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
  font-weight: 700;
}

.no-slots-msg {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-tertiary);
}

/* Step 4: Confirm */
.confirm-card {
  padding: var(--space-xl);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
}

.confirm-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-size-base);
}

.confirm-row:last-child {
  border-bottom: none;
}

.confirm-label {
  color: var(--text-secondary);
}

.confirm-value {
  font-weight: 600;
}

/* ── Wizard Nav ── */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-xl);
  gap: var(--space-md);
}

/* ── Success Screen ── */
.success-content {
  text-align: center;
  padding: var(--space-2xl) 0;
  animation: fadeInUp 0.5s ease forwards;
}

.success-check {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--status-confirmed);
  color: white;
  font-size: 40px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-details {
  text-align: left;
  margin-top: var(--space-lg);
}

.success-details .confirm-row {
  font-size: var(--font-size-sm);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .booking-container {
    padding: var(--space-md) var(--space-md);
  }

  .company-info h1 {
    font-size: var(--font-size-2xl);
  }

  .time-slots-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wizard-steps {
    gap: 2px;
  }
}

/* ── Customer History ── */
.btn-history-small {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  margin: var(--space-md) auto 0 auto;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-history-small:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.history-list {
  display: grid;
  gap: var(--space-md);
}

.history-list.is-scrollable {
  max-height: 580px;
  overflow-y: auto;
  padding-right: 8px;
}

.history-list.is-scrollable::-webkit-scrollbar {
  width: 8px;
}

.history-list.is-scrollable::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-full);
}

.history-list.is-scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
}

.history-list.is-scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

.history-card,
.history-empty {
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.history-card.is-cancelled {
  opacity: 0.65;
}

.history-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.history-status {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
}

.history-status.pending,
.history-status.confirmed {
  background: var(--status-confirmed-bg);
  color: var(--status-confirmed);
}

.history-status.cancelled {
  background: rgba(239, 68, 68, 0.12);
  color: var(--status-cancelled);
}

.history-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--font-size-sm);
}

.history-row span {
  color: var(--text-secondary);
}

.history-row b {
  text-align: right;
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin: var(--space-md) auto 0 auto;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

@media (max-width: 480px) {
  .history-card-header,
  .history-row,
  .history-actions {
    align-items: stretch;
  }

  .history-row {
    flex-direction: column;
    gap: 4px;
  }

  .history-row b {
    text-align: left;
  }

  .history-actions {
    flex-direction: column;
  }
}

/* ── Booking Account Switcher ── */
.booking-account-switcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 14px;
  margin: var(--space-sm) auto var(--space-xs);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
}

.booking-account-switcher .account-email b {
  color: var(--text-primary);
  font-weight: 600;
}

.btn-switch-account {
  border: 0;
  background: transparent;
  color: var(--color-primary);
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
}

.btn-switch-account:hover {
  text-decoration: underline;
}


#btn-my-appointments{display:flex;margin:16px auto 0 auto;}

/* ── Tema personalizado da página pública ── */
.booking-theme-custom .btn-primary,
.booking-theme-custom .btn-google,
.booking-theme-custom .success-check {
  background: var(--accent);
  color: var(--bg-primary);
}

.booking-theme-custom .service-card.selected,
.booking-theme-custom .provider-card.selected,
.booking-theme-custom .time-slot.selected,
.booking-theme-custom .calendar-day.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.booking-theme-custom .company-logo {
  border-color: var(--accent);
}

.booking-theme-light .card-glass,
.booking-theme-light .service-card,
.booking-theme-light .provider-card,
.booking-theme-light .time-slot,
.booking-theme-light .calendar-day,
.booking-theme-light .login-card {
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
}


/* ── Ajuste premium do stepper público: somente bolinhas, sem bloco/quadrado ativo ── */
#booking-wizard .wizard-steps {
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto var(--space-xl);
  padding: 0 var(--space-md);
}

#booking-wizard .wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 72px;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

#booking-wizard .wizard-step-number {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

#booking-wizard .wizard-step.active .wizard-step-number {
  background: var(--accent, var(--color-primary));
  border-color: var(--accent, var(--color-primary));
  color: #fff;
  box-shadow: 0 0 0 6px var(--accent-soft, rgba(16, 185, 129, 0.14));
}

#booking-wizard .wizard-step.completed .wizard-step-number {
  background: var(--accent, var(--color-primary));
  border-color: var(--accent, var(--color-primary));
  color: #fff;
}

#booking-wizard .wizard-step-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

#booking-wizard .wizard-step.active .wizard-step-label {
  color: var(--text-primary);
}

#booking-wizard .wizard-step.completed .wizard-step-label {
  color: var(--accent, var(--color-primary));
}

#booking-wizard .wizard-divider {
  flex: 1;
  max-width: 88px;
  min-width: 48px;
  height: 1px;
  margin: 16px 4px 0;
  background: var(--border-color);
}

@media (max-width: 640px) {
  #booking-wizard .wizard-steps {
    gap: 6px;
    padding: 0 6px;
  }

  #booking-wizard .wizard-step {
    min-width: 54px;
    gap: 6px;
  }

  #booking-wizard .wizard-step-number {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  #booking-wizard .wizard-step-label {
    display: block;
    font-size: 11px;
  }

  #booking-wizard .wizard-divider {
    min-width: 18px;
    margin-top: 14px;
  }
}

/* ── Correção mobile do stepper: evita corte lateral com 5 etapas ── */
@media (max-width: 640px) {
  #booking-wizard .wizard-steps {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    justify-content: center;
    overflow: hidden;
    gap: 4px;
    padding: 0 10px;
    margin-left: auto;
    margin-right: auto;
  }

  #booking-wizard .wizard-step {
    flex: 0 0 42px;
    min-width: 0;
    max-width: 42px;
    box-sizing: border-box;
    gap: 5px;
  }

  #booking-wizard .wizard-step-number {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 12px;
    line-height: 1;
  }

  #booking-wizard .wizard-step-label {
    width: 58px;
    max-width: 58px;
    font-size: 10px;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #booking-wizard .wizard-divider {
    flex: 1 1 10px;
    min-width: 8px;
    max-width: 26px;
    margin: 14px 1px 0;
  }
}

@media (max-width: 390px) {
  #booking-wizard .wizard-steps {
    gap: 2px;
    padding: 0 6px;
  }

  #booking-wizard .wizard-step {
    flex-basis: 36px;
    max-width: 36px;
  }

  #booking-wizard .wizard-step-number {
    width: 26px;
    height: 26px;
    min-width: 26px;
  }

  #booking-wizard .wizard-step-label {
    width: 48px;
    max-width: 48px;
    font-size: 9px;
  }

  #booking-wizard .wizard-divider {
    min-width: 6px;
    max-width: 18px;
  }
}

/* Correção: o dia atual não deve parecer apagado no calendário público.
   Mantém disabled para dias realmente indisponíveis, mas separa visualmente o estado "hoje". */
.cal-day.today {
  opacity: 1;
  color: var(--text-primary);
  font-weight: 800;
  border: 1px solid var(--border-color-hover);
  background: var(--bg-glass);
  box-shadow: inset 0 0 0 1px var(--bg-glass-strong);
}

.cal-day.today.disabled {
  opacity: 1;
  color: var(--text-secondary);
  background: var(--bg-glass);
  border-color: var(--border-color);
}

.cal-day.today.selected,
.cal-day.selected.today {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
  box-shadow: none;
}

.booking-theme-custom .cal-day.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.booking-theme-custom .cal-day.today.selected,
.booking-theme-custom .cal-day.selected.today {
  background: var(--accent);
  color: var(--bg-primary);
}

/* Ajuste fino: hoje aparece somente como número normal; a demarcação premium só aparece ao clicar. */
.cal-day.today,
.booking-theme-custom .cal-day.today {
  opacity: 1;
  color: var(--text-primary);
  font-weight: 700;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
}

.cal-day.today.disabled,
.booking-theme-custom .cal-day.today.disabled {
  opacity: 0.2;
  color: var(--text-primary);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.cal-day.selected,
.cal-day.today.selected,
.cal-day.selected.today,
.booking-theme-custom .cal-day.selected,
.booking-theme-custom .cal-day.today.selected,
.booking-theme-custom .cal-day.selected.today {
  color: var(--text-primary);
  font-weight: 800;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 23, 42, 0.42);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.75);
}

/* Correção anti-flicker: reserva a borda e estabiliza o tamanho dos dias do calendário.
   Ao selecionar uma data, apenas cor/sombra mudam; o grid não recalcula altura/largura. */
.cal-day,
.booking-theme-custom .cal-day {
  box-sizing: border-box;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
  line-height: 1;
  border: 1px solid transparent;
  transform: none !important;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}

.cal-day:hover:not(.disabled) {
  transform: none !important;
}

.cal-day.today,
.booking-theme-custom .cal-day.today {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.cal-day.selected,
.cal-day.today.selected,
.cal-day.selected.today,
.booking-theme-custom .cal-day.selected,
.booking-theme-custom .cal-day.today.selected,
.booking-theme-custom .cal-day.selected.today {
  font-weight: 700;
  border-color: rgba(15, 23, 42, 0.28);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

/* Correção: datas visíveis do mês anterior/próximo devem respeitar disponibilidade real.
   Se estiverem disponíveis, aparecem como datas normais e podem ser clicadas para virar o mês.
   Só ficam apagadas quando realmente estiverem indisponíveis. */
.cal-day.other:not(.disabled),
.booking-theme-custom .cal-day.other:not(.disabled) {
  opacity: 1;
  color: var(--text-primary);
  cursor: pointer;
}

.cal-day.other.disabled,
.booking-theme-custom .cal-day.other.disabled {
  opacity: 0.2;
  color: var(--text-primary);
  cursor: default;
  pointer-events: none;
}
