/**
 * Villa Hera Booking Calendar
 * One unified calendar for availability + booking
 */

.booking-cal {
  max-width: 720px;
  width: 90%;
  margin: 0 auto;
  background: #fff;
  padding: clamp(1.5rem, 4vw, 3rem);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.04);
}

/* Legend */
.booking-cal-header {
  margin-bottom: 2rem;
}

.booking-legend {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: #9a9590;
}

.booking-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.booking-legend .legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.booking-legend .legend-dot.available {
  background: #7eb07f;
}

.booking-legend .legend-dot.booked {
  background: #c9a3a3;
}

.booking-legend .legend-dot.changeover {
  background: linear-gradient(135deg, #c9a3a3 50%, #7eb07f 50%);
}

/* Navigation */
.booking-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.booking-cal-nav button {
  background: none;
  border: 1px solid #e0d8d2;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
  color: #8a8078;
  transition: all 0.2s ease;
}

.booking-cal-nav button:hover {
  background: #8a8078;
  border-color: #8a8078;
  color: #fff;
}

.cal-month-label {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #6a6a67;
}

/* Weekdays */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 10px;
  text-align: center;
}

.cal-weekdays span {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #b0a8a0;
  padding: 0.75rem 0;
  text-transform: uppercase;
}

/* Days grid */
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 400;
  border-radius: 6px;
  color: #fff;
  position: relative;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.cal-day.empty {
  background: transparent;
}

.cal-day.past {
  background: #f5f3f0;
  color: #ccc8c2;
  cursor: default !important;
}

.cal-day.available {
  background: #7eb07f;
}

.cal-day.available:hover {
  transform: scale(1.08);
  box-shadow: 0 3px 12px rgba(126, 176, 127, 0.35);
  z-index: 1;
}

.cal-day.booked {
  background: #c9a3a3;
  cursor: not-allowed !important;
}

.cal-day.booked:hover {
  opacity: 0.95;
}

/* Checkout day: Guest leaves AM → Available PM */
.cal-day.checkout {
  background: linear-gradient(135deg, #c9a3a3 50%, #7eb07f 50%);
}

.cal-day.checkout:hover {
  transform: scale(1.08);
  box-shadow: 0 3px 12px rgba(126, 176, 127, 0.35);
  z-index: 1;
}

/* Check-in day: Available AM → Guest arrives PM */
.cal-day.checkin {
  background: linear-gradient(135deg, #7eb07f 50%, #c9a3a3 50%);
}

.cal-day.checkin:hover {
  opacity: 0.95;
}

/* Back-to-back bookings */
.cal-day.changeover {
  background: #c9a3a3;
  cursor: not-allowed !important;
}

.cal-day.today {
  box-shadow: inset 0 0 0 2px #333;
}

/* Selected state - start and end dates */
.cal-day.selected {
  background: #2c5530 !important;
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px #2c5530 !important;
  transform: scale(1.1);
  z-index: 3;
  color: #fff;
  font-weight: 600;
}

.cal-day.selected-start,
.cal-day.selected-end {
  position: relative;
}

.cal-day.selected-start::after {
  content: "IN";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

.cal-day.selected-end::after {
  content: "OUT";
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #fff;
}

.cal-day.in-range {
  background: #3d7a40 !important;
  box-shadow: inset 0 0 0 3px #2c5530 !important;
  transform: scale(1.0);
  position: relative;
}

.cal-day.in-range::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -3px;
  right: -3px;
  height: 60%;
  transform: translateY(-50%);
  background: rgba(44, 85, 48, 0.3);
  z-index: -1;
}

/* Selection summary */
.booking-selection {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #ece8e3;
}

.selection-row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.selection-item {
  flex: 1;
  text-align: center;
}

.selection-item label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b0a8a0;
  margin-bottom: 0.5rem;
}

.selection-item span {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.1rem;
  color: #6a6a67;
}

.selection-price span {
  font-weight: 500;
  color: #4a8f4d;
}

.selected-price .price-note {
  display: block;
  font-size: 0.65rem;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  color: #9a9590;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* Tax line in selection area */
.selection-tax {
  display: none;
  text-align: center;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}

.selection-tax .tax-note {
  font-size: 0.8rem;
  color: #9a9590;
}

.selection-tax em {
  font-style: italic;
  color: #b0a8a0;
}

.selection-actions {
  display: flex;
  gap: 1rem;
}

.clear-btn {
  flex: 0 0 auto;
  padding: 1rem 1.5rem;
  background: transparent;
  border: 1px solid #e0d8d2;
  color: #9a9590;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  border-color: #8a8078;
  color: #6a6a67;
}

.booking-cta {
  flex: 1;
  padding: 1rem 2rem;
  background: #8a8078;
  border: none;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.booking-cta:hover:not(:disabled) {
  background: #6a6a67;
}

.booking-cta:disabled {
  background: #d5d0ca;
  cursor: not-allowed;
}

.booking-note {
  margin-top: 1rem;
  font-size: 0.7rem;
  color: #a9a19a;
  text-align: center;
  letter-spacing: 0.03em;
}

/* Tooltip */
.booking-tooltip {
  position: absolute;
  z-index: 1000;
  background: #333;
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.5;
  max-width: 220px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: tooltipFade 0.2s ease;
}

.booking-tooltip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
  border-bottom: none;
}

@keyframes tooltipFade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive - Tablets */
@media (max-width: 768px) {
  .booking-cal {
    width: 95%;
    padding: clamp(1.25rem, 3vw, 2rem);
  }

  .cal-month-label {
    font-size: 1.3rem;
  }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
  .booking-cal {
    width: 100%;
    padding: 1rem;
  }

  .booking-legend {
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.7rem;
  }

  .cal-day {
    font-size: 0.8rem;
  }

  .cal-weekdays span {
    font-size: 0.65rem;
  }

  .cal-month-label {
    font-size: 1.2rem;
  }

  .booking-cal-nav button {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .selection-row {
    flex-wrap: wrap;
  }

  .selection-item {
    flex: 0 0 calc(50% - 0.5rem);
  }

  .selection-item:last-child {
    flex: 0 0 100%;
    margin-top: 0.5rem;
  }

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

  .clear-btn,
  .booking-cta {
    width: 100%;
    text-align: center;
  }
}

/* Booking Modal */
.booking-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.booking-modal {
  background: #fff;
  max-width: 580px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #999;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.modal-close:hover {
  color: #333;
}

.booking-modal h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: #6a6a67;
  margin-bottom: 1.5rem;
  text-align: center;
}

.booking-summary {
  display: flex;
  justify-content: space-between;
  background: #f8f6f3;
  padding: 1rem;
  margin-bottom: 1.5rem;
  gap: 0.5rem;
}

.summary-item {
  text-align: center;
  flex: 1;
}

.summary-item .label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a9a19a;
  margin-bottom: 0.25rem;
}

.summary-item .value {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 0.95rem;
  color: #5a5a5a;
}

/* Pricing breakdown */
.booking-pricing {
  background: #faf9f7;
  border: 1px solid #e8e4e0;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: 4px;
}

.pricing-section {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #e8e4e0;
}

.pricing-section.tax-section {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.pricing-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #5a5a5a;
  margin-bottom: 0.25rem;
}

.arrival-badge {
  font-size: 0.65rem;
  font-weight: 500;
  background: #f0ebe6;
  color: #8a8078;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pricing-calc {
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 0.25rem;
}

.pricing-amount {
  font-size: 1.1rem;
  font-weight: 500;
  color: #4a4a4a;
}

.pricing-totals {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid #e0dbd5;
}

.pricing-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
}

