/*
 * Carrito móvil Recovery.
 * Mantiene el drawer compacto con pocos productos y permite desplazamiento
 * interno cuando el carrito tiene más líneas.
 */
.cart-item-prices {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 8px;
  line-height: 1.25;
}

.cart-unit-price {
  color: #0f766e;
  font-size: 0.95rem;
  font-weight: 900;
}

.cart-unit-price small {
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 700;
}

.cart-line-subtotal {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
}

.cart-line-subtotal strong {
  color: #111418;
  font-weight: 900;
}

@media (max-width: 480px) {
  .cart-drawer {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1201;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    max-height: min(88dvh, 720px);
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -18px 44px rgba(15, 23, 42, 0.22);
    overflow: hidden;
    transform: translateY(105%);
  }

  .cart-drawer.open {
    transform: translateY(0);
  }

  .cart-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
    min-height: 58px;
    padding: 20px 16px 10px;
    border-bottom: 2px solid #111418;
  }

  .cart-header::before {
    top: 8px;
    width: 36px;
    height: 4px;
  }

  .cart-drawer-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
  }

  .cart-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f8f9fa;
    color: #4b5563;
    font-size: 1.45rem;
    line-height: 1;
  }

  .cart-close i,
  .cart-item-remove-btn i {
    display: none;
  }

  .cart-close::before,
  .cart-item-remove-btn::before {
    content: "\00d7";
    line-height: 1;
  }

  .cart-items {
    flex: 0 1 auto;
    min-height: 0;
    max-height: calc(88dvh - 222px);
    padding: 0 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #eef0f3;
  }

  .cart-item:last-child {
    border-bottom: 0;
  }

  .cart-item-img {
    width: 68px;
    height: 68px;
    padding: 4px;
    border-radius: 6px;
  }

  .cart-item-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
  }

  .cart-item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
  }

  .cart-item-info h4 {
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    margin: 0 0 4px;
    overflow: hidden;
    font-size: 0.78rem;
    line-height: 1.25;
    letter-spacing: 0;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .cart-item-prices {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 7px;
  }

  .cart-item-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    color: #4b5563;
    font-size: 1.25rem;
    line-height: 1;
  }

  .cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    border: 1px solid #dce1e7;
    border-radius: 6px;
    background: #f8f9fa;
    color: #111418;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .qty-btn:active {
    background: #111418;
    color: #fff;
  }

  .qty-btn:disabled {
    cursor: wait;
    opacity: 0.55;
  }

  .cart-item[aria-busy="true"] {
    opacity: 0.72;
  }

  .cart-item-qty .qty-value {
    min-width: 30px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 800;
  }

  .cart-footer {
    flex: 0 0 auto;
    padding: 14px 16px max(14px, env(safe-area-inset-bottom));
    border-top: 2px solid #111418;
    background: #fff;
  }

  .cart-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    width: 100%;
    padding: 12px 16px;
    background: #c94a0a;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .cart-footer .btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 8px !important;
    padding: 10px 12px !important;
    border: 2px solid #111418;
    background: #fff;
    color: #111418;
    font-size: 0.76rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
}

@media (max-width: 360px) {
  .cart-items {
    padding-right: 12px;
    padding-left: 12px;
  }

  .cart-item {
    gap: 9px;
  }

  .cart-item-img {
    width: 60px;
    height: 60px;
  }
}
/* El CTA fijo del producto no debe cubrir acciones del mini-carrito. */
body.cart-drawer-open #rg-sticky-atc {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
