/* ==========================================================
   CHECKOUT.CSS — Auto Pecas Capelini
   Página de checkout responsiva.
   ========================================================== */

.page-checkout {
  background: #f5f5f7;
}

/* ----------------------------------------------------------
   BREADCRUMB
   ---------------------------------------------------------- */

.checkout-breadcrumb {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.checkout-breadcrumb__inner {
  display: flex;
  align-items: center;
  min-height: 46px;
  overflow: hidden;
}

.checkout-breadcrumb__link {
  flex-shrink: 0;
  color: var(--color-body);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease;
}

.checkout-breadcrumb__link:hover {
  color: var(--color-accent);
}

.checkout-breadcrumb__sep {
  flex-shrink: 0;
  margin: 0 10px;
  color: var(--color-body);
  opacity: 0.3;
  font-size: 0.82rem;
}

.checkout-breadcrumb__current {
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ----------------------------------------------------------
   HERO
   ---------------------------------------------------------- */

.checkout-main {
  padding-bottom: 72px;
}

.checkout-hero {
  padding-top: 48px;
  padding-bottom: 26px;
}

.checkout-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--color-text);
}

.checkout-desc {
  max-width: 62ch;
  margin: 14px 0 0;
  color: var(--color-body);
  font-size: 0.96rem;
  line-height: 1.7;
}

/* ----------------------------------------------------------
   LAYOUT
   ---------------------------------------------------------- */

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 28px;
  align-items: start;
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.checkout-card,
.checkout-summary__card,
.checkout-trust {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 2px 14px rgba(0, 0, 0, 0.05);
}

.checkout-card {
  padding: 24px;
}

.checkout-card__header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.checkout-step {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--color-surface-soft);
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 800;
}

.checkout-card__header h2 {
  margin: 0 0 5px;
  font-family: var(--font-heading);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.checkout-card__header p {
  margin: 0;
  color: var(--color-body);
  font-size: 0.84rem;
  line-height: 1.55;
}

/* ----------------------------------------------------------
   FORM
   ---------------------------------------------------------- */

.checkout-grid {
  display: grid;
  gap: 14px;
}

.checkout-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkout-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.checkout-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.checkout-field--span-2 {
  grid-column: span 2;
}

.checkout-field span {
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
}

.checkout-field input,
.checkout-field select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--color-border-strong);
  border-radius: 11px;
  background: #ffffff;
  color: var(--color-text);
  padding: 0 14px;
  font-size: 0.92rem;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.checkout-field select {
  appearance: none;
}

.checkout-field input::placeholder {
  color: rgba(17, 17, 17, 0.34);
}

.checkout-field input:focus,
.checkout-field select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(184, 80, 0, 0.14);
}

.checkout-field.is-invalid input,
.checkout-field.is-invalid select {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(233, 37, 48, 0.1);
}

.checkout-field__error {
  color: var(--color-danger);
  font-size: 0.72rem;
  line-height: 1.35;
}

/* ----------------------------------------------------------
   CHOICES
   ---------------------------------------------------------- */

.checkout-choice-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkout-choice-group--payment {
  grid-template-columns: 1fr;
}

.checkout-choice {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fbfbfc;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.checkout-choice:hover {
  border-color: rgba(184, 80, 0, 0.28);
  background: #ffffff;
}

.checkout-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkout-choice::before {
  content: "";
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border-radius: 50%;
  border: 2px solid rgba(17, 17, 17, 0.2);
  background: #ffffff;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.checkout-choice:has(input:checked) {
  border-color: rgba(184, 80, 0, 0.38);
  background: var(--color-surface-soft);
  box-shadow: 0 0 0 3px rgba(184, 80, 0, 0.08);
}

.checkout-choice:has(input:checked)::before {
  border-color: var(--color-accent);
  box-shadow: inset 0 0 0 4px #ffffff;
  background: var(--color-accent);
}

.checkout-choice strong {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-heading);
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 800;
}

.checkout-choice small {
  display: block;
  color: var(--color-body);
  font-size: 0.78rem;
  line-height: 1.5;
}

.checkout-address,
.checkout-pickup {
  margin-top: 18px;
}

.checkout-pickup__box {
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 107, 0, 0.045);
  border: 1px solid rgba(255, 107, 0, 0.12);
}

.checkout-pickup__box strong {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--color-text);
}

.checkout-pickup__box p {
  margin: 0 0 9px;
  color: var(--color-body);
  font-size: 0.82rem;
  line-height: 1.55;
}

.checkout-pickup__box a {
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
}

.checkout-pickup__box a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.checkout-safe-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 13px;
  background: rgba(0, 166, 81, 0.08);
  border: 1px solid rgba(0, 166, 81, 0.12);
}