.pricing-total-row span:first-child {
  font-size: 0.9rem;
  color: #666;
}

.pricing-total-row .total-amount {
  font-size: 1.25rem;
  font-weight: 600;
  color: #4a8f4d;
}

.pricing-total-row.tax-total span {
  font-size: 0.85rem;
  color: #8a8078;
}

.booking-form .form-group {
  margin-bottom: 1rem;
}

.booking-form label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6a6a67;
  margin-bottom: 0.4rem;
}

.booking-form input,
.booking-form select,
.booking-form textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d8cbc4;
  font-family: inherit;
  font-size: 0.9rem;
  color: #333;
  transition: border-color 0.2s;
}

.booking-form input:focus,
.booking-form select:focus,
.booking-form textarea:focus {
  outline: none;
  border-color: #6a6a67;
}

.booking-form input::placeholder,
.booking-form textarea::placeholder {
  color: #bbb;
}

.submit-btn {
  width: 100%;
  padding: 1rem;
  background: #6a6a67;
  border: none;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 0.5rem;
}

.submit-btn:hover {
  background: #5a5a57;
}

.form-note {
  font-size: 0.75rem;
  color: #a9a19a;
  text-align: center;
  margin-top: 1rem;
}

/* Confirmation */
.booking-confirmation {
  text-align: center;
  padding: 2rem 1rem;
}

.confirmation-icon {
  width: 60px;
  height: 60px;
  background: #5a8f5c;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.5rem;
}

.booking-confirmation h3 {
  margin-bottom: 1rem;
}

.booking-confirmation p {
  color: #666;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.email-fallback {
  font-size: 0.85rem;
  background: #f8f6f3;
  padding: 1rem;
  margin-top: 1.5rem;
}

.email-fallback a {
  color: #6a6a67;
  font-weight: 500;
}

.booking-ref {
  font-family: monospace;
  background: #f0f0f0;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  display: inline-block;
  margin: 0.5rem 0;
}

.email-note {
  font-size: 0.85rem;
  color: #888;
}

.close-btn {
  margin-top: 1.5rem;
  padding: 0.8rem 2rem;
  background: transparent;
  border: 1px solid #d8cbc4;
  color: #6a6a67;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.close-btn:hover {
  background: #6a6a67;
  border-color: #6a6a67;
  color: #fff;
}

@media (max-width: 768px) {
  .booking-modal {
    width: 95%;
    padding: clamp(1.25rem, 3vw, 2rem);
  }
}

@media (max-width: 480px) {
  .booking-modal {
    width: 100%;
    max-height: 95vh;
    padding: 1.25rem;
  }

  .booking-modal h3 {
    font-size: 1.2rem;
  }

  .booking-summary {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .booking-form input,
  .booking-form select,
  .booking-form textarea {
    padding: 0.65rem;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .pricing-total-row .total-amount {
    font-size: 1.1rem;
  }
}

/* Checkbox styling */
.checkbox-group {
  margin-top: 0.5rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: #666;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: #6a6a67;
}
