/* ============================================================
   Pintu Clic — Modal / Drawer del carrito de compras
   Basado en el mockup de Figma "modal carrito de compras".
   ============================================================ */

.cartm-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 9, 40, .5);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
  z-index: 1000;
}
.cartm-overlay.is-open { opacity: 1; visibility: visible; }

.cartm {
  position: fixed; top: 0; right: 0;
  height: 100%; width: 400px; max-width: 100vw;
  background: #fff;
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(.4, 0, .2, 1);
  z-index: 1001;
  display: flex; flex-direction: column;
  box-shadow: -8px 0 34px rgba(0, 9, 40, .18);
}
.cartm.is-open { transform: none; }

/* ---------- Cabecera ---------- */
.cartm__head { padding: 16px 22px 0; border-bottom: 1px solid var(--line); }
.cartm__brand { display: flex; align-items: center; justify-content: space-between; }
.cartm__logo { height: 30px; width: auto; }
.cartm__close {
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: #f3f4f6; color: var(--ink-700);
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s;
}
.cartm__close:hover { background: #e6e8eb; }
.cartm__title { font-family: var(--font-alt); font-size: 22px; font-weight: 800; color: var(--navy-800); margin-top: 10px; }
.cartm__sub { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }

/* ---------- Stepper ---------- */
.cartm__steps { display: flex; align-items: center; gap: 6px; margin: 16px 0 14px; }
.cartm__step {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; color: var(--ink-400);
  position: relative;
}
.cartm__step::after {
  content: ""; position: absolute; top: 15px; left: calc(50% + 20px); right: calc(-50% + 20px);
  height: 2px; background: var(--line);
}
.cartm__step:last-child::after { display: none; }
.cartm__step-ic {
  width: 30px; height: 30px; border-radius: 50%;
  background: #eef0f3; color: var(--ink-400);
  display: grid; place-items: center; font-size: 14px;
  border: 2px solid transparent;
}
.cartm__step.is-active { color: var(--blue-500); }
.cartm__step.is-active .cartm__step-ic { background: var(--blue-500); color: #fff; }

/* ---------- Cuerpo ---------- */
.cartm__body { flex: 1; overflow-y: auto; padding: 8px 22px 20px; }

.cartm__item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cartm__thumb {
  flex: 0 0 auto;
  width: 56px; height: 56px; border-radius: 8px;
  background: #eef4fe; display: grid; place-items: center;
  color: var(--navy-800); font-size: 24px; overflow: hidden;
}
.cartm__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cartm__main { flex: 1; min-width: 0; }
.cartm__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cartm__name { font-size: 13.5px; font-weight: 700; color: var(--navy-800); line-height: 1.3; }
.cartm__remove {
  flex: 0 0 auto; background: none; border: 0; cursor: pointer;
  color: #e11d48; display: grid; place-items: center; font-size: 15px;
  opacity: .85; transition: opacity .15s;
}
.cartm__remove:hover { opacity: 1; }
.cartm__var { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.cartm__sku { font-size: 11px; color: var(--ink-400); margin-top: 1px; }
.cartm__row2 { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cartm__qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cartm__qty button {
  width: 26px; height: 26px; border: 0; background: #fff;
  cursor: pointer; color: var(--ink-500); font-size: 15px; transition: background .15s;
}
.cartm__qty button:hover { background: #f3f4f6; }
.cartm__qty span { min-width: 28px; text-align: center; font-weight: 700; font-size: 13px; color: var(--navy-800); }
.cartm__price { font-size: 13.5px; font-weight: 700; color: var(--navy-800); }
.cartm__stock { font-size: 11px; color: #ea8a00; margin-top: 6px; font-weight: 600; }

/* ---------- Vacío ---------- */
.cartm__empty { text-align: center; padding: 64px 24px; }
.cartm__empty-ico { color: var(--line-2); font-size: 46px; }
.cartm__empty h3 { font-size: 16px; color: var(--navy-800); margin-top: 14px; }
.cartm__empty p { font-size: 13px; color: var(--ink-500); margin-top: 6px; }
.cartm__empty a {
  display: inline-block; margin-top: 18px;
  background: var(--blue-500); color: #fff;
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 700;
}
.cartm__empty a:hover { background: var(--blue-600); }

/* ---------- Tarjeta de ayuda ---------- */
.cartm__help {
  display: flex; align-items: center; gap: 12px;
  background: #eafaf1; border: 1px solid #cfeede; border-radius: 12px;
  padding: 12px 14px; margin-top: 16px;
}
.cartm__help-ic {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  background: #2cc285; color: #fff; display: grid; place-items: center; font-size: 16px;
}
.cartm__help-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cartm__help-txt b { font-size: 13px; color: var(--navy-800); }
.cartm__help-txt span { font-size: 11.5px; color: var(--ink-500); }
.cartm__help-btn {
  flex: 0 0 auto;
  border: 1px solid #2cc285; color: #159a67; background: #fff;
  border-radius: 8px; padding: 7px 14px; font-size: 12.5px; font-weight: 700;
}
.cartm__help-btn:hover { background: #2cc285; color: #fff; }

/* ---------- Complementa tu proyecto ---------- */
.cartm__cross-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 700; color: var(--navy-800);
  margin: 20px 0 12px;
}
.cartm__cross-head i { color: var(--ink-400); }
.cartm__cross { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.cartm__cross-card {
  flex: 0 0 150px;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
.cartm__cross-thumb {
  width: 100%; height: 60px; border-radius: 8px;
  background: #f6f7f9; display: grid; place-items: center;
  color: var(--navy-800); font-size: 24px; margin-bottom: 8px;
}
.cartm__cross-name { font-size: 12.5px; font-weight: 700; color: var(--navy-800); }
.cartm__cross-meta { font-size: 11px; color: var(--ink-500); margin-top: 1px; }
.cartm__cross-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cartm__cross-price { font-size: 12px; font-weight: 700; color: var(--navy-800); }
.cartm__cross-add {
  width: 28px; height: 28px; border: 0; border-radius: 7px;
  background: #2cc285; color: #fff; cursor: pointer;
  display: grid; place-items: center; font-size: 14px; transition: filter .15s;
}
.cartm__cross-add:hover { filter: brightness(.95); }

/* ---------- Footer / totales ---------- */
.cartm__foot {
  background: var(--navy-800); color: #fff;
  padding: 18px 20px 0;
  border-radius: 16px 16px 0 0;
}
.cartm__foot-grid {
  display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: end;
}
.cartm__totals { min-width: 0; }

/* Desglose: oculto por defecto, se revela al pasar el mouse por "Continuar compra" */
.cartm__breakdown {
  max-height: 0; opacity: 0; overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0);
  transition: max-height .34s ease, opacity .28s ease, padding .34s ease, margin .34s ease, border-color .34s ease;
}
.cartm__foot-grid:has(.cartm__pay:hover) .cartm__breakdown,
.cartm__foot-grid:has(.cartm__foot-actions:hover) .cartm__breakdown {
  max-height: 160px; opacity: 1;
  padding-bottom: 10px; margin-bottom: 8px;
  border-bottom-color: rgba(255, 255, 255, .15);
}

.cartm__t-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12.5px; margin-bottom: 6px; }
.cartm__t-row:last-child { margin-bottom: 0; }
.cartm__t-row span { color: #aab6d1; display: inline-flex; align-items: center; gap: 4px; }
.cartm__t-row span svg.lucide { width: 12px; height: 12px; opacity: .7; }
.cartm__t-row b { color: #fff; font-weight: 600; }
.cartm__t-disc b { color: #52de9f; }
.cartm__t-muted { color: #aab6d1 !important; font-weight: 500 !important; }
.cartm__t-total {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.cartm__t-total span { font-size: 14px; font-weight: 600; color: #fff; }
.cartm__t-total b { font-size: 21px; font-weight: 800; color: #fff; }

.cartm__foot-actions { display: flex; flex-direction: column; align-items: stretch; gap: 9px; }
.cartm__pay {
  height: 48px; border: 0; border-radius: 8px;
  background: #2cc285; color: #fff;
  font-family: var(--font); font-size: 14px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  padding: 0 22px; transition: filter .15s;
}
.cartm__pay:hover { filter: brightness(.95); }
.cartm__pay svg.lucide { width: 15px; height: 15px; }
.cartm__continue {
  background: none; border: 0; cursor: pointer;
  color: #52de9f; font-family: var(--font); font-size: 12.5px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
}
.cartm__continue:hover { color: #7febb4; }

/* Barra multicolor de marca al fondo */
.cartm__bar { display: flex; height: 6px; margin: 16px -20px 0; }
.cartm__bar span { flex: 1; }
.cartm__bar span:nth-child(1) { background: #0877e8; }
.cartm__bar span:nth-child(2) { background: #2cc285; }
.cartm__bar span:nth-child(3) { background: #f4b41a; }
.cartm__bar span:nth-child(4) { background: #d70505; }

@media (max-width: 460px) {
  .cartm { width: 100vw; }
  .cartm__foot-grid { grid-template-columns: 1fr; }
}
