/**
 * Custom Appointment Booking Styles
 * Matches the inneranchor.ca site design system
 *
 * Design tokens used:
 * --indigo: #4849a1 (primary)
 * --indigo-dark: #2b2c61
 * --dark: #1f1d23
 * --text-default: #484a5c
 * --content_gray: #6e6a7c
 * --surfaces-light: #eef0f1
 * --cream: #fef7f2
 * --ultra_ultra_light: #f4f5f8
 * --line_work: #d9d9d9
 * Font: Plus Jakarta Sans
 * Letter spacing: -0.01em
 */

/* ========================================
   Modal Container
   ======================================== */
.booking-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.01em;
  color: #484a5c;
  font-size: 16px;
  line-height: 160%;
}

.booking-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(31, 29, 35, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.booking-modal-content {
  position: relative;
  width: 90%;
  max-width: 580px;
  max-height: 90vh;
  margin: 5vh auto;
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  overflow-y: auto;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), 0 20px 60px rgba(0, 0, 0, 0.15);
  animation: modalSlideIn 0.3s ease-out;
  min-height: 400px;
}

/* Custom scrollbar for modal content */
.booking-modal-content::-webkit-scrollbar {
  width: 6px;
}

.booking-modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.booking-modal-content::-webkit-scrollbar-thumb {
  background: #d9d9d9;
  border-radius: 3px;
}

.booking-modal-content::-webkit-scrollbar-thumb:hover {
  background: #6e6a7c;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Close Button */
.booking-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: #eef0f1;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #484a5c;
  z-index: 2;
}

.booking-modal-close:hover {
  background: #d9d9d9;
  color: #1f1d23;
}

/* ========================================
   Booking Step Headings
   ======================================== */
.booking-step h2 {
  text-align: center;
  color: #1f1d23;
  font-size: 22px;
  font-weight: 600;
  line-height: 140%;
  margin-bottom: 24px;
  margin-top: 0;
  letter-spacing: -0.01em;
}

/* ========================================
   Progress Indicator
   ======================================== */
.booking-progress {
  display: flex;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 0 10px;
}

.booking-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
}

.booking-progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: #eef0f1;
  z-index: 0;
}

.booking-progress-step.completed:not(:last-child)::after {
  background: #4849a1;
}

.booking-progress-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef0f1;
  color: #6e6a7c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}

.booking-progress-step.active .booking-progress-number {
  background: #4849a1;
  color: #fff;
  box-shadow: 0 4px 12px rgba(72, 73, 161, 0.3);
}

.booking-progress-step.completed .booking-progress-number {
  background: #4849a1;
  color: #fff;
}

.booking-progress-label {
  font-size: 12px;
  color: #6e6a7c;
  text-align: center;
  font-weight: 500;
}

.booking-progress-step.active .booking-progress-label {
  color: #4849a1;
  font-weight: 600;
}

.booking-progress-step.completed .booking-progress-label {
  color: #4849a1;
}

/* ========================================
   Calendar
   ======================================== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 16px 0 24px;
}

.calendar-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #1f1d23;
}

.calendar-nav {
  background: none;
  border: 1.5px solid #e0dfe3;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #484a5c;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.calendar-nav:hover:not(.disabled) {
  border-color: #4849a1;
  color: #4849a1;
  background: #f4f5f8;
}

.calendar-nav.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.calendar-day-name {
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: #6e6a7c;
  padding: 8px 0;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  font-size: 14px;
  border: 1.5px solid transparent;
  color: #484a5c;
}

.calendar-day:not(.empty):not(.past):hover {
  background: #f4f5f8;
  border-color: #4849a1;
}

.calendar-day.selected {
  background: #4849a1;
  color: #fff;
  border-color: #4849a1;
}

.calendar-day.today {
  border: none;
  font-weight: 700;
  position: relative;
}

.calendar-day.today::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: #4849a1;
  border-radius: 1px;
}

.calendar-day.today.selected {
  color: #fff;
}

.calendar-day.has-slots {
  background: #f4f5f8;
  font-weight: 600;
  color: #1f1d23;
}

.calendar-day.no-availability {
  color: #d9d9d9;
  cursor: not-allowed;
}

.calendar-day.past {
  color: #d9d9d9;
  cursor: not-allowed;
}

.calendar-day.empty {
  cursor: default;
}

/* ========================================
   Time Slots
   ======================================== */
.booking-time-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin: 16px 0 24px;
}

.time-slot {
  padding: 12px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
  font-size: 14px;
  color: #484a5c;
  text-align: center;
  font-family: inherit;
  letter-spacing: -0.01em;
}

.time-slot:hover {
  border-color: #4849a1;
  background: #f4f5f8;
  color: #4849a1;
}

.time-slot.selected {
  background: #4849a1;
  color: #fff;
  border-color: #4849a1;
}

.no-slots {
  text-align: center;
  padding: 40px 20px;
  color: #6e6a7c;
  font-size: 16px;
  line-height: 160%;
}

/* ========================================
   Form
   ======================================== */
.booking-form {
  margin: 16px 0 0;
}

.booking-form-group {
  margin-bottom: 16px;
}

.booking-form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #1f1d23;
  font-size: 14px;
  line-height: 160%;
}

.booking-form-group input,
.booking-form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: -0.01em;
  color: #484a5c;
  background: #fff;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
  line-height: 160%;
}

.booking-form-group input {
  height: 40px;
}

.booking-form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.booking-form-group input::placeholder,
.booking-form-group textarea::placeholder {
  color: #6e6a7c;
}

.booking-form-group input:focus,
.booking-form-group textarea:focus {
  outline: none;
  border-color: #4849a1;
  box-shadow: 0 0 0 2px rgba(72, 73, 161, 0.15);
}

