/* ============================================================
   IGNITE — Checkout
   ============================================================ */

body { background: var(--bg-alt); }
[hidden] { display: none !important; }

/* ============ HEADER ============ */
.checkout-header {
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 100;
}
.checkout-header__row {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
}
.checkout-header__secure {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.checkout-header__secure svg { width: 17px; height: 17px; fill: none; stroke: var(--accent-dark); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ============ LAYOUT ============ */
.checkout-page { padding: 40px 0 100px; }
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 48px;
  align-items: start;
}
.checkout-layout.is-paying {
  grid-template-columns: 1fr;
  max-width: 480px;
  margin: 0 auto;
}
.checkout-layout.is-paying .checkout-summary { display: none; }
.checkout-title {
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 900; letter-spacing: -.02em;
  margin: 0 0 28px;
}

/* ============ STEP INDICATOR ============ */
.checkout-steps {
  display: flex; align-items: center;
  list-style: none; margin: 0 0 32px; padding: 0;
}
.checkout-steps__item { display: flex; align-items: center; gap: 10px; }
.checkout-steps__dot {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
  background: var(--bg-alt); border: 1.5px solid var(--line); color: var(--muted-2);
  transition: all .3s var(--ease);
  flex-shrink: 0;
}
.checkout-steps__label {
  font-size: 13px; font-weight: 700; color: var(--muted-2);
  white-space: nowrap;
  transition: color .3s;
}
.checkout-steps__line {
  flex: 1; height: 2px; background: var(--line); margin: 0 12px;
  min-width: 24px;
  transition: background .3s;
}
.checkout-steps__item.is-active .checkout-steps__dot,
.checkout-steps__item.is-done .checkout-steps__dot {
  background: var(--fg); border-color: var(--fg); color: #fff;
}
.checkout-steps__item.is-active .checkout-steps__label,
.checkout-steps__item.is-done .checkout-steps__label { color: var(--fg); }
.checkout-steps__line.is-done { background: var(--fg); }

/* ============ FORM CARDS ============ */
.checkout-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  transition: border-color .3s, opacity .3s;
  overflow: hidden;
}
.checkout-card__head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px;
}
.checkout-card__num {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 800;
  background: var(--bg-alt); color: var(--muted-2);
  border: 1.5px solid var(--line);
  flex-shrink: 0;
  transition: all .3s;
}
.checkout-card__head h2 { font-size: 17px; font-weight: 800; margin: 0; color: var(--muted-2); transition: color .3s; }
.checkout-card__edit {
  margin-left: auto; background: none; border: none;
  font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--fg); text-decoration: underline; text-underline-offset: 2px;
  display: none;
}
.checkout-card__body { display: none; padding: 0 24px 24px; }
.checkout-card__summary { display: none; padding: 0 24px 20px; font-size: 14px; color: var(--muted); }
.checkout-card__summary strong { color: var(--fg); }

