/* ══════════════════════════════════════════════════════
   CARRINHO — itens agrupados por loja, resumo ao lado e
   barra fixa com o total no celular.
   ══════════════════════════════════════════════════════ */

.cp {
  --cp-ink: #1a1a18;
  --cp-muted: #6f6f68;
  --cp-line: #e6e3dc;
  --cp-accent: var(--navy, #243a6e);
  --cp-buy: #1f9d55;
  --cp-buy-hover: #198a4a;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

.cp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.cp-head h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--cp-ink);
}

.cp-head h1 span {
  margin-left: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--cp-muted);
}

.cp-continue {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cp-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

/* ── Lojas e itens ───────────────────────────────────── */
.cp-main form.is-busy { opacity: 0.6; pointer-events: none; }

.cp-store {
  background: #fff;
  border: 1px solid var(--cp-line);
  border-radius: 14px;
  margin-bottom: 16px;
  overflow: hidden;
}

.cp-store-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--cp-line);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--cp-muted);
}

.cp-store-head a {
  color: var(--cp-ink);
  text-decoration: none;
}

.cp-store-head a:hover { text-decoration: underline; }

.cp-item {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto 110px;
  grid-template-areas: "img info qty total";
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
}

.cp-item + .cp-item { border-top: 1px solid var(--cp-line); }

.cp-item-img {
  grid-area: img;
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--gray-mid, #f3f1ec);
}

.cp-item-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  color: transparent; /* esconde o texto alternativo de imagem quebrada */
}

.cp-item-info {
  grid-area: info;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.cp-item-name {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--cp-ink);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

a.cp-item-name:hover { text-decoration: underline; }

.cp-item-variant,
.cp-item-unit {
  font-size: 0.8rem;
  color: var(--cp-muted);
}

.cp-item-qty {
  grid-area: qty;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.cp-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d6d2c9;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.cp-stepper button {
  width: 36px;
  height: 38px;
  border: 0;
  background: transparent;
  font-size: 1.1rem;
  color: var(--cp-ink);
  cursor: pointer;
}

.cp-stepper button:hover:not([disabled]) { background: var(--gray-mid, #f3f1ec); }
.cp-stepper button[disabled] { color: #c3bfb6; cursor: not-allowed; }

.cp-stepper input {
  width: 40px;
  height: 38px;
  border: 0;
  text-align: center;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--cp-ink);
  -moz-appearance: textfield;
  appearance: textfield;
}

.cp-stepper input::-webkit-outer-spin-button,
.cp-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cp-remove {
  border: 0;
  background: none;
  padding: 2px 0;
  font: inherit;
  font-size: 0.78rem;
  color: var(--cp-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.cp-remove:hover { color: #c0392b; }

.cp-item-total {
  grid-area: total;
  text-align: right;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--cp-ink);
  white-space: nowrap;
}

/* Brindes */
.cp-item-gift .cp-item-total { color: #1e7a45; }

.cp-item-gift .cp-item-total s {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--cp-muted);
}

.cp-gift-tag {
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f5ec;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1e7a45;
}

.cp-gift-next {
  display: grid;
  gap: 8px;
  margin: 0 20px 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f2faf5;
  font-size: 0.82rem;
  color: #1e6b41;
}

.cp-gift-next a { color: inherit; font-weight: 700; }

.cp-gift-bar {
  height: 6px;
  border-radius: 999px;
  background: #cfe6d8;
  overflow: hidden;
}

.cp-gift-bar span {
  display: block;
  height: 100%;
  background: #2e9e5b;
}

/* ── Resumo ──────────────────────────────────────────── */
.cp-aside { position: sticky; top: 20px; }

.cp-summary {
  background: #fff;
  border: 1px solid var(--cp-line);
  border-radius: 14px;
  padding: 20px;
}

.cp-summary h2 {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cp-ink);
}

.cp-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 5px 0;
  font-size: 0.88rem;
  color: var(--cp-ink);
}

.cp-muted { color: var(--cp-muted); }
.cp-row-discount span:last-child { color: #1e7a45; font-weight: 600; }

.cp-inline-form { display: inline; }

.cp-inline-form button {
  border: 0;
  background: none;
  padding: 0;
  margin-left: 4px;
  font: inherit;
  font-size: 0.78rem;
  color: var(--cp-muted);
  text-decoration: underline;
  cursor: pointer;
}

.cp-row-total {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--cp-line);
  font-weight: 700;
}

.cp-row-total strong { font-size: 1.3rem; }

.cp-coupon {
  margin-top: 12px;
  font-size: 0.85rem;
}

.cp-coupon summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--cp-accent);
  list-style: none;
}

.cp-coupon summary::-webkit-details-marker { display: none; }
.cp-coupon summary::before { content: "+ "; }
.cp-coupon[open] summary::before { content: "− "; }

.cp-coupon form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.cp-coupon input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #d6d2c9;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  text-transform: uppercase;
}

.cp-coupon input:focus {
  outline: none;
  border-color: var(--cp-accent);
  box-shadow: 0 0 0 3px rgba(36, 58, 110, 0.12);
}

.cp-coupon button {
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--cp-ink);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.cp-error {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: #c0392b;
}

.cp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.cp-btn-buy {
  margin-top: 16px;
  background: var(--cp-buy);
  color: #fff;
}

.cp-btn-buy:hover { background: var(--cp-buy-hover); }

.cp-btn-primary {
  display: inline-flex;
  background: var(--cp-accent);
  color: #fff;
}

.cp-btn-ghost {
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--cp-line);
  color: var(--cp-ink);
}

