/* Página del carrito (carro-de-compras.php). */
:root {
  --cp-navy: #0e223e;
  --cp-ink: #111;
  --cp-muted: #5f6672;
  --cp-line: #e5e7eb;
  --cp-soft: #f6f7f9;
  --cp-sale: #d71920;
  --cp-ok: #127a3c;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.op-cart-page {
  margin: 0;
  background: #fff;
  color: var(--cp-ink);
  font-family: Montserrat, Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.op-cart-page a {
  color: inherit;
}

.op-cart-page svg {
  flex: 0 0 auto;
  fill: currentColor;
}

/* Encabezado reducido: menos distracciones camino al pago. */
.cp-header {
  border-bottom: 1px solid var(--cp-line);
  background: #fff;
}

.cp-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
}

.cp-header__back,
.cp-header__secure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cp-navy);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.cp-header__back svg,
.cp-header__secure svg {
  width: 18px;
  height: 18px;
}

.cp-header__back:hover span {
  text-decoration: underline;
}

.cp-header__logo img {
  display: block;
  width: auto;
  height: 40px;
}

.cp-header__secure {
  justify-self: end;
  color: var(--cp-ok);
  white-space: nowrap;
}

.cp-steps {
  display: flex;
  justify-content: center;
  gap: 28px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 12px;
  list-style: none;
  color: #8a909a;
  font-size: 12px;
  font-weight: 600;
}

.cp-steps li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cp-steps span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 11px;
}

.cp-steps .is-current {
  color: var(--cp-navy);
}

.cp-steps .is-current span {
  border-color: var(--cp-navy);
  background: var(--cp-navy);
  color: #fff;
}

.cp-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 24px;
}

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

.cp-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.cp-title__count {
  color: var(--cp-muted);
  font-size: 14px;
  font-weight: 500;
}

/* Barra de envío gratis */
.cp-ship {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 8px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--cp-soft);
}

.cp-ship svg {
  width: 22px;
  height: 22px;
  color: var(--cp-navy);
}

.cp-ship p {
  margin: 0;
  font-size: 13px;
}

.cp-ship__bar {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #dfe3e8;
}

.cp-ship__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--cp-navy);
  transition: width .4s ease;
}

.cp-ship.is-done svg,
.cp-ship.is-done strong {
  color: var(--cp-ok);
}

.cp-ship.is-done .cp-ship__bar span {
  background: var(--cp-ok);
}

/* Líneas del carrito */
.cp-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cp-line {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 18px;
  padding: 20px 0;
  border-bottom: 1px solid var(--cp-line);
  transition: opacity .2s ease;
}

.cp-line.is-updating {
  opacity: .5;
}

.cp-line__media {
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #f2f2f2;
  aspect-ratio: 4 / 5;
}

.cp-line__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cp-line__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cp-line__name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.cp-line__name:hover {
  text-decoration: underline;
}

.cp-line__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  color: var(--cp-muted);
  font-size: 13px;
}

.cp-line__meta strong {
  color: var(--cp-ink);
}

.cp-line__unit {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.cp-line__price {
  font-size: 14px;
  font-weight: 700;
}

.cp-line__price.is-sale {
  color: var(--cp-sale);
}

.cp-line__list {
  color: var(--cp-muted);
  font-size: 12px;
}

.cp-line__off {
  padding: 2px 6px;
  border-radius: 3px;
  background: #fde8e8;
  color: var(--cp-sale);
  font-size: 11px;
  font-weight: 700;
}

.cp-line__stock {
  margin: 0;
  color: #b54708;
  font-size: 12px;
  font-weight: 600;
}

.cp-line__actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: auto;
  padding-top: 6px;
}

.cp-line__actions form {
  margin: 0;
}

.cp-qty {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #c9ced6;
  border-radius: 999px;
}

.cp-qty__btn {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  background: #fff;
  color: var(--cp-ink);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.cp-qty__btn:hover:not(:disabled) {
  background: var(--cp-soft);
}

.cp-qty__btn:disabled {
  color: #c4c8cf;
  cursor: not-allowed;
}

.cp-qty__value {
  min-width: 28px;
  font-weight: 600;
  text-align: center;
}

.js-cart-form.is-busy button {
  pointer-events: none;
}

.cp-line__remove {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--cp-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.cp-line__remove svg {
  width: 16px;
  height: 16px;
}

.cp-line__remove:hover {
  color: var(--cp-sale);
}

.cp-line__total {
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.cp-promo {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff4e5;
  color: #8a4b08;
  font-size: 13px;
}

/* Resumen */
.cp-summary {
  position: sticky;
  top: 20px;
}

.cp-summary__box {
  padding: 22px;
  border: 1px solid var(--cp-line);
  border-radius: 12px;
  background: #fff;
}

.cp-summary__title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
}

.cp-summary__rows {
  margin: 0;
}

.cp-summary__rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
}

.cp-summary__rows dt {
  color: var(--cp-muted);
}

.cp-summary__rows dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.cp-summary__rows .is-saving dt,
.cp-summary__rows .is-saving dd {
  color: var(--cp-sale);
}

.cp-summary__total {
  margin-top: 6px;
  padding-top: 14px !important;
  border-top: 1px solid var(--cp-line);
}

.cp-summary__total dt {
  color: var(--cp-ink) !important;
  font-size: 16px;
  font-weight: 700;
}

.cp-summary__total dd {
  font-size: 20px;
  font-weight: 700 !important;
}

.cp-free {
  color: var(--cp-ok);
}

.cp-muted {
  color: var(--cp-muted);
  font-size: 12px;
  font-weight: 500;
}

.cp-summary__saved {
  margin: 4px 0 0;
  color: var(--cp-ok);
  font-size: 12px;
  font-weight: 600;
}

.cp-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--cp-navy);
  color: #fff !important;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  transition: background-color .16s ease, transform .16s ease;
}

