/* ============================================================
   D8. BOOKING CALENDAR WIDGET — replaces native Hi.Events booking widget
   on WhiteCard pages. Calendar + time slots + tickets + buy → opens
   Hi.Events checkout in iframe modal.
   ============================================================ */

.wc-cal-widget {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wc-cal-step {
  background: #FAFAF7;
  border: 1px solid #EDE5D8;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.wc-cal-step[data-active="true"] {
  background: #FFFFFF;
  border-color: #D0C4AF;
  box-shadow: 0 2px 12px rgba(56, 45, 38, 0.05);
}

/* Header — clickable, shows step number, label, summary */
.wc-cal-step-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.wc-cal-step-header:hover { background: rgba(244, 236, 221, 0.5); }
.wc-cal-step[data-active="true"] .wc-cal-step-header { cursor: default; }
.wc-cal-step[data-active="true"] .wc-cal-step-header:hover { background: transparent; }

/* Disabled-state header (step not yet unlocked) */
.wc-cal-step:not([data-active="true"]):not(.wc-cal-step--unlocked) .wc-cal-step-header {
  cursor: not-allowed;
  opacity: 0.6;
}

.wc-cal-step-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #EDE5D8;
  color: #5C433A;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.wc-cal-step[data-active="true"] .wc-cal-step-number {
  background: #A15533;
  color: #FFFFFF;
  transform: scale(1.1);
}
.wc-cal-step-label {
  font-size: 14px;
  font-weight: 700;
  color: #382D26;
  letter-spacing: -0.01em;
}
.wc-cal-step-summary {
  font-size: 13px;
  color: #A15533;
  font-weight: 600;
  margin-left: auto;
}
.wc-cal-step[data-active="true"] .wc-cal-step-summary { display: none; }

.wc-cal-step-chevron {
  font-size: 18px;
  color: #5C433A;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
  margin-left: 6px;
  display: inline-block;
  line-height: 1;
}
.wc-cal-step[data-active="true"] .wc-cal-step-chevron {
  transform: rotate(90deg);
  color: #A15533;
}

/* Body — uses the grid-template-rows trick to animate height: auto smoothly. */
.wc-cal-step-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.wc-cal-step[data-active="true"] .wc-cal-step-body {
  grid-template-rows: 1fr;
}
.wc-cal-step-body-inner {
  overflow: hidden;
  min-height: 0;
  padding: 0 16px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.22s ease 0.05s, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) 0.05s, padding 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.wc-cal-step[data-active="true"] .wc-cal-step-body-inner {
  padding: 0 16px 16px;
  opacity: 1;
  transform: translateY(0);
}

.wc-cal-placeholder {
  font-size: 13px;
  color: #5C433A;
  padding: 12px 0;
  text-align: center;
  font-style: italic;
}

/* --- Calendar grid --- */
.wc-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.wc-cal-month-label {
  font-size: 16px;
  font-weight: 700;
  color: #382D26;
  text-transform: capitalize;
  letter-spacing: -0.01em;
}
.wc-cal-nav {
  background: #FFFFFF;
  border: 1px solid #EDE5D8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  color: #5C433A;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s;
}
.wc-cal-nav:hover { background: #F4ECDD; border-color: #D0C4AF; color: #A15533; }

.wc-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5C433A;
  font-weight: 600;
  text-align: center;
}