.checkout-safe-box span {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 166, 81, 0.14);
  color: #00a651;
  font-weight: 800;
  font-size: 0.8rem;
}

.checkout-safe-box p {
  margin: 0;
  color: var(--color-body);
  font-size: 0.8rem;
  line-height: 1.55;
}

.checkout-payment-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fbfbfc;
}

.checkout-payment-panel__text {
  margin: 0;
  color: var(--color-body);
  font-size: 0.84rem;
  line-height: 1.55;
}

.checkout-pix__qr {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: 16px auto 14px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: #ffffff;
}

.checkout-pix__code {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--color-border-strong);
  border-radius: 11px;
  background: #ffffff;
  color: var(--color-text);
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.checkout-pix__status {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d2d7df;
  background: #f4f7fb;
  color: #2f4057;
  font-size: 0.82rem;
  line-height: 1.45;
}

.checkout-pix__status[data-tone="pending"] {
  border-color: #f3d89d;
  background: #fff7df;
  color: #7c5600;
}

.checkout-pix__status[data-tone="error"] {
  border-color: #e8b5b5;
  background: #fff2f2;
  color: #8a1f1f;
}

.checkout-pix__actions {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.checkout-dialog--pix .checkout-dialog__surface {
  width: min(460px, calc(100vw - 36px));
}

/* ----------------------------------------------------------
   SUMMARY
   ---------------------------------------------------------- */

.checkout-summary {
  position: sticky;
  top: 112px;
}

.checkout-summary__card {
  padding: 24px;
}

.checkout-summary__eyebrow {
  margin: 0 0 18px;
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.checkout-summary__items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
  margin-bottom: 18px;
}

.checkout-summary__loading {
  margin: 0;
  color: var(--color-body);
  font-size: 0.86rem;
}

.checkout-summary-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
}

.checkout-summary-item__image {
  width: 58px;
  height: 58px;
  padding: 6px;
  object-fit: contain;
  border: 1px solid var(--color-border);
  border-radius: 11px;
  background: #ffffff;
  mix-blend-mode: multiply;
}

.checkout-summary-item__title {
  margin: 0 0 4px;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.28;
}

.checkout-summary-item__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--color-body);
  font-size: 0.74rem;
}

.checkout-summary-item__meta strong {
  color: var(--color-accent);
  font-family: var(--font-heading);
}

.checkout-summary__totals {
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

.checkout-summary__row,
.checkout-summary__total {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.checkout-summary__row {
  padding: 10px 0;
  color: var(--color-body);
  font-size: 0.86rem;
}

.checkout-summary__row strong {
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 0.9rem;
}

.checkout-summary__total {
  margin-top: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  align-items: flex-end;
}

.checkout-summary__total span {
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
}

.checkout-summary__total strong {
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.checkout-summary__note {
  margin: 16px 0 20px;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--color-surface-soft);
  color: var(--color-body);
  font-size: 0.78rem;
  line-height: 1.55;
}

.checkout-submit,
.checkout-back {
  width: 100%;
}

.checkout-back {
  margin-top: 10px;
}

.checkout-mobile-submit {
  display: none;
}

/* ----------------------------------------------------------
   TRUST CARD / MINI RODAPÉ
   ---------------------------------------------------------- */

.checkout-trust {
  margin-top: 14px;
  padding: 16px;
}

.checkout-trust__header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.checkout-trust__icon {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(0, 166, 81, 0.12);
  color: #00a651;
  font-size: 0.92rem;
  font-weight: 800;
}

.checkout-trust__header strong {
  display: block;
  margin-bottom: 5px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--color-text);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.checkout-trust__header span {
  display: block;
  color: var(--color-body);
  font-size: 0.78rem;
  line-height: 1.55;
}

.checkout-trust__location {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 107, 0, 0.045);
  border: 1px solid rgba(255, 107, 0, 0.12);
}

.checkout-trust__location-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.checkout-trust__pin {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  font-size: 0.95rem;
}

.checkout-trust__location-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.checkout-trust__location-text strong {
  color: var(--color-text);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.25;
}

.checkout-trust__location-text small {
  color: #6e6e73;
  font-size: 0.72rem;
  line-height: 1.35;
}

.checkout-trust__map {
  display: block;
  width: 100%;
  height: 170px;
  border: 0;
  border-radius: 12px;
  background: #f2f2f4;
  overflow: hidden;
}

.checkout-trust__route-link {
  display: inline-flex;
  margin-top: 9px;
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: 0.74rem;
  font-weight: 800;
  text-decoration: none;
  line-height: 1.3;
}

.checkout-trust__route-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.checkout-trust__badges {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 12px;
}

.checkout-trust__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  padding: 9px 12px;
  border-radius: 13px;
  background: #fbfbfc;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.checkout-trust__badge-img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.checkout-trust__badge-img--avaliacao {
  max-height: 56px;
}

