/* =====================================================
   Calendar Section
   ===================================================== */

.calendar-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* =====================================================
   Navigation
   ===================================================== */

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.calendar-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--alpine-blue);
  background: transparent;
  color: var(--alpine-blue);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.calendar-nav-btn:hover {
  background: var(--alpine-blue);
  color: #fff;
}

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

.calendar-nav-btn:disabled:hover {
  background: transparent;
  color: var(--alpine-blue);
}

.calendar-nav-label {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  text-align: center;
  color: var(--charcoal);
  flex: 1;
}

/* =====================================================
   Month Grid Layout
   ===================================================== */

.calendar-months {
  display: flex;
  flex-direction: row;
  gap: 24px;
}

.calendar-month {
  flex: 1;
  min-width: 0;
}

.calendar-month-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--charcoal);
  text-align: center;
  margin-bottom: 0.75rem;
  text-transform: capitalize;
}

/* =====================================================
   Day Grid
   ===================================================== */

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

.calendar-dow {
  font-family: 'Outfit', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  color: #9e9e9e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-bottom: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  border-radius: 6px;
  cursor: default;
  position: relative;
  transition: opacity 0.1s ease;
  border: 2px solid transparent;
  isolation: isolate;
}

/* Split-day digits: white text with a soft dark shadow, legible on both halves */
.calendar-day--checkin.calendar-day--your-stay .calendar-day-number,
.calendar-day--checkout.calendar-day--your-stay .calendar-day-number,
.calendar-day--checkin.calendar-day--checkout.calendar-day--your-stay .calendar-day-number,
.calendar-day--checkout.calendar-day--extendable .calendar-day-number {
  color: #fff;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.6), 0 0 1px rgba(0, 0, 0, 0.8);
}

/* ---- Day state classes ---- */

.calendar-day--empty {
  /* spacer cell for offset */
  background: transparent;
  pointer-events: none;
}

.calendar-day--available {
  background: #fff;
  color: var(--charcoal);
  border-color: #e0e0e0;
}

.calendar-day--unavailable {
  background: #f5f5f5;
  color: #bdbdbd;
  border-color: #f5f5f5;
}

.calendar-day--off-season {
  background: repeating-linear-gradient(
    -45deg,
    #f9f9f9,
    #f9f9f9 3px,
    #f0f0f0 3px,
    #f0f0f0 6px
  );
  color: #ccc;
  border-color: #eee;
}

.calendar-day--your-stay {
  background: var(--alpine-blue);
  color: #fff;
  font-weight: 700;
  border-color: var(--alpine-blue);
}