.wc-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.wc-cal-day {
  height: 38px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #382D26;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  position: relative;
  padding: 0;
}
.wc-cal-day--other { color: #C9C0AF; }
.wc-cal-day--past { color: #C9C0AF; cursor: default; }
.wc-cal-day:disabled { cursor: default; opacity: 0.45; }
.wc-cal-day--today { font-weight: 700; }
.wc-cal-day--today::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #A15533;
}
.wc-cal-day--available {
  background: #F4ECDD;
  border-color: #E8D9BD;
  color: #382D26;
  font-weight: 700;
  opacity: 1;
}
.wc-cal-day--available:hover {
  background: #A15533;
  color: #FFFFFF;
  border-color: #A15533;
  transform: translateY(-1px);
}
.wc-cal-day--soldout {
  background: #FAFAF7;
  color: #B8AC9A;
  text-decoration: line-through;
}
.wc-cal-day--selected {
  background: #A15533 !important;
  color: #FFFFFF !important;
  border-color: #A15533 !important;
  box-shadow: 0 4px 12px rgba(161, 85, 51, 0.3);
}
.wc-cal-day--selected.wc-cal-day--today::after { background: #FFFFFF; }

.wc-cal-loading,
.wc-cal-empty {
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: #5C433A;
}

/* --- Time slots --- */
.wc-cal-time-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wc-cal-time-slot {
  background: #FFFFFF;
  border: 1px solid #D0C4AF;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  color: #382D26;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.wc-cal-time-slot:hover {
  border-color: #A15533;
  background: #F4ECDD;
}
.wc-cal-time-slot--selected {
  background: #A15533;
  color: #FFFFFF;
  border-color: #A15533;
}
.wc-cal-time-slot--soldout {
  background: #FAFAF7;
  color: #B8AC9A;
  text-decoration: line-through;
  cursor: default;
}

/* --- Tickets --- */
.wc-cal-tickets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.wc-cal-ticket {
  background: #FFFFFF;
  border: 1px solid #EDE5D8;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wc-cal-ticket--soldout { opacity: 0.5; }
.wc-cal-ticket-title {
  font-weight: 700;
  color: #382D26;
  font-size: 14px;
  margin-bottom: 2px;
}
.wc-cal-ticket-meta {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: #5C433A;
}
.wc-cal-ticket-price { color: #1B171A; font-weight: 700; }
.wc-cal-ticket-avail { color: #5C433A; }

.wc-cal-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}
.wc-cal-qty-btn {
  background: #F4ECDD;
  border: 1px solid #EDE5D8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #A15533;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
.wc-cal-qty-btn:hover { background: #A15533; color: #FFFFFF; border-color: #A15533; }
.wc-cal-qty-input {
  width: 44px;
  height: 32px;
  text-align: center;
  border: 1px solid #D0C4AF;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #382D26;
  -moz-appearance: textfield;
}
.wc-cal-qty-input::-webkit-outer-spin-button,
.wc-cal-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Promo code field — sits between tickets and total summary in step 3 */
.wc-cal-promo {
  margin-bottom: 14px;
}
.wc-cal-promo-toggle {
  background: transparent;
  border: 0;
  color: #A15533;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 6px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.wc-cal-promo-toggle:hover { color: #8B4527; }
.wc-cal-promo-form {
  display: flex;
  gap: 8px;
}
.wc-cal-promo-input {
  flex: 1;
  height: 38px;
  border: 1px solid #D0C4AF;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #382D26;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #FFFFFF;
}
.wc-cal-promo-input:focus {
  outline: none;
  border-color: #A15533;
  box-shadow: 0 0 0 3px rgba(161, 85, 51, 0.12);
}
.wc-cal-promo-input:disabled {
  background: #FAFAF7;
  color: #5C433A;
  border-color: #EDE5D8;
}
.wc-cal-promo-apply {
  height: 38px;
  background: #382D26;
  border: 0;
  border-radius: 8px;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 13px;
  padding: 0 16px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.wc-cal-promo-apply:hover:not(:disabled) {
  background: #1B171A;
}
.wc-cal-promo-apply:disabled {
  background: #D0C4AF;
  cursor: default;
}
.wc-cal-promo-status {
  font-size: 12.5px;
  margin-top: 8px;
  font-weight: 600;
  line-height: 1.4;
}
.wc-cal-promo-status--ok { color: #2D7A3E; }
.wc-cal-promo-status--err { color: #8B2929; }

.wc-cal-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: #F4ECDD;
  border-radius: 10px;
  margin-bottom: 14px;
  color: #382D26;
}
.wc-cal-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.wc-cal-summary-subtotal,
.wc-cal-summary-discount {
  font-size: 13px;
}
.wc-cal-summary-subtotal { color: #5C433A; }
.wc-cal-summary-discount { color: #2D7A3E; }
.wc-cal-summary-total-row {
  font-size: 14px;
  padding-top: 6px;
  border-top: 1px solid #E8D9BD;
  margin-top: 2px;
}
/* When no breakdown (no promo applied), the total row is the only row —
   strip its top border + padding so it looks like the original simple row. */
.wc-cal-summary:not(:has([data-discount-row]:not([hidden]))) .wc-cal-summary-total-row {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.wc-cal-total { font-weight: 800; font-size: 17px; }

.wc-cal-buy-btn {
  width: 100%;
  background: #A15533;
  color: #FFFFFF;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(161, 85, 51, 0.28);
  transition: all 0.2s ease;
}
.wc-cal-buy-btn:hover:not(:disabled) {
  background: #8B4527;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(161, 85, 51, 0.38);
}
.wc-cal-buy-btn:disabled {
  background: #D0C4AF;
  cursor: not-allowed;
  box-shadow: none;
}

.wc-cal-buy-error {
  margin-top: 10px;
  padding: 10px 14px;
  background: #FFE5E5;
  border: 1px solid #F5C6C6;
  border-radius: 8px;
  color: #8B2929;
  font-size: 13px;
}

/* --- Checkout modal --- */
.wc-cal-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.wc-cal-modal--open {
  opacity: 1;
  pointer-events: auto;
}
.wc-cal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 23, 26, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.wc-cal-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  /* Stable height across all 3 accordion states — modal does NOT resize when
     a step expands/collapses. Sized to fit the calendar (the tallest step). */
  height: min(620px, 88vh);
  margin: 16px;
  background: #FFFFFF;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  padding-top: 44px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  transform: scale(0.96) translateY(12px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.3s ease, height 0.3s ease;
}
.wc-cal-modal--open .wc-cal-modal-dialog {
  transform: scale(1) translateY(0);
}

/* Content area fills remaining vertical space, scrolls internally if needed */
.wc-cal-modal-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 20px 20px;
  min-height: 0;
}
.wc-cal-modal-iframe[hidden] { display: none; }
.wc-cal-modal-iframe:not([hidden]) {
  flex: 1;
  border: 0;
  display: block;
  background: #FFFFFF;
}

/* When checkout iframe is showing, widen + heighten the dialog */
.wc-cal-modal-dialog:has(.wc-cal-modal-iframe:not([hidden])) {
  max-width: 720px;
  height: 92vh;
  max-height: 920px;
}
.wc-cal-modal-close {
  position: absolute;
  top: 6px;
  right: 8px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #E6E6E6;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  color: #000;
  padding: 0;
  font-family: inherit;
}
.wc-cal-modal-close:hover { background: #FFFFFF; }
.wc-cal-modal-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #FFFFFF;
}

@media (max-width: 820px) {
  .wc-cal-step { padding: 16px; }
  .wc-cal-day { font-size: 14px; height: 44px; }
  .wc-cal-time-slot { padding: 10px 14px; }
  .wc-cal-modal-dialog { height: 96vh; margin: 8px; }
}

/* Smooth focus rings for accessibility */
.mlf-hero-cta:focus-visible,
.mlf-hero-meta-item:focus-visible,
.mlf-faq-question:focus-visible,
.mlf-section-summary:focus-visible {
  outline: 2px solid #A15533;
  outline-offset: 2px;
}

/* Same ring on every interactive control in the booking calendar + modal —
   keyboard users get a clear focus indicator through the whole conversion flow.
   (The promo input keeps its own :focus box-shadow ring, so it's omitted here.) */
.wc-cal-step-header:focus-visible,
.wc-cal-nav:focus-visible,
.wc-cal-day:focus-visible,
.wc-cal-time-slot:focus-visible,
.wc-cal-qty-btn:focus-visible,
.wc-cal-qty-input:focus-visible,
.wc-cal-promo-toggle:focus-visible,
.wc-cal-promo-apply:focus-visible,
.wc-cal-buy-btn:focus-visible,
.wc-cal-modal-close:focus-visible {
  outline: 2px solid #A15533;
  outline-offset: 2px;
}

/* ---------- Reduced motion (booking calendar + modal) ---------- */
@media (prefers-reduced-motion: reduce) {
  .wc-cal-step,
  .wc-cal-step-number,
  .wc-cal-step-chevron,
  .wc-cal-step-body,
  .wc-cal-step-body-inner,
  .wc-cal-day,
  .wc-cal-time-slot,
  .wc-cal-nav,
  .wc-cal-buy-btn,
  .wc-cal-qty-btn,
  .wc-cal-modal,
  .wc-cal-modal-dialog {
    transition-duration: 0.01ms !important;
  }
  .wc-cal-modal-dialog { transform: none !important; }
  .wc-cal-day--available:hover,
  .wc-cal-buy-btn:hover:not(:disabled) { transform: none !important; }
  .wc-cal-step[data-active="true"] .wc-cal-step-number { transform: none !important; }
}

