/* ==========================================================================
   checkout.css — składanie zamówienia, płatność (demo), potwierdzenie
   ========================================================================== */

/* W trakcie składania zamówienia chowamy dolne zakładki — mniej rozpraszaczy */
.tabbar { transition: transform 0.3s var(--ease-out); }
.in-flow .tabbar { transform: translateY(110%); }
.in-flow .view-root { padding-bottom: calc(var(--safe-bottom) + 110px); }
.in-flow .toast-root { bottom: calc(var(--safe-bottom) + 92px); }

/* --- Nagłówek kroku --- */
.flow-header {
  position: sticky;
  top: var(--safe-top);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
}
.flow-title h1 { font-size: 22px; }
.flow-title span { font-size: 13px; color: var(--text-muted); }
.flow-progress {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.flow-progress span { display: block; height: 100%; background: var(--brand); border-radius: 2px; transition: width 0.4s var(--ease-out); }

/* --- Dolny pasek z przyciskiem --- */
.flow-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 12px var(--gutter) calc(12px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  animation: fade-in 0.3s ease;
}
.flow-bar .btn { max-width: calc(var(--content-max) - 2 * var(--gutter)); margin: 0 auto; display: flex; }

/* --- Sekcje formularza --- */
.form-section { padding: 18px var(--gutter) 0; }
.form-section > h2, .section-row h2 { font-size: 18px; margin-bottom: 12px; }
.section-row { display: flex; justify-content: space-between; align-items: baseline; }
.section-row a { font-size: 14px; font-weight: 600; color: var(--brand); }

.notice {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff4d6;
  color: #7a5200;
  font-size: 14px;
  line-height: 1.4;
}
.notice svg { flex: none; }

/* Tryb odbioru: jak najszybciej / na godzinę */
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s var(--ease-out);
}
.mode-card:active { transform: scale(0.97); }
.mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.mode-card strong { margin-top: 6px; font-size: 15px; }
.mode-card > span:last-child { font-size: 13px; color: var(--text-muted); }
.mode-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.mode-icon svg { width: 20px; height: 20px; }
.mode-card:has(input:checked) { border-color: var(--brand); background: var(--brand-softer); box-shadow: 0 0 0 1px var(--brand) inset; }
.mode-card:has(input:checked) .mode-icon { background: var(--brand); color: var(--brand-contrast); }

/* Wybór godziny */
.slot-picker { margin-top: 14px; }
.day-tabs { display: flex; gap: 6px; padding: 4px; margin-bottom: 12px; border-radius: 12px; background: color-mix(in srgb, var(--text) 6%, transparent); }
.day-tab { flex: 1; height: 36px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-muted); transition: background-color 0.2s, color 0.2s; }
.day-tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.day-single { margin-bottom: 10px; font-weight: 650; }
.slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.slot {
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.18s, border-color 0.18s, color 0.18s, transform 0.15s var(--ease-out);
}
.slot:active { transform: scale(0.94); }
.slot.is-selected { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }

