/* ============ Comeros - Carrito v2 (standalone) ============ */
:root {
  --cmr2-primary: #0ea5e9;
  --cmr2-primary-dark: #0284c7;
  --cmr2-primary-light: #e0f2fe;
  --cmr2-text: #0f172a;
  --cmr2-text-soft: #475569;
  --cmr2-text-mute: #94a3b8;
  --cmr2-border: #e5e7eb;
  --cmr2-bg: #f3f4f6;
  --cmr2-card: #fff;
  --cmr2-success: #16a34a;
}

.cmr2-wrap { max-width: 1240px; margin: 28px auto 60px; padding: 0 16px; box-sizing: border-box; }

/* Header */
.cmr2-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--cmr2-border);
}
.cmr2-back {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--cmr2-primary);
  border-radius: 50%;
  color: var(--cmr2-primary);
  text-decoration: none;
  transition: all .15s;
  flex-shrink: 0;
}
.cmr2-back:hover { background: var(--cmr2-primary); color: #fff; }
.cmr2-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--cmr2-text);
  margin: 0;
  line-height: 1;
}

/* Layout 2 columnas */
.cmr2-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}
.cmr2-items { min-width: 0; }

/* Item card */
.cmr2-item {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 0 22px;
  align-items: center;
  background: var(--cmr2-card);
  border-radius: 18px;
  padding: 22px 26px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(15,23,42,.05);
  transition: box-shadow .2s;
}
.cmr2-item:hover { box-shadow: 0 8px 24px rgba(15,23,42,.08); }

.cmr2-item-thumb img {
  width: 130px;
  height: 130px;
  object-fit: contain;
  background: var(--cmr2-bg);
  border-radius: 12px;
  padding: 8px;
  display: block;
  box-sizing: border-box;
}

.cmr2-item-body { min-width: 0; }
.cmr2-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  color: var(--cmr2-success);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #bbf7d0;
  margin-bottom: 8px;
}
.cmr2-badge b { font-weight: 700; }
.cmr2-badge .woocommerce-Price-amount { color: var(--cmr2-success); font-weight: 700; }
.cmr2-badge bdi { color: var(--cmr2-success) !important; }

.cmr2-item-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--cmr2-text);
  line-height: 1.4;
  margin-bottom: 14px;
}
.cmr2-item-name a {
  color: inherit;
  text-decoration: none;
}
.cmr2-item-name a:hover { color: var(--cmr2-primary); }

.cmr2-item-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cmr2-remove {
  width: 42px; height: 42px;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: #fff;
  border: 1.5px solid var(--cmr2-primary);
  border-radius: 10px;
  color: var(--cmr2-primary);
  cursor: pointer;
  transition: all .15s;
  padding: 0;
}
.cmr2-remove:hover { background: var(--cmr2-primary); color: #fff; }

.cmr2-qty {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--cmr2-border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  height: 42px;
}
.cmr2-qty-btn {
  width: 38px;
  height: 40px;
  background: transparent;
  border: 0;
  color: var(--cmr2-text-soft);
  font-size: 20px;
  font-weight: 400;
  cursor: pointer;
  transition: color .15s;
  line-height: 1;
}
.cmr2-qty-btn:hover { color: var(--cmr2-primary); }
.cmr2-qty-input {
  width: 44px;
  height: 40px;
  border: 0;
  background: transparent;
  text-align: center;
  font-weight: 600;
  color: var(--cmr2-text);
  font-size: 15px;
  -moz-appearance: textfield;
  outline: none;
}
.cmr2-qty-input::-webkit-outer-spin-button,
.cmr2-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cmr2-item-price {
  text-align: right;
  align-self: center;
  min-width: 140px;
}
.cmr2-price-old {
  font-size: 14px;
  color: var(--cmr2-text-mute);
  text-decoration: line-through;
  font-weight: 500;
  margin-bottom: 2px;
}
.cmr2-price-old bdi { color: var(--cmr2-text-mute) !important; }
.cmr2-price-new {
  font-size: 22px;
  font-weight: 700;
  color: var(--cmr2-text);
  white-space: nowrap;
}
.cmr2-price-new bdi { color: var(--cmr2-text) !important; }

/* Sidebar */
.cmr2-sidebar { position: sticky; top: 90px; }
.cmr2-summary {
  background: var(--cmr2-card);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 2px 8px rgba(15,23,42,.05);
}
.cmr2-summary-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  margin: 0 0 18px;
  color: var(--cmr2-text-mute);
  font-weight: 700;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}