.cp-cta svg {
  width: 18px;
  height: 18px;
}

.cp-cta:hover,
.cp-cta:focus-visible {
  background: #1b3a66;
}

.cp-cta:active {
  transform: scale(.99);
}

.cp-summary__note {
  margin: 10px 0 0;
  color: var(--cp-muted);
  font-size: 12px;
  text-align: center;
}

.cp-trust {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--cp-line);
  list-style: none;
  font-size: 12.5px;
}

.cp-trust li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cp-trust svg {
  width: 18px;
  height: 18px;
  color: var(--cp-navy);
}

.cp-trust a {
  font-weight: 600;
}

.op-pay {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.op-pay li {
  line-height: 0;
}

.op-pay svg {
  width: 44px;
  height: 28px;
  border: 1px solid var(--cp-line);
  border-radius: 4px;
}

.cp-help {
  display: block;
  margin-top: 14px;
  color: var(--cp-muted) !important;
  font-size: 12.5px;
  text-decoration: none;
}

.cp-help strong {
  color: var(--cp-navy);
  text-decoration: underline;
}

/* Barra fija en móvil */
.cp-sticky {
  display: none;
}

/* Carrito vacío */
.cp-empty {
  max-width: 460px;
  margin: 24px auto 8px;
  text-align: center;
}

.cp-empty > svg {
  width: 56px;
  height: 56px;
  color: #c4c8cf;
}

.cp-empty h1 {
  margin: 12px 0 8px;
  font-size: 24px;
}

.cp-empty p {
  margin: 0 0 18px;
  color: var(--cp-muted);
}

.cp-empty__actions {
  display: grid;
  gap: 10px;
}

.cp-empty__actions .cp-cta {
  margin-top: 0;
}

.cp-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--cp-ink);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}

.cp-secondary:hover {
  background: var(--cp-soft);
}

.op-cart-page .op-rail {
  padding: 0;
}

.cp-footer {
  margin-top: 24px;
  padding: 20px 24px 28px;
  border-top: 1px solid var(--cp-line);
  color: var(--cp-muted);
  font-size: 12px;
  text-align: center;
}

.cp-footer p {
  margin: 0;
}

@media (max-width: 960px) {
  .cp-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .cp-summary {
    position: static;
  }
}

@media (max-width: 767px) {
  body.op-cart-page:not(.op-cart-page--empty) {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .cp-header__inner {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 14px;
  }

  .cp-header__back span {
    display: none;
  }

  .cp-header__back {
    width: 36px;
    height: 36px;
    justify-content: center;
  }

  .cp-header__logo {
    justify-self: center;
  }

  .cp-header__logo img {
    height: 30px;
  }

  .cp-header__secure {
    gap: 4px;
  }

  .cp-header__secure svg {
    width: 15px;
    height: 15px;
  }

  .cp-header__secure span {
    font-size: 11px;
  }

  .cp-steps {
    gap: 14px;
    padding: 0 14px 10px;
    font-size: 11px;
  }

  .cp-main {
    padding: 18px 14px 12px;
  }

  .cp-title {
    font-size: 22px;
  }

  .cp-line {
    grid-template-columns: 88px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 16px 0;
  }

  .cp-line__total {
    font-size: 14px;
  }

  .cp-line__actions {
    gap: 12px;
  }

  .cp-line__remove span {
    display: none;
  }

  .cp-line__name {
    font-size: 14px;
  }

  .cp-qty__btn {
    width: 40px;
    height: 40px;
  }

  .cp-summary__box {
    padding: 18px 16px;
  }

  .cp-sticky {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--cp-line);
    background: #fff;
    box-shadow: 0 -6px 18px rgba(14, 34, 62, .08);
    transition: transform .2s ease;
  }

  .cp-sticky.is-hidden {
    transform: translateY(110%);
  }

  .cp-sticky__total {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
  }

  .cp-sticky__total span {
    color: var(--cp-muted);
    font-size: 11px;
  }

  .cp-sticky__total strong {
    font-size: 17px;
  }

  .cp-cta--sticky {
    flex: 1;
    min-height: 48px;
    margin-top: 0;
  }

  .op-cart-page .op-rail {
    margin-right: -14px;
  }
}
