/* ============================================================
   NYSF — Square payment step (booking modal)
   Styles for the payment-step inside the multi-step booking flow.
   Loaded by index.html alongside square-payments.js.
   ============================================================ */

.sq-pay-wrap {
  max-width: 480px;
  margin: 0 auto;
}

.sq-pay-summary {
  background: var(--cream-2, #F4ECE0);
  border: 1px solid var(--border, #E5DDD0);
  border-radius: 6px;
  padding: 18px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: 'Nunito Sans', sans-serif;
}

.sq-pay-summary .sq-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
  color: var(--ink, #1A1A1A);
}

.sq-pay-summary .sq-row.subtle {
  color: #6B6357;
  font-size: 13px;
}

.sq-pay-summary .sq-divider {
  height: 1px;
  background: var(--border, #E5DDD0);
  margin: 4px 0;
}

.sq-pay-summary .sq-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 4px;
}

.sq-pay-summary .sq-total-row .sq-tot-label {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.sq-pay-summary .sq-total-row .sq-tot-amt {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 24px;
  color: var(--ink, #1A1A1A);
  letter-spacing: -0.02em;
}

#sq-card-container {
  background: #FFFFFF;
  border: 1px solid var(--border, #E5DDD0);
  border-radius: 6px;
  padding: 18px 16px;
  min-height: 110px;
  margin-bottom: 14px;
  position: relative;
  transition: border-color 0.18s ease;
}

/* Skeleton shimmer while Square SDK is mounting the iframe */
#sq-card-container.is-loading::before,
#sq-card-container.is-loading::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    rgba(229, 221, 208, 0.35) 0%,
    rgba(229, 221, 208, 0.85) 50%,
    rgba(229, 221, 208, 0.35) 100%
  );
  background-size: 200% 100%;
  animation: sqShimmer 1.4s ease-in-out infinite;
}
#sq-card-container.is-loading::before { top: 24px; }
#sq-card-container.is-loading::after  { top: 56px; width: 60%; }

@keyframes sqShimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

#sq-card-error {
  color: #8C2A2A;
  font-size: 13px;
  font-family: 'Nunito Sans', sans-serif;
  margin-bottom: 14px;
  padding: 12px 14px 12px 40px;
  background: rgba(170, 51, 51, 0.06);
  border-left: 3px solid #8C2A2A;
  border-radius: 0 4px 4px 0;
  line-height: 1.5;
  outline: none;
  position: relative;
}
#sq-card-error::before {
  content: "!";
  position: absolute;
  left: 12px;
  top: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #8C2A2A;
  color: #FAF3EC;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Jost', sans-serif;
}
#sq-card-error strong { display: block; font-weight: 700; margin-bottom: 2px; font-family: 'Jost', sans-serif; letter-spacing: 0.04em; text-transform: uppercase; font-size: 11px; }
#sq-card-error a { color: #8C2A2A; font-weight: 700; text-decoration: underline; }

/* Per-error-code accents — set via [data-code] from the modal handler */
#sq-card-error[data-code="declined"] {
  color: #8C2A2A;
  background: rgba(170, 51, 51, 0.07);
  border-left-color: #8C2A2A;
}
#sq-card-error[data-code="declined"]::before { background: #8C2A2A; }

#sq-card-error[data-code="network"] {
  color: #6B5008;
  background: rgba(201, 164, 53, 0.10);
  border-left-color: #C9A435;
}
#sq-card-error[data-code="network"]::before { content: "⤺"; background: #C9A435; color: #1A1A1A; font-size: 13px; }

#sq-card-error[data-code="service"] {
  color: #6B5008;
  background: rgba(201, 164, 53, 0.10);
  border-left-color: #C9A435;
}
#sq-card-error[data-code="service"]::before { content: "…"; background: #C9A435; color: #1A1A1A; font-size: 14px; line-height: 0; }
#sq-card-error[data-code="service"] a { color: #6B5008; }

#sq-card-error[data-code="tokenize"],
#sq-card-error[data-code="sdk"] {
  color: #5A4A2A;
  background: rgba(26, 26, 26, 0.05);
  border-left-color: rgba(26, 26, 26, 0.4);
}
#sq-card-error[data-code="tokenize"]::before,
#sq-card-error[data-code="sdk"]::before { background: rgba(26, 26, 26, 0.7); }
#sq-card-error:focus-visible {
  box-shadow: 0 0 0 2px rgba(140, 42, 42, 0.4);
}

