/**
 * Sacred Booking Appointment Modal Stylesheet (Fully Screen-Fitted Edition)
 * Project: soulguidedbymansi | Inner Light Healing
 * Location: /mansi/assets/css/booking_modal.css
 * Timezone: Asia/Kolkata (Indian Standard Time)
 *
 * Dedicated styling file for "Book Your Session" popup modal.
 * Solves:
 * - Modal strictly contained within viewport boundaries on all devices/screen resolutions
 * - Never overflows or goes off-screen vertically or horizontally
 * - Pinned compact header and pinned compact footer always visible
 * - Internal scrollable body with visible scrollbar
 * - Safe margins and padding adapted for laptops, tablets, and phones
 */

/* Lock background scrolling when modal is active */
body.booking-modal-open {
  overflow: hidden !important;
  touch-action: none;
}

/* Modal Overlay / Backdrop */
.booking-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(30, 20, 12, 0.78);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 99999;
  padding: 12px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  overflow-y: auto; /* Fallback safe scrolling on tiny viewports */
  overflow-x: hidden;
}

.booking-modal-overlay.active {
  display: flex !important;
}

/* Modal Card Container - Strictly Constrained to Viewport */
.booking-modal-card {
  background: #ffffff;
  border-radius: 12px;
  max-width: 640px;
  width: 100%;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  height: auto;
  display: flex !important;
  flex-direction: column !important;
  border: 1.5px solid #ebd9bf;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.32), 0 4px 16px rgba(123, 77, 23, 0.15);
  margin: auto;
  overflow: hidden !important;
  position: relative;
  box-sizing: border-box;
  animation: bookingModalFadeIn 0.22s ease-out;
}

@keyframes bookingModalFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Modal Header - Pinned at Top */
.booking-modal-header {
  padding: 10px 18px;
  background: linear-gradient(180deg, #faf5ec 0%, #f5ece0 100%);
  border-bottom: 1.5px solid #e8dac5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  box-sizing: border-box;
}

.booking-eyebrow {
  font-family: Arial, sans-serif;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: #b47a18;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 2px;
}

.booking-modal-title {
  font-family: Georgia, serif;
  font-size: 17px;
  color: #2e1d0c;
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
}

.booking-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #8c7b6d;
  padding: 3px 7px;
  border-radius: 6px;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.booking-modal-close:hover {
  color: #2e1d0c;
  background: rgba(180, 122, 24, 0.12);
}

/* Appointment Form Wrapper */
#appointmentBookingForm {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Modal Body - ALWAYS SCROLLABLE INSIDE, NEVER OVERFLOWS OUT OF SCREEN */
.booking-modal-body {
  padding: 14px 18px 16px 18px !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: calc(100vh - 120px) !important;
  max-height: calc(100dvh - 120px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior: contain !important;
  box-sizing: border-box !important;

  /* Firefox Scrollbar Styling */
  scrollbar-width: thin !important;
  scrollbar-color: #b47a18 #faf5ec !important;
}

/* WebKit (Chrome, Safari, Edge, Opera) Dedicated Scrollbar */
.booking-modal-body::-webkit-scrollbar {
  width: 8px !important;
  display: block !important;
}

.booking-modal-body::-webkit-scrollbar-track {
  background: #faf5ec !important;
  border-left: 1px solid #ebd9bf !important;
  border-radius: 4px !important;
}

.booking-modal-body::-webkit-scrollbar-thumb {
  background: #b47a18 !important;
  border-radius: 5px !important;
  border: 2px solid #faf5ec !important;
}

.booking-modal-body::-webkit-scrollbar-thumb:hover {
  background: #8e5812 !important;
}

/* Modal Footer - Pinned at Bottom */
.booking-modal-footer {
  padding: 10px 18px;
  background: #faf5ec;
  border-top: 1.5px solid #ebd9bf;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

/* Form Elements inside Modal */
.booking-form-group {
  margin-bottom: 10px;
}

.booking-form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #3b2a1a;
  margin-bottom: 4px;
  letter-spacing: 0.25px;
}

.booking-form-group input[type="text"],
.booking-form-group input[type="email"],
.booking-form-group select,
.booking-form-group textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: inherit;
  border: 1px solid #d8c6b0;
  border-radius: 6px;
  background: #ffffff;
  color: #2e1d0c;
  box-sizing: border-box;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.booking-form-group input:focus,
.booking-form-group select:focus,
.booking-form-group textarea:focus {
  outline: none;
  border-color: #b47a18;
  box-shadow: 0 0 0 2px rgba(180, 122, 24, 0.18);
}

.booking-form-group textarea {
  min-height: 52px;
  height: 54px;
  resize: vertical;
}

/* Two Column Responsive Grid */
.booking-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Live Pricing Summary Box */
#bookingPriceSummaryCard {
  background: #ffffff;
  border: 1px solid #ebd9bf;
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 4px;
  margin-bottom: 4px;
  box-shadow: 0 1px 3px rgba(123, 77, 23, 0.03);
}

/* Mobile & Small Screens Optimization */
@media (max-width: 640px) {
  .booking-modal-overlay {
    padding: 6px;
    align-items: center; /* Centered so top/bottom never cut off */
  }

  .booking-modal-card {
    max-width: 100% !important;
    width: 100% !important;
    max-height: calc(100vh - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
    border-radius: 12px !important;
    margin: 0 !important;
  }

  .booking-modal-header {
    padding: 9px 14px !important;
  }

  .booking-modal-title {
    font-size: 15px !important;
  }

  .booking-eyebrow {
    font-size: 8px !important;
  }

  .booking-modal-body {
    padding: 10px 14px 14px 14px !important;
    max-height: calc(100vh - 110px) !important;
    max-height: calc(100dvh - 110px) !important;
  }

  .booking-modal-body::-webkit-scrollbar {
    width: 5px !important;
  }

  .booking-modal-footer {
    padding: 8px 14px !important;
    flex-direction: row !important;
    gap: 8px !important;
  }

  .booking-modal-footer button,
  .booking-modal-footer .btn {
    flex: 1 !important;
    padding: 9px 12px !important;
    font-size: 12.5px !important;
    justify-content: center !important;
  }

  .booking-grid-2col {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  .booking-form-group {
    margin-bottom: 8px !important;
  }
}

/* Very Short Viewport Devices (e.g. Mobile Landscape or Small Laptops) */
@media (max-height: 650px) {
  .booking-modal-card {
    max-height: calc(100vh - 8px) !important;
    max-height: calc(100dvh - 8px) !important;
  }
  .booking-modal-header {
    padding: 6px 14px !important;
  }
  .booking-modal-body {
    padding: 8px 14px 10px 14px !important;
    max-height: calc(100vh - 90px) !important;
    max-height: calc(100dvh - 90px) !important;
  }
  .booking-modal-footer {
    padding: 6px 14px !important;
  }
  .booking-form-group textarea {
    min-height: 44px;
    height: 44px;
  }
}