.cmr2-coupon-info {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: #f8fafc;
  border-radius: 10px;
  margin-bottom: 16px;
}
.cmr2-coupon-info svg { color: var(--cmr2-primary); flex-shrink: 0; }
.cmr2-coupon-info p {
  margin: 0;
  font-size: 13px;
  color: var(--cmr2-text-soft);
  line-height: 1.5;
}

.cmr2-summary-rows { padding: 4px 0; }
.cmr2-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 15px;
  color: var(--cmr2-text-soft);
}
.cmr2-row b {
  color: var(--cmr2-text);
  font-size: 17px;
  font-weight: 700;
}
.cmr2-row b bdi { color: var(--cmr2-text) !important; }

.cmr2-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0 6px;
  border-top: 2px solid var(--cmr2-text);
  margin-top: 6px;
}
.cmr2-total-lbl {
  font-size: 17px;
  color: var(--cmr2-text);
  font-weight: 600;
}
.cmr2-total-val {
  font-size: 24px;
  color: var(--cmr2-text);
  font-weight: 700;
}
.cmr2-total-val bdi { color: var(--cmr2-text) !important; }

.cmr2-pay-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 6px;
  font-size: 12.5px;
  color: var(--cmr2-text-soft);
  font-weight: 600;
}
.cmr2-pay-note svg { color: var(--cmr2-text-mute); flex-shrink: 0; }

/* Botones */
.cmr2-btn-primary {
  display: block;
  background: var(--cmr2-primary);
  color: #fff;
  border: 2px solid var(--cmr2-primary);
  padding: 15px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  text-decoration: none;
  margin-top: 14px;
  transition: all .15s;
  cursor: pointer;
}
.cmr2-btn-primary:hover {
  background: var(--cmr2-primary-dark);
  border-color: var(--cmr2-primary-dark);
  color: #fff;
}
.cmr2-btn-secondary {
  display: block;
  background: #fff;
  color: var(--cmr2-primary);
  border: 2px solid var(--cmr2-primary);
  padding: 15px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  text-decoration: none;
  margin-top: 12px;
  transition: all .15s;
}
.cmr2-btn-secondary:hover {
  background: var(--cmr2-primary-light);
  color: var(--cmr2-primary);
}

/* Empty state */
.cmr2-empty {
  background: var(--cmr2-card);
  border-radius: 18px;
  padding: 60px 30px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(15,23,42,.05);
}
.cmr2-empty-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--cmr2-text-mute);
}
.cmr2-empty h2 {
  font-size: 22px;
  color: var(--cmr2-text);
  margin: 0 0 8px;
  font-weight: 700;
}
.cmr2-empty p {
  color: var(--cmr2-text-soft);
  margin: 0 0 22px;
}
.cmr2-empty .cmr2-btn-primary {
  display: inline-block;
  margin-top: 0;
  padding: 14px 32px;
}

/* Sticky bottom mobile */
.cmr2-sticky {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--cmr2-border);
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  box-shadow: 0 -6px 24px rgba(0,0,0,.1);
  z-index: 9998;
  align-items: center;
  gap: 12px;
}
.cmr2-sticky-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cmr2-sticky-lbl {
  font-size: 11px;
  color: var(--cmr2-text-mute);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
}
.cmr2-sticky-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--cmr2-text);
}
.cmr2-sticky-val bdi { color: var(--cmr2-text) !important; }
.cmr2-sticky-cta {
  background: var(--cmr2-primary);
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s;
}
.cmr2-sticky-cta:hover { background: var(--cmr2-primary-dark); }

/* Loading state */
.cmr2-item.loading { opacity: .5; pointer-events: none; }

/* Responsive */
@media (max-width: 992px) {
  .cmr2-grid { grid-template-columns: 1fr; }
  .cmr2-sidebar { position: static; }
}
@media (max-width: 768px) {
  .cmr2-sticky { display: flex; }
  .cmr2-wrap { padding-bottom: 100px; }
  .cmr2-title { font-size: 24px; }
  .cmr2-item {
    grid-template-columns: 90px 1fr;
    grid-template-areas:
      "thumb body"
      "price price";
    gap: 14px;
    padding: 16px 18px;
  }
  .cmr2-item-thumb { grid-area: thumb; }
  .cmr2-item-body { grid-area: body; }
  .cmr2-item-price {
    grid-area: price;
    text-align: right;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
    margin-top: 6px;
    min-width: 0;
  }
  .cmr2-item-thumb img { width: 90px; height: 90px; }
  .cmr2-item-name { font-size: 15px; margin-bottom: 12px; }
  .cmr2-price-new { font-size: 19px; }
}