.sq-pay-policy {
  font-size: 12px;
  line-height: 1.5;
  color: #6B6357;
  font-family: 'Nunito Sans', sans-serif;
  padding: 14px 16px;
  background: rgba(74, 103, 65, 0.06);
  border-left: 3px solid var(--forest, #4A6741);
  border-radius: 0 4px 4px 0;
  margin-bottom: 18px;
}

.sq-pay-policy strong {
  color: var(--ink, #1A1A1A);
  font-weight: 700;
}

.sq-pay-policy a {
  color: var(--forest, #4A6741);
  text-decoration: underline;
  text-decoration-color: var(--gold, #C9A435);
  text-underline-offset: 2px;
}

.sq-pay-cta {
  width: 100%;
  padding: 16px 20px;
  background: var(--ink, #1A1A1A);
  color: var(--cream, #FAF3EC);
  border: none;
  border-radius: 6px;
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s ease;
}

.sq-pay-cta:hover {
  background: var(--forest, #4A6741);
}

.sq-pay-cta:disabled {
  background: #999;
  cursor: not-allowed;
}

.sq-pay-cta.is-processing {
  background: var(--forest, #4A6741);
  position: relative;
  color: rgba(250, 243, 236, 0.6);
}

.sq-pay-trust {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  font-size: 11px;
  font-family: 'Jost', sans-serif;
  font-weight: 500;
  color: #6B6357;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sq-pay-trust svg {
  width: 12px;
  height: 12px;
  color: var(--forest, #4A6741);
}

/* Card brand + last4 chip on confirmation receipt */
.sq-card-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink, #1A1A1A);
}
.sq-card-chip .sq-brand {
  text-transform: uppercase;
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: 10px;
  padding: 3px 7px;
  border: 1px solid rgba(26, 26, 26, 0.18);
  border-radius: 3px;
  color: #6B6357;
}
.sq-card-chip .sq-dots {
  font-family: 'Nunito Sans', sans-serif;
  letter-spacing: 0.12em;
  color: #6B6357;
}

/* ---------- Cancellation sub-flow (confirmation screen) ---------- */
.sq-cancel-link {
  display: inline-block;
  margin-top: 18px;
  font-family: 'Jost', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6B6357;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(107, 99, 87, 0.35);
  text-underline-offset: 4px;
  padding: 4px 6px;
}
.sq-cancel-link:hover {
  color: var(--ink, #1A1A1A);
  text-decoration-color: var(--gold, #C9A435);
}

.sq-cancel-panel {
  margin-top: 24px;
  padding: 22px 22px 20px;
  background: #FFFFFF;
  border: 1px solid var(--border, #E5DDD0);
  border-radius: 6px;
  text-align: left;
  font-family: 'Nunito Sans', sans-serif;
}
.sq-cancel-panel h5 {
  margin: 0 0 6px;
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink, #1A1A1A);
}
.sq-cancel-panel .sq-cancel-helper {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: #6B6357;
}
.sq-cancel-tier {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 14px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-family: 'Nunito Sans', sans-serif;
}
.sq-cancel-tier.tier-full { background: rgba(74, 103, 65, 0.08); border-left: 3px solid var(--forest, #4A6741); }
.sq-cancel-tier.tier-half { background: rgba(201, 164, 53, 0.10); border-left: 3px solid var(--gold, #C9A435); }
.sq-cancel-tier.tier-none { background: rgba(170, 51, 51, 0.06);  border-left: 3px solid #A33; }
.sq-cancel-tier .sq-tier-label {
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink, #1A1A1A);
}
.sq-cancel-tier .sq-tier-amt {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink, #1A1A1A);
}
.sq-cancel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sq-cancel-actions button {
  font-family: 'Jost', sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 11px 18px;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.sq-cancel-actions .sq-cancel-keep {
  background: transparent;
  color: var(--ink, #1A1A1A);
  border: 1px solid rgba(26, 26, 26, 0.2);
}
.sq-cancel-actions .sq-cancel-keep:hover {
  background: rgba(26, 26, 26, 0.04);
}
.sq-cancel-actions .sq-cancel-confirm {
  background: var(--ink, #1A1A1A);
  color: var(--cream, #FAF3EC);
  border: 1px solid var(--ink, #1A1A1A);
}
.sq-cancel-actions .sq-cancel-confirm:hover {
  background: #A33;
  border-color: #A33;
}
.sq-cancel-actions .sq-cancel-confirm.is-processing {
  opacity: 0.6;
  cursor: not-allowed;
}

.sq-cancel-done {
  margin-top: 20px;
  padding: 22px;
  background: rgba(74, 103, 65, 0.06);
  border-left: 3px solid var(--forest, #4A6741);
  border-radius: 0 6px 6px 0;
  text-align: left;
  font-family: 'Nunito Sans', sans-serif;
}
.sq-cancel-done h5 {
  margin: 0 0 6px;
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 18px;
  color: var(--ink, #1A1A1A);
}
.sq-cancel-done p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #4A4A4A;
}
.sq-cancel-done strong {
  color: var(--ink, #1A1A1A);
}

/* ---------- Saved cards (Card on File) picker ---------- */
.sq-saved {
  margin-bottom: 16px;
  padding: 16px 16px 12px;
  background: #FFFFFF;
  border: 1px solid var(--border, #E5DDD0);
  border-radius: 6px;
  font-family: 'Nunito Sans', sans-serif;
}
.sq-saved-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.sq-saved-title {
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink, #1A1A1A);
}
.sq-saved-hint {
  font-size: 11px;
  color: #6B6357;
}
.sq-saved-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sq-saved-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--cream, #FAF3EC);
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
  font-family: 'Nunito Sans', sans-serif;
  text-align: left;
  width: 100%;
}
.sq-saved-card:hover {
  border-color: rgba(74, 103, 65, 0.4);
}
.sq-saved-card.is-selected {
  border-color: var(--forest, #4A6741);
  background: rgba(74, 103, 65, 0.08);
}
.sq-saved-card .sq-saved-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(26, 26, 26, 0.3);
  flex-shrink: 0;
  position: relative;
  transition: border-color 0.18s ease;
}
.sq-saved-card.is-selected .sq-saved-radio {
  border-color: var(--forest, #4A6741);
}
.sq-saved-card.is-selected .sq-saved-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--forest, #4A6741);
}
.sq-saved-card .sq-saved-brand {
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6B6357;
  padding: 4px 8px;
  border: 1px solid rgba(26, 26, 26, 0.18);
  border-radius: 3px;
  flex-shrink: 0;
}
.sq-saved-card .sq-saved-num {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 600;
  letter-spacing: 0.1em;
  font-size: 14px;
  color: var(--ink, #1A1A1A);
  flex: 1;
}
.sq-saved-card .sq-saved-exp {
  font-size: 12px;
  color: #6B6357;
  font-variant-numeric: tabular-nums;
}
.sq-saved-or {
  margin: 14px 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Jost', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9A9080;
}
.sq-saved-or::before,
.sq-saved-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #E5DDD0);
}

.sq-save-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 14px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 13px;
  color: #4A4A4A;
  cursor: pointer;
  user-select: none;
}
.sq-save-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--forest, #4A6741);
  cursor: pointer;
}
.sq-save-toggle .sq-save-hint {
  color: #6B6357;
  font-size: 12px;
}

/* ---------- Digital wallets row (Apple Pay + Google Pay) ---------- */
.sq-wallets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.sq-wallets:empty {
  display: none;
}
.sq-wallet-btn {
  width: 100%;
  height: 50px;
  border-radius: 6px;
  border: 1px solid var(--ink, #1A1A1A);
  background: var(--ink, #1A1A1A);
  color: #FFFFFF;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  font-weight: 500;
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.18s ease;
}
.sq-wallet-btn:hover { opacity: 0.85; }
.sq-wallet-btn.is-google-pay {
  background: #FFFFFF;
  color: #3C4043;
  border-color: #DADCE0;
  padding: 0;
}
.sq-wallet-btn.is-google-pay > div { width: 100%; height: 100%; }
.sq-wallets-or {
  margin: 6px 0 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Jost', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9A9080;
}
.sq-wallets-or::before,
.sq-wallets-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #E5DDD0);
}

/* When using a saved card, hide the wallets row too */
.sq-pay-wrap.using-saved .sq-wallets,
.sq-pay-wrap.using-saved .sq-wallets-or { display: none; }


/* ========================================================================
   HOLD-SLOT UI
   ------------------------------------------------------------------------
   The booking flow locks a studio + time + duration on the backend the
   moment the customer hits step 6 (payment). Three states surface here:
     1. Loading  — request in flight, payment form disabled.
     2. Held     — banner with a live MM:SS countdown above the card form.
     3. Recover  — 409 conflict, expired hold, or backend error: the form
                   is replaced with a full-card explanation + "pick another
                   time" button that pops the user back to step 3.
   The Square card form sits in .sq-pay-wrap. .is-locked dims the form +
   wallets while the hold is loading or hasn't been acquired yet.
   ====================================================================== */

.sq-hold {
  margin: 0 0 16px;
  border-radius: 12px;
  font-family: 'Nunito Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* --- Loading: subtle, no chrome stealing focus from the card form --- */
.sq-hold-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(74, 103, 65, 0.06);
  border: 1px solid rgba(74, 103, 65, 0.18);
  color: var(--forest, #4A6741);
}
.sq-hold-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--forest, #4A6741);
  animation: sq-hold-pulse 1.1s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes sq-hold-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.1); }
}
.sq-hold-label {
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* --- Held: gold-accent banner with the live countdown --- */
.sq-hold-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(201, 164, 53, 0.10);
  border: 1px solid rgba(201, 164, 53, 0.45);
  border-left-width: 3px;
}
.sq-hold-banner .sq-hold-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(201, 164, 53, 0.22);
  color: #8E7320;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 14px;
}
.sq-hold-banner .sq-hold-text {
  flex: 1;
  min-width: 0;
}
.sq-hold-banner .sq-hold-headline {
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8E7320;
  margin-bottom: 2px;
}
.sq-hold-banner .sq-hold-helper {
  margin: 0;
  color: #1A1A1A;
  font-size: 13px;
}
.sq-hold-banner .sq-hold-countdown {
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #1A1A1A;
  font-variant-numeric: tabular-nums;
  background: #FFF;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(201, 164, 53, 0.45);
  flex-shrink: 0;
  min-width: 72px;
  text-align: center;
}

/* --- Recover: replaces the entire card form on conflict / expiry --- */
.sq-hold-recover {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 22px;
  background: #FFF;
  border: 1px solid var(--border, #E5DDD0);
  border-radius: 12px;
  text-align: left;
}
.sq-hold-recover .sq-hold-headline {
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  color: #1A1A1A;
}
.sq-hold-recover .sq-hold-helper {
  margin: 0;
  color: #4A4438;
  font-size: 14px;
}
.sq-hold-retry {
  margin-top: 6px;
  appearance: none;
  border: 1px solid var(--forest, #4A6741);
  background: var(--forest, #4A6741);
  color: #FAF3EC;
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 12px 22px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease;
}
.sq-hold-retry:hover { background: #3D5636; }
.sq-hold-retry:active { transform: translateY(1px); }

/* When the hold isn't yet acquired, dim + disable the payment form so
   the customer can't tokenize a card against a slot that isn't locked.
   Visual cue only — pointer-events:none is the actual block. */
.sq-pay-wrap.is-hold-blocked .sq-card-frame,
.sq-pay-wrap.is-hold-blocked .sq-wallets,
.sq-pay-wrap.is-hold-blocked .sq-saved {
  opacity: 0.45;
  pointer-events: none;
  filter: saturate(0.6);
}
.sq-pay-wrap.is-hold-blocked .sq-pay-cta {
  background: #B5AD9F;
  border-color: #B5AD9F;
  cursor: not-allowed;
}
.sq-pay-wrap.is-hold-blocked .sq-pay-cta:hover { background: #B5AD9F; }


/* ========================================================================
   DOOR-CODE CARD (confirmation step)
   ------------------------------------------------------------------------
   Mirrors the gold-bordered block in the branded confirmation email.
   Only renders when the backend returned a code (always on success in v1).
   ====================================================================== */

.sq-doorcode {
  margin: 18px auto 22px;
  max-width: 420px;
  padding: 22px 26px;
  border: 2px solid rgba(201, 164, 53, 0.55);
  background: linear-gradient(180deg, #FFFDF6 0%, #FBF4DD 100%);
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 6px 24px -12px rgba(201, 164, 53, 0.45);
}
.sq-doorcode-eye {
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8E7320;
  margin-bottom: 8px;
}
.sq-doorcode-num {
  font-family: 'Jost', sans-serif;
  font-weight: 700;
  font-size: 38px;
  letter-spacing: 0.18em;
  color: #1A1A1A;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
  line-height: 1.05;
}
.sq-doorcode-helper {
  font-family: 'Nunito Sans', sans-serif;
  font-size: 12px;
  line-height: 1.5;
  color: #6B6357;
  margin: 0;
}

@media (max-width: 480px) {
  .sq-hold-banner { flex-wrap: wrap; }
  .sq-hold-banner .sq-hold-countdown { order: 3; margin-top: 8px; }
  .sq-doorcode-num { font-size: 32px; letter-spacing: 0.14em; }
}