.booking-form-group input.error,
.booking-form-group textarea.error {
  border-color: #e53935;
  box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.12);
}

/* ========================================
   Summary
   ======================================== */
.booking-summary {
  background: #f4f5f8;
  padding: 24px;
  border-radius: 12px;
  margin: 16px 0 0;
  border: 1px solid #eef0f1;
}

.summary-row {
  padding: 10px 0;
  border-bottom: 1px solid #eef0f1;
  font-size: 15px;
  color: #484a5c;
  line-height: 160%;
}

.summary-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.summary-row:first-child {
  padding-top: 0;
}

.summary-row strong {
  display: inline-block;
  width: 80px;
  color: #6e6a7c;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ========================================
   Buttons
   ======================================== */
.booking-btn {
  padding: 12px 28px;
  border: none;
  border-radius: 1000px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  letter-spacing: -0.01em;
  line-height: 160%;
  text-align: center;
}

.booking-btn-next,
.booking-btn-submit {
  background: #4849a1;
  color: #fff;
}

.booking-btn-next:hover,
.booking-btn-submit:hover {
  background: #2b2c61;
  box-shadow: 0 4px 12px rgba(72, 73, 161, 0.3);
}

.booking-btn-next:disabled {
  background: #d9d9d9;
  color: #6e6a7c;
  cursor: not-allowed;
  box-shadow: none;
}

.booking-btn-back {
  background: #eef0f1;
  color: #484a5c;
  margin-right: 12px;
}

.booking-btn-back:hover {
  background: #d9d9d9;
  color: #1f1d23;
}

.booking-navigation {
  display: flex;
  justify-content: flex-end;
  margin-top: 28px;
}

/* Step 1 standalone next button */
.booking-step[data-step="1"] > .booking-btn-next {
  display: block;
  margin: 24px auto 0;
  min-width: 160px;
}

/* ========================================
   Success State
   ======================================== */
.booking-success {
  text-align: center;
  padding: 40px 20px;
}

.booking-success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #4849a1;
  color: #fff;
  font-size: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  animation: successPulse 0.5s ease-out;
}

@keyframes successPulse {
  0% {
    transform: scale(0);
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.booking-success h2 {
  color: #4849a1;
  margin-bottom: 12px;
}

.booking-success p {
  color: #6e6a7c;
  font-size: 16px;
  margin-bottom: 28px;
}

.booking-success .booking-btn {
  background: #4849a1;
  color: #fff;
}

.booking-success .booking-btn:hover {
  background: #2b2c61;
}

/* ========================================
   Error Banner
   ======================================== */
.booking-error {
  /* display is toggled by JS between 'none' and 'flex' */
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 16px;
}

.booking-error-message {
  margin: 0;
  color: #991b1b;
  font-size: 14px;
  font-weight: 500;
  line-height: 160%;
}

.booking-error-dismiss {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #991b1b;
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  font-family: inherit;
  padding: 0;
}

.booking-error-dismiss:hover {
  background: rgba(153, 27, 27, 0.1);
}

/* ========================================
   Loading State
   ======================================== */
.booking-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.92);
  /* display is toggled by JS between 'none' and 'flex' */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 1000;
}

.booking-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid #eef0f1;
  border-top-color: #4849a1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.booking-loading p {
  margin-top: 16px;
  color: #6e6a7c;
  font-weight: 600;
  font-size: 14px;
}

/* ========================================
   Responsive: Tablet (max-width: 991px)
   ======================================== */
@media (max-width: 991px) {
  .booking-modal-content {
    max-width: 520px;
    padding: 32px;
  }

  .booking-step h2 {
    font-size: 20px;
  }
}

/* ========================================
   Responsive: Mobile Landscape (max-width: 767px)
   ======================================== */
@media (max-width: 767px) {
  .booking-modal-content {
    width: 94%;
    padding: 24px;
    margin: 3vh auto;
    max-height: 94vh;
    border-radius: 12px;
  }

  .booking-progress {
    padding: 0;
    margin-bottom: 24px;
  }

  .booking-progress-label {
    font-size: 11px;
  }

  .booking-progress-number {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .booking-progress-step:not(:last-child)::after {
    top: 15px;
  }

  .booking-step h2 {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .calendar-grid {
    gap: 4px;
  }

  .calendar-day {
    font-size: 13px;
  }

  .calendar-day-name {
    font-size: 12px;
  }

  .booking-time-slots {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
  }

  .time-slot {
    padding: 10px 6px;
    font-size: 13px;
  }

  .booking-form-group {
    margin-bottom: 12px;
  }

  .summary-row strong {
    display: block;
    margin-bottom: 2px;
  }

  .booking-navigation {
    flex-direction: column-reverse;
    gap: 10px;
    margin-top: 24px;
  }

  .booking-btn-back {
    margin-right: 0;
  }

  .booking-btn {
    width: 100%;
    padding: 14px 24px;
  }

  .booking-step[data-step="1"] > .booking-btn-next {
    width: 100%;
  }
}

/* ========================================
   Responsive: Small Mobile (max-width: 479px)
   ======================================== */
@media (max-width: 479px) {
  .booking-modal-content {
    width: 100%;
    margin: 0;
    max-height: 100vh;
    border-radius: 0;
    min-height: 100vh;
  }

  .booking-loading {
    border-radius: 0 !important;
  }

  .booking-modal-close {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .booking-progress {
    padding: 0;
    gap: 2px;
  }

  .booking-progress-label {
    font-size: 10px;
  }

  .booking-progress-number {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .booking-progress-step:not(:last-child)::after {
    top: 13px;
  }

  .calendar-header {
    font-size: 16px;
  }

  .booking-summary {
    padding: 16px;
  }

  .summary-row {
    font-size: 14px;
  }

  .summary-row strong {
    font-size: 12px;
  }
}