.checkout-trust__badge-img--google {
  max-height: 66px;
}

.checkout-trust__badge-img--mercadopago {
  max-height: 42px;
}

.checkout-company {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.checkout-company__brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 9px;
}

.checkout-company__brand strong {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.checkout-company__brand span {
  font-size: 0.76rem;
  color: #6e6e73;
}

.checkout-company p {
  margin: 0;
  color: var(--color-body);
  font-size: 0.78rem;
  line-height: 1.55;
}

.checkout-company__phone {
  display: inline-flex;
  width: fit-content;
  margin-top: 9px;
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.checkout-company__phone:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ----------------------------------------------------------
   EMPTY CHECKOUT
   ---------------------------------------------------------- */

.checkout-empty {
  padding: 48px 24px;
  text-align: center;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 2px 14px rgba(0, 0, 0, 0.05);
}

.checkout-empty h2 {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 800;
}

.checkout-empty p {
  margin: 0 auto 20px;
  max-width: 36ch;
  color: var(--color-body);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ----------------------------------------------------------
   DIALOG
   ---------------------------------------------------------- */

.checkout-dialog {
  border: none;
  border-radius: 20px;
  padding: 0;
  background: transparent;
}

.checkout-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(4px);
}

.checkout-dialog__surface {
  width: min(380px, calc(100vw - 36px));
  padding: 28px;
  background: #ffffff;
  border-radius: 20px;
  text-align: center;
  box-shadow: var(--shadow-card-strong);
}

.checkout-dialog__spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(184, 80, 0, 0.16);
  border-top-color: var(--color-accent);
  animation: checkoutSpin 800ms linear infinite;
}

.checkout-dialog__surface h2 {
  margin: 0 0 7px;
  font-family: var(--font-heading);
  font-size: 1.12rem;
  font-weight: 800;
}

.checkout-dialog__surface p {
  margin: 0;
  color: var(--color-body);
  font-size: 0.86rem;
  line-height: 1.55;
}

@keyframes checkoutSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ----------------------------------------------------------
   RESPONSIVE
   ---------------------------------------------------------- */

@media (max-width: 980px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .checkout-summary {
    position: static;
    order: -1;
  }

  .checkout-summary__card {
    padding: 20px;
  }

  .checkout-summary__items {
    max-height: none;
  }

  .checkout-submit--desktop {
    display: none;
  }

  .checkout-mobile-submit {
    display: block;
  }

  .checkout-trust__badges {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .checkout-trust__map {
    height: 220px;
  }
}

@media (max-width: 700px) {
  .checkout-main {
    padding-bottom: 48px;
  }

  .checkout-hero {
    padding-top: 34px;
    padding-bottom: 20px;
  }

  .checkout-card {
    padding: 20px;
  }

  .checkout-grid--2,
  .checkout-grid--3 {
    grid-template-columns: 1fr;
  }

  .checkout-field--span-2 {
    grid-column: auto;
  }

  .checkout-choice-group {
    grid-template-columns: 1fr;
  }

  .checkout-card__header {
    gap: 12px;
    margin-bottom: 18px;
  }

  .checkout-step {
    width: 32px;
    height: 32px;
  }

  .checkout-trust__badges {
    grid-template-columns: 1fr;
  }

  .checkout-trust__map {
    height: 180px;
  }
}

/* ----------------------------------------------------------
   SHIPPING OPTIONS (Melhor Envio)
   ---------------------------------------------------------- */

.checkout-shipping-options {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.checkout-shipping-options__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-heading);
  margin-bottom: 10px;
}

.checkout-shipping-options__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkout-shipping-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
  background: #fff;
}

.checkout-shipping-option:has(input:checked) {
  border-color: var(--color-accent);
  background: #fff8f0;
}

.checkout-shipping-option input[type="radio"] {
  accent-color: var(--color-accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}

.checkout-shipping-option__logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.checkout-shipping-option__info {
  flex: 1;
  min-width: 0;
}

.checkout-shipping-option__name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-heading);
  display: block;
}

.checkout-shipping-option__company {
  font-size: 0.78rem;
  color: var(--color-body);
  opacity: 0.7;
}

.checkout-shipping-option__deadline {
  font-size: 0.78rem;
  color: var(--color-body);
  opacity: 0.65;
}

.checkout-shipping-option__price {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.checkout-shipping-options__note {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--color-body);
  opacity: 0.7;
}

.checkout-shipping-options__loading {
  font-size: 0.84rem;
  color: var(--color-body);
  opacity: 0.7;
  padding: 8px 0;
}