/*
 * El carrito lateral y su icono.
 *
 * Mismas reglas que el resto de bloques: variables con valor por defecto, nada
 * de `!important` y nada de selectores de tres niveles. Esto convive con el tema
 * del cliente, y ganarle a la fuerza es la forma de que su tema deje de poder
 * cambiar nada.
 */

.mcp-fab,
.mcp-drawer {
  --mcp-accent: var(--e-global-color-accent, #e0286b);
  --mcp-ink: var(--e-global-color-text, #1b2440);
  --mcp-muted: #6b7392;
  --mcp-border: #e3e6ee;
  --mcp-radius: 12px;
}

/* ========================================================= icono flotante */

.mcp-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9990;
  width: 56px;
  height: 56px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 22px rgba(20, 28, 60, 0.18);
  cursor: pointer;
}

.mcp-fab.is-on {
  display: flex;
  animation: mcp-fab-in 0.28s ease;
}

@keyframes mcp-fab-in {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.mcp-fab__vessel { position: relative; width: 30px; height: 30px; display: block; }

.mcp-fab__svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.mcp-fab__svg--outline .mcp-fab__body,
.mcp-fab__svg--outline .mcp-fab__line {
  fill: none;
  stroke: var(--mcp-ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mcp-fab__svg--solid .mcp-fab__body { fill: var(--mcp-accent); stroke: none; }
.mcp-fab__svg--solid .mcp-fab__line { fill: none; stroke: none; }

/*
 * El relleno sube desde abajo.
 *
 * `clip-path` la pone el JavaScript con el progreso real —hacia el envío
 * gratis si la tienda tiene umbral—, así que mirar el icono dice algo. La
 * transición está aquí y no allí para que el llenado se vea subir.
 */
.mcp-fab__fill {
  position: absolute;
  inset: 0;
  display: block;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.mcp-fab.is-full .mcp-fab__vessel { animation: mcp-fab-pop 0.4s ease; }

@keyframes mcp-fab-pop {
  50% { transform: scale(1.16); }
}

.mcp-fab__count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--mcp-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .mcp-fab.is-on { animation: none; }
  .mcp-fab.is-full .mcp-fab__vessel { animation: none; }
  .mcp-fab__fill { transition: none; }
}

/* ================================================================= el panel */

.mcp-drawer__scrim {
  position: fixed;
  inset: 0;
  z-index: 9995;
  background: rgba(16, 22, 44, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mcp-drawer__scrim.is-open { opacity: 1; pointer-events: auto; }

.mcp-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9996;
  display: flex;
  flex-direction: column;
  width: min(420px, 100%);
  height: 100%;
  background: #fff;
  color: var(--mcp-ink);
  box-shadow: -10px 0 40px rgba(20, 28, 60, 0.16);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mcp-drawer.is-open { transform: translateX(0); }

/* Con el cajón abierto, el fondo no se mueve: nada peor que cerrar y
   encontrarse la página donde no estaba. */
body.mcp-drawer-open { overflow: hidden; }

.mcp-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--mcp-border);
}

.mcp-drawer__title { margin: 0; font-size: 17px; font-weight: 700; }

.mcp-drawer__close {
  border: 0;
  background: none;
  font-size: 26px;
  line-height: 1;
  color: var(--mcp-muted);
  cursor: pointer;
  padding: 0 4px;
}

.mcp-drawer__body { flex: 1; overflow-y: auto; padding: 4px 18px 18px; }

.mcp-drawer__foot {
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--mcp-border);
  background: #fff;
}

/* ------------------------------------------------------------- las líneas */

.mcp-drawer__items { display: flex; flex-direction: column; }

.mcp-ci {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--mcp-border);
}

.mcp-ci__img { width: 62px; height: 62px; border-radius: 10px; object-fit: cover; }
.mcp-ci__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.mcp-ci__name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: inherit;
  text-decoration: none;
}

.mcp-ci__var { font-size: 12px; color: var(--mcp-muted); }

.mcp-ci__tag {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mcp-accent) 12%, transparent);
  color: var(--mcp-accent);
  font-size: 11px;
  font-weight: 700;
}

.mcp-ci__units {
  margin: 2px 0 0;
  padding: 0 0 0 14px;
  list-style: disc;
  font-size: 12px;
  color: var(--mcp-muted);
  line-height: 1.5;
}

.mcp-ci__ctrl { display: flex; align-items: center; gap: 6px; margin-top: 6px; }

.mcp-ci__step {
  width: 26px;
  height: 26px;
  border: 1px solid var(--mcp-border);
  border-radius: 7px;
  background: #fff;
  color: var(--mcp-ink);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.mcp-ci__step:disabled { opacity: 0.4; cursor: default; }
.mcp-ci__qty { min-width: 22px; text-align: center; font-size: 14px; font-weight: 600; }

/* Un pack no se edita por unidades: se ve cuántas lleva y ya. */
.mcp-ci__fixed { font-size: 13px; color: var(--mcp-muted); }

.mcp-ci__remove {
  margin-left: 6px;
  border: 0;
  background: none;
  padding: 0;
  font-size: 12px;
  color: var(--mcp-muted);
  text-decoration: underline;
  cursor: pointer;
}

.mcp-ci__price { font-size: 14px; font-weight: 700; white-space: nowrap; }
.mcp-ci__price del { font-weight: 400; color: var(--mcp-muted); }

/* --------------------------------------------------------- envío gratis */

.mcp-drawer__ship { margin: 16px 0 4px; }
.mcp-drawer__shiptext { margin: 0 0 7px; font-size: 13px; color: var(--mcp-muted); }
.mcp-drawer__ship.is-reached .mcp-drawer__shiptext { color: #1c7a3e; font-weight: 600; }

.mcp-drawer__shipbar { height: 6px; border-radius: 999px; background: #eef0f6; overflow: hidden; }

.mcp-drawer__shipfill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--mcp-accent);
  transition: width 0.4s ease;
}

.mcp-drawer__ship.is-reached .mcp-drawer__shipfill { background: #2fa361; }

/* --------------------------------------------------------- venta cruzada */

.mcp-xs { margin-top: 22px; }

.mcp-xs__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mcp-muted);
}

.mcp-xs__item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
}

.mcp-xs__img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.mcp-xs__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.mcp-xs__name {
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcp-xs__price { font-size: 12px; color: var(--mcp-muted); }

.mcp-xs__add,
.mcp-xs__pick {
  padding: 6px 12px;
  border: 1px solid var(--mcp-accent);
  border-radius: 999px;
  background: #fff;
  color: var(--mcp-accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.mcp-xs__add:disabled { opacity: 0.5; cursor: default; }

/* ------------------------------------------------------------------- pie */

.mcp-drawer__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 15px;
}

.mcp-drawer__total strong { font-size: 20px; }

.mcp-drawer__cta {
  display: block;
  padding: 14px;
  border-radius: var(--mcp-radius);
  background: var(--mcp-accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.mcp-drawer__link {
  display: block;
  margin-top: 9px;
  font-size: 13px;
  text-align: center;
  color: var(--mcp-muted);
}

/* ----------------------------------------------------------------- vacío */

.mcp-drawer__empty { padding: 48px 0; text-align: center; color: var(--mcp-muted); }

.mcp-drawer__keep {
  margin-top: 14px;
  padding: 10px 18px;
  border: 1px solid var(--mcp-border);
  border-radius: 999px;
  background: #fff;
  color: var(--mcp-ink);
  font-size: 13px;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .mcp-drawer,
  .mcp-drawer__scrim,
  .mcp-drawer__shipfill { transition: none; }
}