.calendar-day--extendable {
  background: #e8f5e9;
  color: var(--pine, #2e7d32);
  border: 2px dashed #66bb6a;
  cursor: pointer;
}

/* Check-in day: diagonal split — available (top-left) → booked (bottom-right) */
.calendar-day--checkin.calendar-day--unavailable {
  background: linear-gradient(135deg, #fff 50%, #f5f5f5 50%);
  color: #9e9e9e;
  border-color: #e0e0e0;
}

.calendar-day--checkin.calendar-day--your-stay {
  background: linear-gradient(135deg, #fff 50%, var(--alpine-blue) 50%);
  color: #fff;
  font-weight: 700;
  border-color: var(--alpine-blue);
}

.calendar-day--checkin.calendar-day--extendable {
  background: linear-gradient(135deg, #fff 50%, #e8f5e9 50%);
  color: var(--pine, #2e7d32);
  border: 2px dashed #66bb6a;
}

/* Check-out day: diagonal split — booked (top-left) → available (bottom-right) */
.calendar-day--checkout.calendar-day--available {
  background: linear-gradient(135deg, #f5f5f5 50%, #fff 50%);
  color: var(--charcoal);
  border-color: #e0e0e0;
}

.calendar-day--checkout.calendar-day--your-stay {
  background: linear-gradient(135deg, var(--alpine-blue) 50%, #fff 50%);
  color: #fff;
  font-weight: 700;
  border-color: var(--alpine-blue);
}

/* Check-out + check-in on same day (back-to-back bookings) */
.calendar-day--checkout.calendar-day--checkin.calendar-day--unavailable {
  background: linear-gradient(135deg, #f5f5f5 50%, #f5f5f5 50%);
  color: #9e9e9e;
  border-color: #e0e0e0;
}

/* Back-to-back: previous booking checkout + guest stay starts — grey top (prior stay) → blue bottom (current stay) */
.calendar-day--checkin.calendar-day--checkout.calendar-day--your-stay {
  background: linear-gradient(135deg, #f5f5f5 50%, var(--alpine-blue) 50%);
  color: #fff;
  font-weight: 700;
  border-color: var(--alpine-blue);
}

/* Guest checkout day that is also extendable — blue top (stay in the morning) → green bottom (extension available) */
.calendar-day--checkout.calendar-day--extendable {
  background: linear-gradient(135deg, var(--alpine-blue) 50%, #e8f5e9 50%);
  color: #fff;
  font-weight: 700;
  border: 2px dashed #66bb6a;
  cursor: pointer;
}

.calendar-day--extendable:hover {
  background: #c8e6c9;
}

/* Date selection states */
.calendar-day--selectable {
  cursor: pointer;
}

.calendar-day--select-start {
  background: var(--pine, #2e7d32) !important;
  color: #fff !important;
  font-weight: 700;
  border-color: var(--pine, #2e7d32) !important;
  cursor: pointer;
}

.calendar-day--select-range {
  background: #c8e6c9 !important;
  color: var(--charcoal) !important;
  border-color: #a5d6a7 !important;
}

.calendar-day--select-end {
  background: var(--pine, #2e7d32) !important;
  color: #fff !important;
  font-weight: 700;
  border-color: var(--pine, #2e7d32) !important;
  cursor: pointer;
}

.calendar-day--past {
  color: #d9d9d9;
  background: transparent;
  border-color: transparent;
}

/* =====================================================
   Legend
   ===================================================== */

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #ececec;
}

.calendar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  color: var(--charcoal);
}

.calendar-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.calendar-legend-swatch--available {
  background: #fff;
  border: 1px solid #e0e0e0;
}

.calendar-legend-swatch--unavailable {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
}

.calendar-legend-swatch--your-stay {
  background: var(--alpine-blue);
}

.calendar-legend-swatch--extendable {
  background: #e8f5e9;
  border: 2px dashed #66bb6a;
}

/* =====================================================
   Upsell Banner
   ===================================================== */

.calendar-upsell {
  background: #fff8e1;
  border-left: 4px solid #ffc107;
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.calendar-upsell-text {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: var(--charcoal);
  flex: 1;
  min-width: 180px;
}

.calendar-upsell-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--alpine-blue);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 1.25rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.calendar-upsell-cta:hover {
  opacity: 0.85;
}

/* =====================================================
   Extension Form
   ===================================================== */

.calendar-extension-form {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.calendar-extension-form h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  color: var(--charcoal);
  margin: 0 0 1rem;
}

.calendar-extension-form-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calendar-extension-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 120px;
}

.calendar-extension-form-field label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #757575;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-extension-form-field input[type="number"],
.calendar-extension-form-field input[type="date"] {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: var(--charcoal);
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.calendar-extension-form-field input:focus {
  border-color: var(--alpine-blue);
}

.calendar-extension-form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.calendar-extension-form-submit {
  background: var(--alpine-blue);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1.35rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.calendar-extension-form-submit:hover {
  opacity: 0.85;
}

.calendar-extension-form-cancel {
  background: transparent;
  color: var(--charcoal);
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid #d0d0d0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.calendar-extension-form-cancel:hover {
  background: #f5f5f5;
}

/* =====================================================
   Status Messages
   ===================================================== */

.calendar-confirmation {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: #2e7d32;
}

.calendar-error {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #ffebee;
  border: 1px solid #ef9a9a;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: #c62828;
}

/* =====================================================
   Loading
   ===================================================== */

.calendar-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2.5rem 1rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: #9e9e9e;
}

.calendar-loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--alpine-blue);
  border-radius: 50%;
  animation: calendar-spin 0.7s linear infinite;
}

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

/* Loading overlay (shown on top of existing content during navigation) */
#calendarContent,
#bookletCalendarContent {
  position: relative;
}

.calendar-content-inner {
  transition: opacity 0.15s ease;
}

.calendar-content--loading {
  opacity: 0.4;
  pointer-events: none;
}

.calendar-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* Inquiry form */
.calendar-inquiry-form {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.calendar-inquiry-form h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  color: var(--charcoal);
  margin: 0 0 0.5rem;
}

.calendar-inquiry-form .date-summary {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

.calendar-inquiry-form-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.calendar-inquiry-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 200px;
}

.calendar-inquiry-form-field.full-width {
  flex-basis: 100%;
}

.calendar-inquiry-form-field label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #757575;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-inquiry-form-field input,
.calendar-inquiry-form-field textarea {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  color: var(--charcoal);
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.calendar-inquiry-form-field input:focus,
.calendar-inquiry-form-field textarea:focus {
  border-color: var(--alpine-blue);
}

.calendar-inquiry-form-field textarea {
  resize: vertical;
  min-height: 60px;
}

.calendar-inquiry-form-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.calendar-inquiry-form-submit {
  background: var(--pine, #2e7d32);
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1.35rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.calendar-inquiry-form-submit:hover { opacity: 0.85; }
.calendar-inquiry-form-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.calendar-inquiry-form-cancel {
  background: transparent;
  color: var(--charcoal);
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid #d0d0d0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.calendar-inquiry-form-cancel:hover { background: #f5f5f5; }

/* =====================================================
   Mobile
   ===================================================== */

@media (max-width: 600px) {
  .calendar-months {
    flex-direction: column;
    gap: 1.5rem;
  }

  .calendar-nav-label {
    font-size: 0.9rem;
  }

  .calendar-upsell {
    flex-direction: column;
    align-items: flex-start;
  }

  .calendar-upsell-cta {
    width: 100%;
    justify-content: center;
  }

  .calendar-extension-form {
    padding: 1rem;
  }

  .calendar-extension-form-actions {
    flex-direction: column;
  }

  .calendar-extension-form-submit,
  .calendar-extension-form-cancel {
    width: 100%;
    text-align: center;
  }

  .calendar-inquiry-form-field {
    min-width: 100%;
  }
}

/* =====================================================
   Booking Status Badges
   ===================================================== */

.status-inquiry {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
}

/* =====================================================
   Day Price Display
   ===================================================== */

.calendar-day-price {
  display: block;
  font-size: 0.55rem;
  color: #888;
  line-height: 1;
  margin-top: 1px;
}

/* =====================================================
   Rate Form
   ===================================================== */

.calendar-rate-form {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.calendar-rate-form h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  color: var(--charcoal);
  margin: 0 0 1rem;
}
