/*
 * Dulce Lujuria - Módulo del Carrito Deslizante (Slide-over Mini Cart)
 * Panel lateral, scroll unificado, breakdown de precios y entrega discreta
 * Estándar UX E-commerce Móvil 2026
 */

.dl-cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 99999;
  visibility: hidden;
  transition: visibility 0.3s ease;
}
.dl-cart-drawer.active {
  visibility: visible;
}

.dl-cart-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.dl-cart-drawer.active .dl-cart-overlay {
  opacity: 1;
}

.dl-cart-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 440px;
  background-color: #171016;
  border-left: 1px solid var(--dl-border);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 1.5rem 1.5rem 1.25rem 1.5rem;
  box-sizing: border-box;
  overflow: hidden;
}
.dl-cart-drawer.active .dl-cart-panel {
  transform: translateX(0);
}

/* Header Fijo Superior */
.dl-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--dl-border-subtle);
  flex-shrink: 0;
}
.dl-cart-close {
  background: transparent;
  border: none;
  color: var(--dl-text-muted);
  cursor: pointer;
  font-size: 1.5rem;
  padding: 0.35rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  transition: color 0.2s ease, background 0.2s ease;
}
.dl-cart-close:hover {
  color: var(--dl-primary);
  background: rgba(225, 29, 116, 0.1);
}

/* =========================================================================
   Área de Scroll Unificado (Evita barras anidadas y colapso de productos)
   ========================================================================= */
.dl-cart-scroll-area {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0.25rem 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.dl-cart-scroll-area::-webkit-scrollbar {
  width: 5px;
}
.dl-cart-scroll-area::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}
.dl-cart-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(225, 29, 116, 0.3);
  border-radius: 9999px;
}
.dl-cart-scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--dl-primary);
}

