/*
 * PSHH Booking Lite - front wizard styles.
 * Mobile first, RTL, one accent color (--pbl-accent, set from settings on the
 * wizard root), neutral greys otherwise. No gradients. System font. 8px radius.
 */

.pbl-wizard {
  --pbl-accent: #2563eb;
  --pbl-text: #1f2937; --pbl-muted: #6b7280; --pbl-border: #e5e7eb;
  --pbl-bg: #fff; --pbl-bg-soft: #f3f4f6; --pbl-disabled: #d1d5db;
  --pbl-error: #b91c1c; --pbl-error-bg: #fef2f2;
  --pbl-radius: 8px; --pbl-tap: 44px;
  box-sizing: border-box; direction: rtl; text-align: right;
  width: 100%; max-width: 640px; margin: 0 auto; padding: 16px;
  color: var(--pbl-text); background: var(--pbl-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Hebrew", sans-serif;
  font-size: 16px; line-height: 1.5;
}
.pbl-wizard *, .pbl-wizard *::before, .pbl-wizard *::after { box-sizing: inherit; }
.pbl-wizard button { font: inherit; color: inherit; cursor: pointer; }
.pbl-wizard button:disabled { cursor: not-allowed; }
.pbl-wizard.is-busy { opacity: 0.85; }

/* Visible focus ring on every control. */
.pbl-wizard button:focus-visible, .pbl-wizard a:focus-visible,
.pbl-wizard input:focus-visible, .pbl-wizard textarea:focus-visible {
  outline: 3px solid var(--pbl-accent); outline-offset: 2px;
}

/* ---------- progress bar ---------- */
.pbl-progress { display: flex; align-items: flex-start; margin: 0 0 20px; padding: 0; overflow: hidden; }
.pbl-progress__step {
  flex: 1 1 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12px; color: var(--pbl-muted);
}
/* Connector line between steps (drawn to the right of each step, RTL). */
.pbl-progress__step + .pbl-progress__step::before {
  content: ""; position: absolute; top: 13px; left: 50%; width: 100%; height: 2px; background: var(--pbl-border);
}
.pbl-progress__step.is-done + .pbl-progress__step::before { background: var(--pbl-accent); }
.pbl-progress__dot {
  position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--pbl-border); background: var(--pbl-bg);
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.pbl-progress__step.is-active { color: var(--pbl-text); font-weight: 600; }
.pbl-progress__step.is-active .pbl-progress__dot { border-color: var(--pbl-accent); color: var(--pbl-accent); }
.pbl-progress__step.is-done .pbl-progress__dot { border-color: var(--pbl-accent); background: var(--pbl-accent); color: #fff; }

/* ---------- head: back button + title ---------- */
.pbl-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.pbl-back {
  flex: 0 0 auto; min-height: var(--pbl-tap); padding: 0 12px; font-size: 14px;
  border: 1px solid var(--pbl-border); border-radius: var(--pbl-radius); background: var(--pbl-bg);
}
.pbl-back:hover { background: var(--pbl-bg-soft); }
.pbl-back[hidden], .pbl-error[hidden] { display: none; }
.pbl-title { flex: 1 1 auto; margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
.pbl-title:focus { outline: none; }

/* ---------- messages ---------- */
.pbl-error {
  margin: 0 0 12px; padding: 10px 12px; font-size: 14px;
  border: 1px solid #fecaca; border-radius: var(--pbl-radius); background: var(--pbl-error-bg); color: var(--pbl-error);
}
.pbl-loading, .pbl-empty, .pbl-hint { margin: 12px 0; color: var(--pbl-muted); font-size: 14px; }
.pbl-loading { text-align: center; padding: 24px 0; }

/* ---------- generic buttons ---------- */
.pbl-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 10px 16px;
  border: 1px solid var(--pbl-border); border-radius: var(--pbl-radius); background: var(--pbl-bg);
  font-size: 16px; font-weight: 600; text-decoration: none; color: var(--pbl-text);
}
.pbl-btn--primary { background: var(--pbl-accent); border-color: var(--pbl-accent); color: #fff; font-weight: 700; text-shadow: 0 1px 0 rgba(0,0,0,.18); }
.pbl-btn--primary:hover:not(:disabled) { filter: brightness(0.92); }
.pbl-btn--ghost:hover { background: var(--pbl-bg-soft); }
.pbl-btn:disabled { opacity: 0.55; }
.pbl-wizard.is-busy .pbl-btn--primary:disabled { opacity: 1; filter: saturate(0.6); }
.pbl-link {
  border: 0; background: none; padding: 10px; min-height: var(--pbl-tap);
  color: var(--pbl-accent); text-decoration: underline; font-size: 15px;
}

/* ---------- screen 1: services ---------- */
.pbl-services { display: grid; gap: 10px; }
.pbl-service {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 12px 14px; text-align: right;
  border: 1px solid var(--pbl-border); border-radius: var(--pbl-radius); background: var(--pbl-bg);
}
.pbl-service:hover { border-color: var(--pbl-muted); }
.pbl-service.is-selected { border-color: var(--pbl-accent); box-shadow: inset 0 0 0 1px var(--pbl-accent); }
.pbl-service__swatch { flex: 0 0 auto; width: 10px; height: 36px; border-radius: 4px; background: var(--pbl-border); }
.pbl-service__main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.pbl-service__name { font-weight: 600; }
.pbl-service__desc { font-size: 13px; color: var(--pbl-muted); }
.pbl-service__meta { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; color: var(--pbl-muted); }
.pbl-service__price { font-weight: 600; color: var(--pbl-text); }

/* ---------- screen 2: calendar ---------- */
.pbl-cal__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pbl-cal__month { font-weight: 600; }
.pbl-cal__arrow {
  width: var(--pbl-tap); height: var(--pbl-tap); font-size: 24px; line-height: 1;
  border: 1px solid var(--pbl-border); border-radius: var(--pbl-radius); background: var(--pbl-bg);
}
.pbl-cal__arrow:hover:not(:disabled) { background: var(--pbl-bg-soft); }
.pbl-cal__arrow:disabled { color: var(--pbl-disabled); }
.pbl-cal__row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; }
.pbl-cal__dow { text-align: center; font-size: 13px; font-weight: 600; color: var(--pbl-muted); padding: 4px 0; }
.pbl-cal__cell { min-width: 0; }
.pbl-day {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: var(--pbl-tap); padding: 4px 2px; line-height: 1.2;
  border: 1px solid var(--pbl-border); border-radius: var(--pbl-radius); background: var(--pbl-bg);
}
.pbl-day:hover:not(:disabled) { border-color: var(--pbl-accent); }
.pbl-day__num { font-weight: 600; font-size: 15px; }
/* Tiny holiday label under the day number; major holidays slightly stronger. */
.pbl-day__hol {
  display: block; max-width: 100%; font-size: 9px; color: var(--pbl-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pbl-day.has-holiday--major .pbl-day__hol { color: var(--pbl-text); font-weight: 600; }
.pbl-day.is-today { outline: 2px solid var(--pbl-muted); outline-offset: -2px; }
.pbl-day.is-today:focus-visible { outline-color: var(--pbl-accent); outline-offset: 2px; }
.pbl-day.is-selected { background: var(--pbl-accent); border-color: var(--pbl-accent); color: #fff; }
.pbl-day.is-selected .pbl-day__hol { color: #fff; }
.pbl-day:disabled { background: var(--pbl-bg-soft); border-color: transparent; color: var(--pbl-disabled); }
.pbl-day:disabled .pbl-day__hol { color: var(--pbl-disabled); }

/* ---------- screen 3: slots ---------- */
.pbl-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pbl-slot {
  min-height: var(--pbl-tap); font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr;
  border: 1px solid var(--pbl-border); border-radius: var(--pbl-radius); background: var(--pbl-bg);
}
.pbl-slot:hover { border-color: var(--pbl-accent); }
.pbl-slot.is-selected { background: var(--pbl-accent); border-color: var(--pbl-accent); color: #fff; }

/* ---------- screen 4: details form ---------- */
.pbl-form { display: grid; gap: 14px; position: relative; }
.pbl-field { display: flex; flex-direction: column; gap: 4px; }
.pbl-field label { font-size: 14px; font-weight: 600; }
.pbl-field input, .pbl-field textarea {
  width: 100%; min-height: var(--pbl-tap); padding: 10px 12px; font: inherit; font-size: 16px; /* 16px stops iOS zoom */
  border: 1px solid var(--pbl-border); border-radius: var(--pbl-radius); background: var(--pbl-bg); color: var(--pbl-text);
}
.pbl-field textarea { resize: vertical; min-height: 80px; }
.pbl-field input[dir="ltr"] { text-align: left; }
.pbl-field.has-error input, .pbl-field.has-error textarea { border-color: var(--pbl-error); }
.pbl-field__err { font-size: 13px; color: var(--pbl-error); }
.pbl-field__err:empty { display: none; }
.pbl-summary {
  margin: 4px 0 0; padding: 10px 12px; font-size: 14px; font-weight: 600;
  border-radius: var(--pbl-radius); background: var(--pbl-bg-soft);
}

/* ---------- success ---------- */
.pbl-success { text-align: center; }
.pbl-success__icon {
  width: 56px; height: 56px; margin: 8px auto 12px; border-radius: 50%;
  background: var(--pbl-accent); color: #fff; font-size: 30px; line-height: 56px;
}
.pbl-success__lead { margin: 0 0 16px; color: var(--pbl-muted); }
.pbl-card { margin: 0 0 16px; padding: 4px 14px; text-align: right; border: 1px solid var(--pbl-border); border-radius: var(--pbl-radius); }
.pbl-card__row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--pbl-border); }
.pbl-card__row:last-child { border-bottom: 0; }
.pbl-card dt { color: var(--pbl-muted); font-size: 14px; }
.pbl-card dd { margin: 0; font-weight: 600; }
.pbl-success__actions { display: grid; gap: 10px; }

/* ---------- manage mode (/?pbl_manage=TOKEN) ---------- */
.pbl-progress[hidden] { display: none; }
.pbl-manage__actions { display: grid; gap: 10px; }
.pbl-btn--danger { color: var(--pbl-error); border-color: #fecaca; }
.pbl-btn--danger:hover:not(:disabled) { background: var(--pbl-error-bg); }
/* Inline cancel confirmation (no window.confirm). */
.pbl-confirm {
  padding: 12px 14px; border: 1px solid #fecaca; border-radius: var(--pbl-radius); background: var(--pbl-error-bg);
}
.pbl-confirm[hidden] { display: none; }
.pbl-confirm p { margin: 0 0 10px; font-size: 14px; }
.pbl-confirm__btns { display: grid; gap: 8px; }
.pbl-confirm .pbl-btn--danger { background: var(--pbl-error); border-color: var(--pbl-error); color: #fff; }
.pbl-flash {
  margin: 0 0 12px; padding: 10px 12px; font-size: 14px; font-weight: 600;
  border: 1px solid #bbf7d0; border-radius: var(--pbl-radius); background: #f0fdf4; color: #166534;
}

/* ---------- wider screens ---------- */
@media (min-width: 601px) {
  .pbl-wizard { padding: 24px; border: 1px solid var(--pbl-border); border-radius: var(--pbl-radius); }
  .pbl-progress__step { font-size: 13px; }
  .pbl-title { font-size: 22px; }
  .pbl-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .pbl-day__hol { font-size: 10px; }
  .pbl-btn { width: auto; min-width: 200px; }
  .pbl-form .pbl-btn { justify-self: start; }
  .pbl-success__actions, .pbl-manage__actions { justify-items: center; }
  .pbl-confirm__btns { grid-template-columns: 1fr 1fr; }
  .pbl-manage__actions .pbl-confirm { width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .pbl-day, .pbl-slot, .pbl-service, .pbl-btn { transition: border-color 0.15s ease, background-color 0.15s ease; }
}

/* ── Popup mode: button + modal (opened by any [data-pbl-open]) ─────── */
.pbl-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--pbl-accent, #2563eb); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.pbl-btn:hover { filter: brightness(0.92); }
.pbl-btn:focus-visible { outline: 3px solid var(--pbl-accent, #2563eb); outline-offset: 3px; }
.pbl-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: flex-end; justify-content: center; }
.pbl-modal[hidden] { display: none; }
.pbl-modal__backdrop { position: absolute; inset: 0; background: rgba(17, 24, 39, 0.55); }
.pbl-modal__box { position: relative; width: 100%; max-height: 92vh; overflow: auto; background: #fff; border-radius: 16px 16px 0 0; padding: 48px 16px 24px; -webkit-overflow-scrolling: touch; }
.pbl-modal__box .pbl-wizard { border: 0; padding: 0; }
.pbl-modal__close { position: absolute; top: 10px; left: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #f3f4f6; font-size: 18px; cursor: pointer; }
.pbl-modal__close:focus-visible { outline: 3px solid var(--pbl-accent, #2563eb); }
body.pbl-modal-open { overflow: hidden; }
@media (min-width: 640px) {
  .pbl-modal { align-items: center; padding: 24px; }
  .pbl-modal__box { max-width: 560px; border-radius: 16px; padding: 56px 28px 28px; }
}

/* ---------- verify step + contact bar ---------- */
.pbl-verify__lead { margin: 0 0 14px; font-size: 15px; line-height: 1.5; }
.pbl-code { font-size: 26px; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.pbl-link { display: block; margin: 12px auto 0; background: none; border: 0; padding: 8px; color: var(--pbl-accent); text-decoration: underline; cursor: pointer; font: inherit; min-height: var(--pbl-tap); }
.pbl-link:disabled { color: var(--pbl-muted); text-decoration: none; cursor: default; }
.pbl-contact { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px; margin: 18px 0 0; padding: 12px 14px; border-top: 1px solid var(--pbl-border, #e5e7eb); font-size: 14px; color: var(--pbl-muted, #6b7280); direction: rtl; }
.pbl-contact__link { color: var(--pbl-accent, #2563eb); font-weight: 600; text-decoration: underline; min-height: var(--pbl-tap, 44px); display: inline-flex; align-items: center; padding: 0 4px; }
.pbl-contact__link:focus-visible { outline: 3px solid var(--pbl-accent, #2563eb); outline-offset: 2px; border-radius: 4px; }
.pbl-modal__box .pbl-contact { margin-top: 20px; }
@media (max-width: 639px) { .pbl-modal__box { padding-bottom: 80px; } }
.pbl-hp { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; top: 0; right: 0; }

/* ---------- accessibility: explicit colors with enough specificity so host-page rules (a:hover etc.) cannot leak in ---------- */
.pbl-wizard .pbl-btn--ghost, .pbl-wizard a.pbl-btn--ghost, .pbl-modal a.pbl-btn--ghost {
  background: var(--pbl-bg); border: 2px solid var(--pbl-accent); color: var(--pbl-accent); font-weight: 700; text-decoration: none;
}
.pbl-wizard .pbl-btn--ghost:hover, .pbl-wizard a.pbl-btn--ghost:hover, .pbl-modal a.pbl-btn--ghost:hover {
  background: var(--pbl-accent); color: #fff; filter: none;
}
.pbl-wizard .pbl-btn--primary:hover:not(:disabled), .pbl-wizard .pbl-btn--primary:focus-visible {
  background: var(--pbl-accent); color: #fff; filter: brightness(0.85); text-decoration: none;
}
.pbl-wizard .pbl-back { border: 2px solid var(--pbl-accent); color: var(--pbl-accent); background: var(--pbl-bg); font-weight: 700; }
.pbl-wizard .pbl-back:hover { background: var(--pbl-accent); color: #fff; }
.pbl-wizard .pbl-link, .pbl-wizard a.pbl-link, .pbl-wizard .pbl-link:hover { color: var(--pbl-accent); background: none; }
.pbl-wizard .pbl-contact__link, .pbl-modal .pbl-contact__link { color: var(--pbl-accent); background: none; }
.pbl-wizard .pbl-contact__link:hover, .pbl-modal .pbl-contact__link:hover { color: var(--pbl-accent); background: var(--pbl-bg-soft); text-decoration: underline; border-radius: 4px; }
.pbl-modal__close { background: #f3f4f6; color: #1f2937; }
.pbl-modal__close:hover { background: var(--pbl-accent); color: #fff; }
.pbl-wizard *:focus-visible { outline: 3px solid var(--pbl-accent); outline-offset: 2px; }
