/**
 * Booking Flow Modal — pixel-perfect to design screens.
 * Loaded on is_singular('event') via Altojive_Assets.
 * @package Altojive
 */

/* ── Modal shell override ───────────────────────────────
   The booking modal is narrower + taller than default     */
#modal-booking .modal {
  max-width: 540px;
  border-radius: var(--r-2xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  max-height: 92dvh;   /* shrinks with the on-screen keyboard on mobile */
}

#modal-booking .booking-modal-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;             /* allow the inner scroll area to shrink + scroll */
  overflow: hidden;          /* children scroll, not the whole modal */
}

/* ── Header ─────────────────────────────────────────── */
.bk-hd {
  display: flex;
  align-items: center;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #fff;
}

.bk-hd--with-back { gap: 12px; }

.bk-hd__title {
  font-family: var(--font-body);   /* matches design — NOT display */
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.bk-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--t-fast), background var(--t-fast);
}
.bk-back:hover { color: var(--text-primary); background: var(--grey-100); }

/* ── Step 1: Ticket table header ─────────────────────── */
.bk-tbl-hd {
  display: flex;
  justify-content: space-between;
  padding: 10px 24px;
  background: var(--grey-50);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ── Scrollable body ─────────────────────────────────── */
.bk-body {
  flex: 1;
  overflow-y: auto;
  background: var(--grey-50);
}

/* ── Ticket row ──────────────────────────────────────── */
.bk-ticket-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--green);    /* thick green left accent */
}

.bk-ticket-info { flex: 1; min-width: 0; }

.bk-ticket-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.2;
}

.bk-ticket-price {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

/* Qty controls */
.bk-qty {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-left: 24px;
}

.bk-qty-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--grey-300);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color var(--t-fast), color var(--t-fast);
}
.bk-qty-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
}

.bk-qty-num {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  min-width: 24px;
  text-align: center;
}

/* ── Footer (shared Steps 1 + 2) ─────────────────────── */
.bk-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}

.bk-foot__summary {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.bk-foot__val { color: var(--green); }

.bk-proceed-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  padding: 16px 24px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  transition: background var(--t-fast);
}
.bk-proceed-btn:hover { background: var(--navy-hover); }

/* ── Step 2: Event info bar ──────────────────────────── */
.bk-event-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--grey-50);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  flex-shrink: 0;
  gap: 16px;
  flex-wrap: wrap;
}

.bk-event-bar__title { font-weight: 500; color: var(--text-primary); }

.bk-event-bar__date {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ── Attendee details — one attendee at a time ──────────── */
.bk-att-single {
  flex: 1;
  min-height: 0;             /* the body scrolls if a form is ever taller */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--grey-50);
  padding: 20px 24px;
}