/* Lista de Productos Agregados */
.dl-cart-items {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.dl-cart-item {
  display: flex;
  gap: 0.85rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--dl-border-subtle);
  border-radius: 0.85rem;
  position: relative;
  align-items: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.dl-cart-item:hover {
  border-color: rgba(225, 29, 116, 0.3);
  background: rgba(255, 255, 255, 0.04);
}
.dl-cart-item-img {
  width: 64px;
  height: 64px;
  border-radius: 0.65rem;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--dl-border-subtle);
}
.dl-cart-item-details {
  flex-grow: 1;
  min-width: 0;
}
.dl-cart-item-title {
  font-size: 0.9rem;
  font-family: var(--dl-font-display);
  margin-bottom: 0.25rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--dl-text);
}
.dl-cart-item-price {
  font-size: 0.88rem;
  color: var(--dl-primary);
  font-weight: 600;
  white-space: nowrap;
}
.dl-cart-qty-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
  background: var(--dl-surface);
  border: 1px solid var(--dl-border-subtle);
  border-radius: 9999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
}
.dl-cart-qty-btn {
  background: none;
  border: none;
  color: var(--dl-text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}
.dl-cart-qty-btn:hover {
  color: var(--dl-primary);
}
.dl-cart-remove-btn {
  background: transparent;
  border: none;
  color: var(--dl-text-muted);
  cursor: pointer;
  padding: 0.45rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  transition: all 0.2s ease;
  margin-left: auto;
  flex-shrink: 0;
}
.dl-cart-remove-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* Estado Vacío de la Bolsa */
.dl-cart-empty {
  text-align: center;
  padding: 3.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.dl-cart-empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 9999px;
  background: rgba(225, 29, 116, 0.08);
  border: 1px dashed var(--dl-primary);
  color: var(--dl-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  box-shadow: 0 0 25px -5px var(--dl-primary-glow);
}
.dl-cart-empty h4 {
  font-family: var(--dl-font-display);
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
  color: var(--dl-text);
}
.dl-cart-empty p {
  color: var(--dl-text-muted);
  font-size: 0.88rem;
  max-width: 270px;
  line-height: 1.6;
  margin-bottom: 1.75rem;
}

/* =========================================================================
   Barra de Progreso de Envío Gratis (Gamificación CRO 2026)
   ========================================================================= */
.dl-shipping-bar-wrap {
  background: rgba(225, 29, 116, 0.05);
  border: 1px solid rgba(225, 29, 116, 0.15);
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  transition: all 0.3s ease;
}
.dl-shipping-bar-wrap.is-unlocked {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.25);
}
.dl-shipping-bar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.dl-shipping-icon {
  color: var(--dl-primary);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.dl-shipping-bar-wrap.is-unlocked .dl-shipping-icon {
  color: #86efac;
  transform: scale(1.15);
}
.dl-shipping-bar-msg {
  font-size: 0.78rem;
  color: var(--dl-text);
  line-height: 1.35;
  font-weight: 500;
}
.dl-shipping-bar-wrap.is-unlocked .dl-shipping-bar-msg {
  color: #86efac;
  font-weight: 600;
}
.dl-shipping-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}
.dl-shipping-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--dl-primary) 0%, var(--dl-accent) 100%);
  border-radius: 9999px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 10px var(--dl-primary-glow);
}
.dl-shipping-bar-wrap.is-unlocked .dl-shipping-progress-fill {
  background: linear-gradient(90deg, #10b981 0%, #22c55e 100%);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.4);
}

/* =========================================================================
   Venta Cruzada en la Bolsa (Completa tu Momento / Upsell 1-clic)
   ========================================================================= */
.dl-cart-upsells-wrap {
  padding-top: 0.85rem;
  border-top: 1px solid var(--dl-border-subtle);
}
.dl-cart-upsell-title {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dl-text-muted);
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}
.dl-cart-upsell-title svg {
  color: var(--dl-primary);
}
.dl-cart-upsells-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.dl-cart-upsell-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--dl-border-subtle);
  border-radius: 0.75rem;
  padding: 0.5rem 0.65rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.dl-cart-upsell-item:hover {
  border-color: rgba(225, 29, 116, 0.3);
  background: rgba(255, 255, 255, 0.05);
}
.dl-cart-upsell-img {
  width: 44px;
  height: 44px;
  border-radius: 0.5rem;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--dl-border-subtle);
}
.dl-cart-upsell-details {
  flex-grow: 1;
  min-width: 0;
}
.dl-cart-upsell-name {
  font-size: 0.8rem;
  font-family: var(--dl-font-display);
  color: var(--dl-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.15rem;
}
.dl-cart-upsell-price {
  font-size: 0.75rem;
  color: var(--dl-primary);
  font-weight: 600;
}
.dl-cart-upsell-add-btn {
  background: transparent;
  border: 1px solid var(--dl-border);
  color: var(--dl-text);
  font-size: 0.72rem;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
  font-family: var(--dl-font-body);
  flex-shrink: 0;
}
.dl-cart-upsell-add-btn:hover {
  background: var(--dl-primary);
  border-color: var(--dl-primary);
  color: #fff;
  box-shadow: 0 0 10px var(--dl-primary-glow);
}

/* =========================================================================
   Formulario de Datos para Entrega Discreta
   ========================================================================= */
.dl-cart-form-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--dl-border-subtle);
  border-radius: 0.85rem;
  padding: 0.85rem 0.95rem;
}
.dl-cart-form-heading {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dl-text-muted);
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}
.dl-cart-form-fields .dl-input {
  font-size: 0.84rem;
  padding: 0.65rem 0.85rem;
  background: rgba(20, 15, 19, 0.75);
  border: 1px solid var(--dl-border);
  border-radius: 0.65rem;
  color: var(--dl-text);
  box-sizing: border-box;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.dl-cart-form-fields .dl-input:focus {
  outline: none;
  border-color: var(--dl-primary);
  box-shadow: 0 0 10px var(--dl-primary-glow);
}

/* =========================================================================
   Footer Fijo Inferior (Thumb Zone) - Subtotal, Botón y Garantías
   ========================================================================= */
.dl-cart-footer {
  flex-shrink: 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--dl-border-subtle);
  background: #171016;
  position: relative;
  z-index: 2;
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.4);
}
.dl-cart-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.025);
  padding: 0.75rem 0.95rem;
  border-radius: 0.85rem;
  border: 1px solid var(--dl-border-subtle);
}
.dl-cart-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.dl-cart-row-label,
.dl-cart-savings-label {
  font-size: 0.82rem;
  color: var(--dl-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.dl-cart-price-val,
.dl-cart-savings-val {
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.dl-cart-price-val {
  color: var(--dl-primary);
  font-size: 1.15rem;
}
.dl-cart-savings-val {
  color: #86efac;
  font-size: 0.9rem;
}
.dl-cart-dispatch-badge {
  font-size: 0.74rem;
  color: #86efac;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  text-align: right;
  white-space: nowrap;
}

.dl-cart-checkout-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 9999px;
  box-shadow: 0 0 25px var(--dl-primary-glow);
  box-sizing: border-box;
  cursor: pointer;
}

.dl-cart-payment-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 0.5rem;
  padding: 0.45rem 0.6rem;
  margin-top: 0.65rem;
  font-size: 0.72rem;
  color: var(--dl-text-muted);
  text-align: center;
  line-height: 1.35;
}


/* =========================================================================
   Aislamiento de Elementos Flotantes (Evita solapamientos con el Cajón)
   ========================================================================= */
body.dl-cart-open .dl-edit-fab,
body.dl-cart-open .dl-floating-wa,
body.dl-cart-open .dl-sticky-product-bar,
body:has(#dl-cart-drawer.active) .dl-edit-fab,
body:has(#dl-cart-drawer.active) .dl-floating-wa,
body:has(#dl-cart-drawer.active) .dl-sticky-product-bar {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(20px) !important;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

/* =========================================================================
   Optimización para Móviles Pequeños (<= 480px)
   ========================================================================= */
@media (max-width: 480px) {
  .dl-cart-panel {
    padding: 1.15rem 1rem 0.9rem 1rem;
    max-width: 100%;
  }
  .dl-cart-item-img {
    width: 56px;
    height: 56px;
  }
  .dl-cart-item-title {
    font-size: 0.84rem;
  }
  .dl-cart-item-price {
    font-size: 0.82rem;
  }
  .dl-cart-price-val {
    font-size: 1.05rem;
  }
  .dl-cart-row-label,
  .dl-cart-savings-label {
    font-size: 0.76rem;
  }
  .dl-cart-dispatch-badge {
    font-size: 0.68rem;
    padding: 0.12rem 0.45rem;
  }
  .dl-cart-breakdown {
    padding: 0.65rem 0.8rem;
    gap: 0.35rem;
  }
  .dl-cart-form-fields {
    padding: 0.7rem 0.75rem;
  }
  .dl-cart-form-fields .dl-input {
    font-size: 0.8rem;
    padding: 0.6rem 0.75rem;
  }
}
