/* ====================================
   Booking Calendar Widget
   ==================================== */

/* --- Widget Container --- */
.booking-calendly-widget {
  display: flex;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  max-width: 900px;
  margin: 0 auto;
  min-height: 520px;
}

/* --- Left Sidebar --- */
.booking-sidebar {
  width: 280px;
  min-width: 280px;
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-inset);
  border-right: 1px solid var(--border-light);
}

.booking-sidebar-avatar {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid var(--border-light);
}

.booking-sidebar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.booking-sidebar-brand {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.booking-sidebar-title {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.25;
  margin: 0 0 24px;
}

.booking-sidebar-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.booking-sidebar-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.booking-sidebar-detail svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.booking-sidebar-bottom {
  margin-top: auto;
  padding-top: 24px;
}

.booking-sidebar-bottom p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* --- Right Main Content --- */
.booking-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  max-height: 620px;
}

/* --- Calendar Section --- */
.calendar-month-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.calendar-month-label {
  font-family: 'Instrument Serif', serif;
  font-size: 20px;
  color: var(--text-primary);
}

.calendar-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}

.calendar-nav-btn:hover {
  border-color: var(--text-primary);
  background: var(--bg-card);
  color: var(--text-primary);
}

/* --- Calendar Grid --- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-header {
  text-align: center;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  font-weight: 500;
  color: var(--text-primary);
}

.calendar-day:not(.disabled):not(.other-month):hover {
  background: var(--bg-card);
}

.calendar-day.disabled {
  color: var(--text-muted);
  opacity: 0.35;
  cursor: not-allowed;
}

.calendar-day.other-month {
  visibility: hidden;
}

.calendar-day.selected {
  background: var(--black);
  color: var(--white);
}

.calendar-day.today:not(.selected) {
  border: 2px solid var(--border);
}

.calendar-day.available:not(.selected)::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #2E8B3E;
}

/* --- Time Slots Section --- */
.booking-timeslots-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  animation: fadeSlideIn 0.3s ease;
}

.timeslots-date-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

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

.time-slot-btn:hover {
  border-color: var(--text-primary);
  background: var(--white);
}

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

/* --- Booking Error --- */
.booking-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}

/* --- Booking Form Section --- */
.booking-form-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  animation: fadeSlideIn 0.3s ease;
}

.booking-summary-bar {
  background: var(--bg-inset);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.summary-datetime {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.summary-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.booking-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--white);
  transition: all 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.05);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.booking-confirm-btn {
  padding: 14px 28px;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
  margin-top: 4px;
  width: 100%;
}

.booking-confirm-btn:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.booking-confirm-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--text-muted);
}

.booking-confirm-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* --- Success State --- */
.booking-success {
  text-align: center;
  padding: 80px 40px;
  animation: fadeSlideIn 0.5s ease;
}

.success-icon {
  margin: 0 auto 24px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ECFDF5;
  color: #059669;
  animation: scaleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.success-title {
  font-family: 'Instrument Serif', serif;
  font-size: 24px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.success-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Loading Spinner --- */
.loading-spinner {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  grid-column: 1 / -1;
}

.loading-spinner::before {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* --- No Slots --- */
.no-slots-message {
  text-align: center;
  padding: 40px 20px;
  grid-column: 1 / -1;
}

.no-slots-message p {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.no-slots-message p:first-child {
  font-weight: 600;
  color: var(--text-primary);
}

/* --- Animations --- */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

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

/* ====================================
   Responsive
   ==================================== */
@media (max-width: 900px) {
  .booking-calendly-widget {
    flex-direction: column;
  }

  .booking-sidebar {
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
    padding: 24px;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
  }

  .booking-sidebar-bottom {
    display: none;
  }

  .booking-sidebar-details {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
  }

  .booking-main {
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 600px) {
  .booking-calendly-widget {
    border-radius: var(--radius-sm);
  }

  .booking-sidebar {
    padding: 20px 16px;
  }

  .booking-sidebar-avatar {
    width: 44px;
    height: 44px;
    margin-bottom: 12px;
  }

  .booking-sidebar-title {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .booking-main {
    padding: 24px 16px;
  }

  .calendar-grid {
    gap: 2px;
  }

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

  .time-slots-grid {
    gap: 8px;
  }

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

  .booking-confirm-btn {
    font-size: 14px;
    padding: 12px 24px;
  }

  .booking-success {
    padding: 60px 20px;
  }
}