/* --- Pola formularza --- */
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.field .optional { font-weight: 400; color: var(--text-faint); }
.field input, .field textarea, .blik-input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 16px; /* 16px — iOS nie przybliża strony przy wejściu w pole */
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { resize: none; line-height: 1.4; }
.field input:focus, .field textarea:focus, .blik-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent);
}
.input-group { display: flex; }
.input-prefix {
  display: grid;
  place-items: center;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-right: 0;
  border-radius: 14px 0 0 14px;
  background: color-mix(in srgb, var(--text) 4%, var(--surface));
  font-weight: 600;
  color: var(--text-muted);
}
.input-group input { border-radius: 0 14px 14px 0; }
.field-hint { margin-top: 6px; font-size: 13px; color: var(--text-muted); }
.field-error { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--danger); }
.field-error:empty { display: none; }
.has-error input, .has-error .input-prefix, .blik-input.has-error { border-color: var(--danger); }
.has-error { animation: shake 0.35s ease; }
@keyframes shake {
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

/* --- Podsumowanie zamówienia --- */
.order-summary {
  padding: 6px 16px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.order-summary li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.os-qty { flex: none; min-width: 26px; font-weight: 700; color: var(--brand); }
.os-name { flex: 1; min-width: 0; }
.os-name small { display: block; font-size: 13px; color: var(--text-muted); }
.os-price { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pickup-pill-flat { margin: 12px 0 0; }

/* --- Płatność --- */
.demo-banner {
  display: flex;
  gap: 10px;
  margin: 14px var(--gutter) 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: repeating-linear-gradient(-45deg, #fff4d6, #fff4d6 12px, #ffedbf 12px, #ffedbf 24px);
  border: 1px solid #f5d98b;
  color: #6b4700;
  font-size: 13.5px;
  line-height: 1.4;
}
.demo-banner svg { flex: none; margin-top: 1px; }
.demo-banner strong { display: block; font-size: 14px; text-transform: uppercase; letter-spacing: 0.03em; }

.pay-amount { padding: 22px var(--gutter) 4px; text-align: center; }
.pay-amount > span { font-size: 14px; color: var(--text-muted); }
.pay-amount strong { display: block; font-size: 40px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.pay-amount p { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 14px; color: var(--text-muted); }

.method-list { display: grid; gap: 10px; }
.method { border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); border: 1.5px solid transparent; transition: border-color 0.2s; }
.method:has(input:checked) { border-color: var(--brand); }
.method-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; }
.method-card input { position: absolute; opacity: 0; pointer-events: none; }
.method-text { flex: 1; display: flex; flex-direction: column; }
.method-text strong { font-size: 15.5px; }
.method-text span { font-size: 13px; color: var(--text-muted); }
.pay-logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 34px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--text);
}
.pay-logo-blik { background: #1a1a1a; color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -0.02em; font-style: italic; }
.radio-dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--text) 25%, transparent); transition: border 0.2s; }
.method-card input:checked ~ .radio-dot { border: 7px solid var(--brand); }
.method-detail { padding: 0 14px 14px; animation: fade-in 0.25s ease; }
.blik-input {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
  min-height: 60px;
}
.blik-input::placeholder { color: color-mix(in srgb, var(--text) 20%, transparent); }
.method-note { display: flex; gap: 8px; font-size: 13.5px; color: var(--text-muted); line-height: 1.4; }
.method-note svg { flex: none; color: var(--success); margin-top: 1px; }

/* Nakładka symulowanej płatności */
.pay-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fade-in 0.25s ease;
}
.pay-overlay.is-leaving { animation: fade-out 0.25s ease both; }
.pay-box { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.pay-step { animation: view-in 0.35s var(--ease-out) both; }
.pay-box h2 { font-size: 21px; margin-top: 8px; }
.pay-box p { color: var(--text-muted); font-size: 15px; }
.pay-box .btn { margin-top: 14px; }
.pay-spinner { width: 54px; height: 54px; border-radius: 50%; border: 4px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
.pay-phone { position: relative; display: grid; place-items: center; width: 96px; height: 96px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); color: var(--brand); }
.pay-ping { position: absolute; inset: -6px; border-radius: 32px; border: 2px solid var(--brand); animation: ping 1.4s ease-out infinite; }
@keyframes ping { from { transform: scale(0.9); opacity: 0.8; } to { transform: scale(1.25); opacity: 0; } }
.pay-progress { width: 100%; height: 6px; margin-top: 10px; border-radius: 3px; background: var(--brand-soft); overflow: hidden; }
.pay-progress span { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 3px; animation: progress 3.2s linear forwards; }
.pay-progress-fast span { animation-duration: 1.8s; }
@keyframes progress { to { width: 100%; } }
.pay-demo { font-size: 12px !important; font-weight: 700; letter-spacing: 0.04em; color: #8a5a00 !important; }

.success-mark { width: 88px; height: 88px; }
.success-mark circle { fill: color-mix(in srgb, var(--success) 12%, transparent); stroke: var(--success); stroke-width: 2.5; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 0.6s var(--ease-out) forwards; }
.success-mark path { fill: none; stroke: var(--success); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw 0.4s var(--ease-out) 0.45s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.fail-mark { display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); animation: art-pop 0.45s var(--ease-spring) both; }

/* --- Potwierdzenie zamówienia --- */
.order-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: calc(var(--safe-top) + 36px) var(--gutter) 6px; }
.order-done h1 { margin-top: 10px; font-size: 26px; }
.order-done > p { color: var(--text-muted); }
.order-number { display: flex; flex-direction: column; align-items: center; margin-top: 14px; padding: 14px 32px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.order-number span, .order-number small { font-size: 12.5px; color: var(--text-muted); }
.order-number strong { font-size: 44px; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; color: var(--brand); font-variant-numeric: tabular-nums; }
.order-facts { margin: 0; }
.order-facts > div { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.order-facts > div:last-child { border-bottom: 0; }
.order-facts svg { flex: none; width: 22px; height: 22px; color: var(--brand); }
.order-facts strong { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.order-note { display: flex; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--text-muted); }
.order-note svg { flex: none; }
