/* =========================================
   VARIABLES (Valores por defecto)
   ========================================= */
:root {
  --mc-bg: #212723;
  --mc-text: #ffffff;
  --mc-cta: #006ABD;
  --mc-icon: #a7a7a7;    /* Iconos y textos secundarios */
  --mc-danger: #ff4d4d;  /* Botones de eliminar */
  --mc-success: #4caf50; /* Barra de envío */
  --mc-badge: #C84D21;   /* Contador */
  --mc-dim: rgba(255,255,255,0.15); /* Bordes y fondos suaves */
}

/* =========================================
   RESET ANTI-ELEMENTOR
   ========================================= */
#custom-cart-root {
  all: initial;
  font-family: 'Inter', sans-serif;
  box-sizing: border-box;
}

#custom-cart-root * {
  box-sizing: border-box;
}

#custom-cart-root h3, 
#custom-cart-root h4, 
#custom-cart-root p, 
#custom-cart-root ul, 
#custom-cart-root li, 
#custom-cart-root a,
#custom-cart-root button,
#custom-cart-root input {
  margin: 0;
  padding: 0;
  line-height: 1.4;
  color: inherit;
  font-weight: normal;
  text-decoration: none;
  list-style: none;
  background: transparent;
  border: none;
  letter-spacing: normal;
  text-transform: none;
}

/* =========================================
   ESTILOS DEL CARRITO
   ========================================= */

#custom-cart-root.custom-cart-popup {
  position: fixed;
  top: 1%;
  right: 0;
  width: 360px;
  height: 98%;
  background: var(--mc-bg);
  color: var(--mc-text);
  padding: 20px;
  overflow-y: auto;
  z-index: 99999;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
  border-radius: 20px 0px 0px 20px;
  display: block;
}

/* Header */
#custom-cart-root .cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  width: 100%;
}

#custom-cart-root .cart-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--mc-text);
}

#custom-cart-root .cart-close {
  font-size: 28px !important;
  color: var(--mc-icon);
  cursor: pointer;
  transition: color 0.2s;
  display: block;
}

#custom-cart-root .cart-close:hover {
  color: var(--mc-cta);
}

/* Lista Items */
#custom-cart-root ul.cart-items {
  margin-bottom: 15px;
  width: 100%;
}

#custom-cart-root .cart-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--mc-dim);
  width: 100%;
}

/* Imagen */
#custom-cart-root .cart-thumb img {
  width: 65px;
  height: 65px;
  border-radius: 8px;
  margin-right: 12px;
  object-fit: cover;
  border: none;
  box-shadow: none;
  display: block;
}

/* Info */
#custom-cart-root .cart-info {
  flex: 1;
  padding-right: 10px;
}

#custom-cart-root .cart-info a.cart-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  display: block;
  color: var(--mc-text);
}

#custom-cart-root .cart-info a.cart-name:hover {
  color: var(--mc-cta);
}

#custom-cart-root .remove-cart-item {
  color: var(--mc-icon);
  font-size: 18px;
  cursor: pointer;
  padding: 5px;
  transition: color 0.2s;
}

#custom-cart-root .remove-cart-item:hover {
  color: var(--mc-danger);
}

/* Controles Cantidad */
#custom-cart-root .cart-qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}

#custom-cart-root .qty-btn {
  background: var(--mc-dim);
  color: var(--mc-text);
  border-radius: 4px;
  width: 24px;
  height: 24px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 3px !important;
}

#custom-cart-root .qty-btn:hover {
  background: var(--mc-cta);
}

#custom-cart-root .qty-display {
  font-size: 14px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  display: inline-block;
}

#custom-cart-root .qty-price-x {
  font-size: 12px;
  color: var(--mc-icon);
  margin-left: 5px;
}

/* Subtotal */
#custom-cart-root .cart-subtotal {
  font-size: 20px;
  text-align: center;
  margin: 15px 0;
  padding-top: 10px;
  font-weight: 700;
  display: block;
  width: 100%;
}