.cp-note {
  margin: 12px 0 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--cp-muted);
  text-align: center;
}

/* Compra com 1 clique, recolhida por padrão */
.cp-oneclick {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--cp-line);
}

.cp-oneclick > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--cp-ink);
  cursor: pointer;
  list-style: none;
}

.cp-oneclick > summary::-webkit-details-marker { display: none; }
.cp-oneclick > summary svg { color: var(--orange, #e07f2e); }
.cp-oneclick .oc-panel { margin-top: 12px; }
.cp-oneclick .oc-head { display: none; }

/* ── Vazio ───────────────────────────────────────────── */
.cp-empty {
  max-width: 420px;
  margin: 40px auto;
  padding: 40px 24px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--cp-line);
  border-radius: 14px;
  color: var(--cp-muted);
}

.cp-empty h1 {
  margin: 16px 0 6px;
  font-size: 1.25rem;
  color: var(--cp-ink);
}

.cp-empty p { margin: 0 0 20px; font-size: 0.9rem; }

.cp-mobile-bar { display: none; }

/* ── Celular ─────────────────────────────────────────── */
@media (max-width: 860px) {
  .cp { padding: 16px 16px 104px; }
  .cp-head { margin-bottom: 14px; }
  .cp-head h1 { font-size: 1.35rem; }
  .cp-grid { grid-template-columns: 1fr; gap: 0; }
  .cp-aside { position: static; }

  .cp-item {
    grid-template-columns: 72px minmax(0, 1fr) auto;
    grid-template-areas:
      "img info info"
      "img qty total";
    gap: 10px 14px;
    padding: 14px 16px;
  }

  .cp-item-img { width: 72px; height: 72px; }

  .cp-item-qty {
    flex-direction: row;
    gap: 14px;
  }

  .cp-item-gift { grid-template-areas: "img info total"; }
  .cp-store-head { padding: 12px 16px; }
  .cp-gift-next { margin: 0 16px 14px; }

  /* O botão do resumo vai para a barra fixa. */
  .cp-summary > .cp-btn-buy { display: none; }

  .cp-mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--cp-line);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.06);
  }

  .cp-mobile-bar small {
    display: block;
    font-size: 0.72rem;
    color: var(--cp-muted);
  }

  .cp-mobile-bar strong {
    font-size: 1.15rem;
    color: var(--cp-ink);
  }

  .cp-mobile-bar .cp-btn {
    margin: 0;
    flex: 0 0 auto;
    min-width: 150px;
  }
}