/* Progress: "Attendee X of Y" + ticket + bar */
.bk-att-steps { margin-bottom: 18px; }
.bk-att-steps__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.bk-att-steps__count { font-size: var(--text-sm); color: var(--text-secondary); }
.bk-att-steps__count strong { color: var(--navy); font-weight: 700; }
.bk-att-steps__ticket {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--navy);
  text-align: right;
}
.bk-att-steps__bar {
  height: 6px;
  background: var(--grey-100, #eceef4);
  border-radius: var(--r-full);
  overflow: hidden;
}
.bk-att-steps__bar span {
  display: block;
  height: 100%;
  background: var(--yellow);
  border-radius: var(--r-full);
  transition: width .3s ease;
}

/* The single attendee's fields — a clean white card */
.bk-att-fields {
  background: #fff;
  border: 1px solid var(--border);
  border-top: 3px solid var(--blue);
  border-radius: var(--r-lg);
  padding: 18px;
}
.bk-att-fields .form-group { margin-bottom: 14px; }
.bk-att-fields .form-group:last-child { margin-bottom: 0; }
.bk-att-fields .form-input {
  font-size: 16px;                  /* 16px avoids iOS auto-zoom on focus */
  padding: 10px 14px;
  width: 100%;
  box-sizing: border-box;
}

/* Footer nav row (Previous + summary) */
.bk-foot--att .bk-foot__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.bk-att-prev {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 6px 4px 0;
  transition: color var(--t-fast);
}
.bk-att-prev:hover { color: var(--navy); }

/* Phone row with fixed +27 (South Africa) prefix */
.bk-phone-row {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.bk-phone-row:focus-within {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30,32,53,.08);
}

.bk-phone-cc {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 12px;
  background: var(--grey-50);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.bk-phone-flag__icon { font-size: 18px; line-height: 1; }
.bk-phone-cc__code { line-height: 1; }

.bk-phone-row .form-input {
  border: none;
  border-radius: 0;
  flex: 1;
  min-width: 0;                       /* lets the input shrink on narrow screens */
  padding: 10px 14px;
  font-size: 16px;
}
.bk-phone-row .form-input:focus { box-shadow: none; }

/* Validation highlight + inline field error */
.bk-invalid { border-color: var(--red) !important; }
.bk-field-err {
  display: block;
  margin-top: 5px;
  font-size: var(--text-xs);
  color: var(--red);
  min-height: 0;
}
.bk-field-err:empty { display: none; }

/* ToS line */
.bk-tos {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: 12px 24px;
  background: var(--grey-50);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.bk-tos a { color: var(--blue); text-decoration: underline; }
.bk-tos a:hover { opacity: .8; }

/* ── Step 3: Order Summary ───────────────────────────── */
.bk-summary-bg {
  background: var(--grey-50);
  padding: 28px 24px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Ticket stub with side notch cuts */
.bk-stub {
  width: 100%;
  max-width: 380px;
  position: relative;
  filter: drop-shadow(0 4px 12px rgba(30,32,53,.12));
}

/* Notch circles cut out of background colour */
.bk-stub::before,
.bk-stub::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--grey-50);     /* match surrounding bg */
  z-index: 2;
}
.bk-stub::before { left: -11px;  transform: translateY(-50%); }
.bk-stub::after  { right: -11px; transform: translateY(-50%); }

.bk-stub__inner {
  background: #fff;
  border-radius: var(--r-lg);
  border-top: 4px solid var(--blue);
  overflow: hidden;
  position: relative;
  z-index: 1;
  padding: 20px 24px;
}

.bk-stub__type {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--blue);
  text-align: center;
  margin-bottom: 16px;
}

.bk-stub__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bk-stub__name {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.bk-stub__email {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.bk-stub__price {
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-base);
  padding: 5px 16px;
  border-radius: var(--r-md);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Totals */
.bk-totals {
  padding: 20px 24px;
  background: #fff;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.bk-totals__row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.bk-totals__divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.bk-totals__row--total {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0;
}

.bk-totals__row--total span:last-child { color: var(--green); }
.bk-totals__row--discount span:last-child { color: var(--green); font-weight: 600; }

/* ── Coupon (order summary) ─────────────────────────────── */
.bk-coupon { padding: 16px 24px 0; }
.bk-coupon__form { display: flex; gap: 8px; }
.bk-coupon__input {
  flex: 1; min-width: 0; font-size: 15px; font-family: var(--font-body);
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: 10px 12px; outline: none; text-transform: uppercase;
}
.bk-coupon__input::placeholder { text-transform: none; }
.bk-coupon__input:focus { border-color: var(--navy); }
.bk-coupon__apply {
  flex-shrink: 0; min-height: 44px; padding-inline: 20px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  color: #fff; background: var(--navy); border: none; border-radius: var(--r-md);
  cursor: pointer; transition: background var(--t-fast);
}
.bk-coupon__apply:hover:not(:disabled) { background: var(--navy-hover); }
.bk-coupon__apply:disabled { opacity: .6; cursor: default; }
.bk-coupon__applied {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--r-md);
  background: #eafaf1; color: #1c6b3f; font-size: 14px; font-weight: 600;
}
.bk-coupon__applied svg { flex-shrink: 0; }
.bk-coupon__remove {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: #1c6b3f; font-size: 13px; font-weight: 700; text-decoration: underline;
}
.bk-coupon__msg { font-size: 13px; margin: 8px 0 0; min-height: 1em; }
.bk-coupon__msg.is-err { color: var(--red, #ef4444); }

/* Pay Now */
.bk-pay-wrap {
  padding: 0 24px 20px;
  background: #fff;
  flex-shrink: 0;
}

.bk-pay-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--green);
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--text-xl);
  font-weight: 600;
  padding: 18px 24px;
  border-radius: var(--r-md);
  border: none;
  cursor: pointer;
  transition: background var(--t-fast);
}
.bk-pay-btn:hover { background: #219a52; }
.bk-pay-btn:disabled { opacity: .65; cursor: not-allowed; }

/* Pay spinner */
.bk-pay-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: var(--r-full);
  display: inline-block;
  animation: bk-spin .7s linear infinite;
}
@keyframes bk-spin { to { transform: rotate(360deg); } }

/* Error message */
.bk-pay-error {
  display: none;
  padding: 10px 24px 16px;
  font-size: var(--text-sm);
  color: var(--red);
  text-align: center;
  background: #fff;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 600px) {
  #modal-booking .modal {
    max-width: 100%;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 92vh;
    max-height: 92dvh;
  }

  #modal-booking.open {
    align-items: flex-end;
    padding: 0;
  }

  .bk-ticket-name { font-size: var(--text-xl); }
  .bk-qty { gap: 12px; margin-left: 12px; }
  .bk-stub::before, .bk-stub::after { display: none; }

  /* Attendee form: tighter gutters on small screens */
  .bk-att-single { padding: 16px; }
  .bk-att-fields { padding: 14px; }
  .bk-event-bar { flex-wrap: wrap; gap: 4px 10px; }
  .bk-phone-cc { padding: 10px; }
}

/* Spaces remaining indicator */
.bk-spaces {
  font-size: var(--text-xs);
  color: var(--red);
  font-weight: 500;
}

/* Free event — pay button inherits green but label changes */
.bk-pay-btn--free {
  background: var(--navy);
}
.bk-pay-btn--free:hover { background: var(--navy-hover); }

/* ── Ticket availability states ─────────────────────── */
.bk-spaces {
  font-size: var(--text-xs);
  color: var(--red);
  font-weight: 600;
}

.bk-sold-out {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #fff;
  background: var(--red);
  padding: 2px 8px;
  border-radius: var(--r-full);
  margin-left: 6px;
}

.bk-ticket-row--sold-out {
  opacity: .55;
  pointer-events: none;
}