/* Envío Gratis Wrapper */
#custom-cart-root .envio-gratis-wrapper p {
  text-align: center;
  border-radius: 33px;
  margin-bottom: 20px;
  width: 100%;
}

/* Cross Sells */
#custom-cart-root .cross-sells {
  width: 100%;
}

#custom-cart-root .cross-sells h4 {
  font-size: 16px;
  margin-bottom: 10px;
  opacity: 0.9;
  font-weight: 600;
  color: var(--mc-text);
}

#custom-cart-root .cross-sell-products {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

#custom-cart-root .cross-sell-item {
  position: relative;
  /* CORREGIDO: Usamos variable dim en lugar de rgba fijo */
  background: var(--mc-bg);
  border: 1px solid var(--mc-dim);
  border-radius: 10px;
  overflow: hidden;
  padding: 8px;
  transition: all 0.2s ease;
}

#custom-cart-root .cross-sell-item:hover {
  border-color: var(--mc-cta);
  background: color-mix(in srgb, var(--mc-cta), transparent 90%); 
}

#custom-cart-root .cross-sell-grid {
  display: grid;
  grid-template-columns: 10% 20% 60%;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  width: 100%;
}

#custom-cart-root .cross-sell-img img {
  width: 100%;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
}

#custom-cart-root .cross-sell-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#custom-cart-root .cross-sell-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--mc-text);
  display: block;
}

#custom-cart-root .cross-sell-price {
  font-size: 12px;
  /* CORREGIDO: Usamos variable icon */
  color: var(--mc-icon); 
}

#custom-cart-root .cross-sell-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--mc-cta);
  cursor: pointer;
  margin: 0;
  appearance: auto; 
}

/* Botones */
#custom-cart-root .cart-buttons {
  margin-top: auto;
  width: 100%;
}

#custom-cart-root .btn-checkout {
  display: block;
  text-align: center;
  padding: 15px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 16px;
  background: var(--mc-cta);
  color: #fff; /* Se mantiene blanco para asegurar contraste en botones sólidos */
  border: 1px solid var(--mc-cta);
  transition: all 0.3s ease;
}

#custom-cart-root .btn-checkout:hover {
  background: transparent;
  color: var(--mc-cta);
}

#custom-cart-root .cart-empty {
  text-align: center;
  margin-top: 50px;
  opacity: 0.6;
}

/* =========================================
   BARRA DE ENVÍO GRATIS
   ========================================= */
.envio-gratis-container {
    margin: 15px 0 20px 0;
    text-align: center;
    width: 100%;
}

.progress-bar-bg {
    background: var(--mc-dim);
    border-radius: 20px;
    overflow: hidden;
    height: 12px;
    width: 100%;
    margin-bottom: 10px;
}

.progress-bar-fill {
    background: var(--mc-success);
    height: 100%;
    transition: width 0.5s ease-out;
    border-radius: 20px;
}

.progress-text {
    font-size: 14px;
    color: var(--mc-text);
    line-height: 1.4;
}

.progress-text strong {
    /* CORREGIDO: Usamos variable de texto principal */
    color: var(--mc-text); 
    font-weight: 700;
}

.success-msg {
    color: var(--mc-success);
    font-weight: 600;
}


/* =========================================
   TRIGGER DEL CARRITO (BOTÓN MENÚ)
   ========================================= */
.custom-cart-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    color: inherit; 
    padding: 5px;
}

.custom-cart-trigger svg {
    width: 24px;
    height: 24px;
    stroke-width: 2px;
}

/* Badge del contador */
.custom-cart-count {
    position: absolute;
    top: -5px;
    right: -8px;
    background-color: var(--mc-badge);
    color: var(--mc-bg);
    font-size: 11px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#custom-cart-overlay {
    backdrop-filter: blur(2px);
}