/* -- active state -- */
.checkout-card.is-active { border-color: var(--fg); }
.checkout-card.is-active .checkout-card__num { background: var(--fg); border-color: var(--fg); color: #fff; }
.checkout-card.is-active .checkout-card__head h2 { color: var(--fg); }
.checkout-card.is-active .checkout-card__body { display: block; }

/* -- done state (collapsed with summary) -- */
.checkout-card.is-done .checkout-card__num { background: var(--fg); border-color: var(--fg); color: #fff; }
.checkout-card.is-done .checkout-card__head h2 { color: var(--fg); }
.checkout-card.is-done .checkout-card__edit { display: inline-block; }
.checkout-card.is-done .checkout-card__summary { display: block; }

/* -- disabled / upcoming state -- */
.checkout-card.is-disabled { background: var(--bg-alt); }

/* ============ FIELDS ============ */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin-bottom: 6px;
}
.field input {
  width: 100%; padding: 13px 14px;
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 14.5px; font-family: inherit; color: var(--fg);
  transition: border-color .2s;
}
.field input::placeholder { color: var(--muted-2); }
.field input:focus { outline: none; border-color: var(--fg); }
.field input.invalid { border-color: var(--danger); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.field-row .field { margin-bottom: 0; }
.field-row .field--sm { max-width: 140px; }

/* ============ OPTION CARDS (shipping / payment) ============ */
.option-group { display: flex; flex-direction: column; gap: 10px; }
.option-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.option-card:hover { border-color: var(--muted-2); }
.option-card.selected { border-color: var(--accent-dark); background: var(--accent-soft); }
.option-card input[type="radio"] { accent-color: var(--accent-dark); width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; }
.option-card__info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.option-card__info strong { font-size: 14.5px; font-weight: 700; }
.option-card__info small { display: block; font-size: 12.5px; color: var(--muted); white-space: normal; }

/* linha de título + preço lado a lado, descrição embaixo — usado nas opções de frete */
.option-card__main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.option-card__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.option-card__top strong { font-size: 14.5px; font-weight: 700; }
.option-card__main small { display: block; font-size: 12.5px; color: var(--muted); white-space: normal; }
.option-card__price { font-size: 14px; font-weight: 800; white-space: nowrap; flex-shrink: 0; }

.option-card__icon { height: 22px; width: auto; flex-shrink: 0; }
.option-card__icon--card {
  width: 34px; height: 24px; border-radius: 5px;
  background: var(--bg-alt); display: flex; align-items: center; justify-content: center;
}
.option-card__icon--card svg { width: 18px; height: 18px; fill: none; stroke: var(--fg); stroke-width: 1.6; }

.option-card--disabled { cursor: not-allowed; opacity: .5; }
.option-card--disabled:hover { border-color: var(--line); }

/* ============ CTA ============ */
.checkout-cta { width: 100%; margin-top: 8px; }
.checkout-cta svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.checkout-cta:disabled { cursor: wait; }

/* ============ PIX PAYMENT PANEL ============ */
.checkout-pix {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 32px 28px;
  animation: pixPanelIn .4s var(--ease);
}
@keyframes pixPanelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.checkout-pix__header { text-align: center; margin-bottom: 24px; }
.checkout-pix__icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.checkout-pix__icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.checkout-pix__header h1 { font-size: 20px; font-weight: 900; letter-spacing: -.01em; margin: 0 0 6px; }
.checkout-pix__header p { font-size: 13.5px; color: var(--muted); margin: 0; }

.checkout-pix__amount-box {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg-alt); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 24px;
}
.checkout-pix__amount-box span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.checkout-pix__amount-box strong { font-size: 26px; font-weight: 900; letter-spacing: -.01em; }

.checkout-pix__qr-wrap { display: flex; justify-content: center; margin-bottom: 20px; }
.checkout-pix__qr {
  display: block; width: 200px; height: 200px; object-fit: contain;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; box-shadow: 0 12px 28px -16px rgba(0,0,0,0.18);
}

.checkout-pix__divider {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 20px; color: var(--muted-2); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.checkout-pix__divider::before, .checkout-pix__divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.checkout-pix__code-label {
  display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin-bottom: 6px;
}
.checkout-pix__code { display: flex; gap: 10px; margin-bottom: 20px; }
.checkout-pix__code input {
  flex: 1; min-width: 0; padding: 13px 14px;
  background: var(--bg-alt); border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 13px; color: var(--fg); font-family: inherit;
}

.checkout-pix__copy {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px;
  padding: 0 18px; border-radius: 10px; border: none;
  background: var(--fg); color: #fff; font-weight: 700; font-size: 13.5px;
  transition: background .2s, transform .15s;
}
.checkout-pix__copy:hover { transform: translateY(-1px); }
.checkout-pix__copy:active { transform: translateY(0); }
.checkout-pix__copy svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.checkout-pix__copy .icon-check { display: none; }
.checkout-pix__copy.is-copied { background: var(--accent-dark); }
.checkout-pix__copy.is-copied .icon-copy { display: none; }
.checkout-pix__copy.is-copied .icon-check { display: block; }

.checkout-pix__steps {
  display: flex; flex-direction: column; gap: 8px;
  margin: 0 0 22px; padding: 16px 16px 16px 36px;
  background: var(--bg-alt); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--muted);
}
.checkout-pix__steps li { padding-left: 4px; }
.checkout-pix__steps li::marker { font-weight: 800; color: var(--fg); }

.checkout-pix__status {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted);
  padding: 14px; background: var(--bg-alt); border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.checkout-pix__status-text { display: flex; flex-direction: column; gap: 2px; }
.checkout-pix__status-text strong { font-size: 13.5px; font-weight: 700; color: var(--fg); }
.checkout-pix__status-text small { color: var(--muted); }
.checkout-pix__status--error { color: var(--danger); background: #fdeceb; }
.checkout-pix__status--error a { color: var(--danger); font-weight: 800; text-decoration: underline; }
.checkout-pix__spinner {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2.5px solid var(--line); border-top-color: var(--accent-dark);
  animation: pixSpin .8s linear infinite;
}
@keyframes pixSpin { to { transform: rotate(360deg); } }
.checkout-pix__check {
  width: 100%; padding: 14px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff; color: var(--fg);
  font-weight: 700; font-size: 13.5px; transition: border-color .2s, background .2s;
}
.checkout-pix__check:hover { border-color: var(--fg); background: var(--bg-alt); }

/* ============ SUMMARY SIDEBAR ============ */
.checkout-summary { position: sticky; top: calc(var(--header-h) + 24px); }
.checkout-summary__card {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 24px;
}
.checkout-summary__card h3 {
  font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 0 0 18px;
}
.checkout-summary__product { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.checkout-summary__product img {
  width: 52px; height: 52px; object-fit: contain;
  background: var(--bg-alt); border-radius: 10px; border: 1px solid var(--line);
  padding: 4px; flex-shrink: 0;
}
.checkout-summary__product-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.checkout-summary__name { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.checkout-summary__qty { font-size: 12px; color: var(--muted-2); }
.checkout-summary__price { font-size: 13.5px; font-weight: 700; white-space: nowrap; }

.checkout-summary__rows {
  padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
.checkout-summary__row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); }
.checkout-summary__row--total { font-size: 15px; font-weight: 800; color: var(--fg); }
.text-accent { color: var(--accent-dark); font-weight: 700; }

.checkout-summary__total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 16px 0 6px; font-size: 19px; font-weight: 900; letter-spacing: -.01em;
}
.checkout-summary__secure {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 6px;
}
.checkout-summary__secure svg { width: 15px; height: 15px; fill: none; stroke: var(--accent-dark); stroke-width: 1.8; }

/* ============ SUCCESS PANEL ============ */
.checkout-success { max-width: 480px; text-align: center; padding: 60px 20px; }
.checkout-success__icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.checkout-success__icon svg { width: 28px; height: 28px; fill: none; stroke: var(--accent-dark); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.checkout-success h1 { font-size: 26px; font-weight: 900; letter-spacing: -.02em; margin: 0 0 12px; }
.checkout-success p { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin: 0 0 26px; }
.checkout-success p strong { color: var(--fg); }
.checkout-success__card {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: 20px; text-align: left; display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 20px;
}
.checkout-success__note { font-size: 12.5px; color: var(--muted-2); margin: 0 0 26px; }
.checkout-success__back { display: inline-flex; width: auto; padding-left: 32px; padding-right: 32px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .checkout-layout { grid-template-columns: 1fr; }
  .checkout-summary { position: static; order: -1; }
}

@media (max-width: 560px) {
  .container { padding: 0 20px; }
  .checkout-steps__label { display: none; }
  .field-row { grid-template-columns: 1fr; gap: 16px; }
  .field-row .field--sm { max-width: none; }
  .checkout-card__head { padding: 16px 18px; }
  .checkout-card__body, .checkout-card__summary { padding-left: 18px; padding-right: 18px; }
  .option-card { padding: 14px; gap: 10px; }
  .option-card__top { flex-wrap: wrap; }
  .checkout-pix { padding: 24px 18px; }
  .checkout-pix__qr { width: 170px; height: 170px; }
  .checkout-pix__code { flex-wrap: wrap; }
  .checkout-pix__code input { flex-basis: 100%; }
  .checkout-pix__copy { width: 100%; justify-content: center; padding: 12px; }
}
