﻿/* Drawer mÃ³vil / header */
.te-cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.te-cart-drawer.is-open {
  pointer-events: auto;
}

.te-cart-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.te-cart-drawer.is-open .te-cart-drawer-backdrop {
  opacity: 1;
}

.te-cart-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(100%, 380px);
  height: 100%;
  max-height: 100dvh;
  background: #fff;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
}

.te-cart-drawer.is-open .te-cart-drawer-panel {
  transform: translateX(0);
}

.te-cart-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.te-cart-drawer-head h2 {
  margin: 0;
  font-size: 1.0625rem;
}

.te-cart-drawer-head button {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
}

#cart-drawer-body,
#te-cart-items-container.te-cart-drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1rem 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.te-cart-drawer-totals {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
}

.te-cart-drawer-totals .woocommerce-mini-cart__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  font-weight: 700;
  color: #0f172a;
}

.te-cart-drawer-foot {
  flex-shrink: 0;
  padding: 1rem 1.25rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  border-top: 1px solid #e5e7eb;
  background: #fff;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  position: sticky;
  bottom: 0;
  z-index: 2;
}

/* Mini-carrito WooCommerce dentro del drawer â€” layout minimalista */
.te-cart-drawer #te-cart-items-container ul.woocommerce-mini-cart {
  list-style: none !important;
  margin: 0;
  padding: 0;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart__buttons,
.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart__total {
  display: none !important;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item {
  list-style: none !important;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 28px;
  column-gap: 0.625rem;
  row-gap: 0.15rem;
  align-items: start;
  padding: 0.625rem 0;
  margin: 0;
  border-bottom: 1px solid #f1f5f9;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item::marker {
  content: none;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item a.remove {
  grid-column: 3;
  grid-row: 1;
  margin: 0;
  width: 28px;
  height: 28px;
  position: static !important;
  transform: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8 !important;
  font-size: 1.25rem !important;
  line-height: 1;
  text-decoration: none !important;
  font-weight: 400;
  transition: color 0.15s ease, background 0.15s ease;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item a.remove:hover {
  color: #ef4444 !important;
  background: #fef2f2;
}

/* Blocksy: imagen en enlace aparte — contenedor acotado */
.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item a.ct-media-container {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: block !important;
  width: 52px !important;
  max-width: 52px !important;
  min-width: 52px !important;
  height: 52px !important;
  max-height: 52px !important;
  overflow: hidden !important;
  flex: none !important;
  line-height: 0;
  font-size: 0;
  text-decoration: none;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item .product-data {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item .product-data .product-title {
  font-size: 0.8125rem;
  line-height: 1.35;
  font-weight: 500;
  color: #0f172a;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: normal;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item .product-data .quantity {
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}

.te-cart-drawer #te-cart-items-container .te-cart-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.te-cart-drawer #te-cart-items-container .product-data .te-cart-qty-row {
  margin-top: 0.2rem;
}

.te-cart-drawer #te-cart-items-container .te-cart-qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
}

.te-cart-drawer #te-cart-items-container .te-cart-qty.is-updating {
  opacity: 0.55;
  pointer-events: none;
}

.te-cart-drawer #te-cart-items-container .te-cart-qty button {
  width: 32px;
  height: 32px;
  border: none;
  background: #f8fafc;
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
  color: #334155;
  transition: background 0.15s ease, color 0.15s ease;
}

.te-cart-drawer #te-cart-items-container .te-cart-qty button:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.te-cart-drawer #te-cart-items-container .te-cart-qty-value {
  min-width: 1.75rem;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #0f172a;
  padding: 0 0.35rem;
  user-select: none;
}

.te-cart-drawer #te-cart-items-container .te-cart-line-price {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-left: auto;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item > .te-cart-qty-row {
  grid-column: 2;
  grid-row: 2;
  padding-left: calc(52px + 0.625rem);
}

/* WooCommerce estÃ¡ndar: un solo enlace con img + tÃ­tulo */
.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item > a:not(.remove):not(.ct-media-container) {
  grid-column: 1 / 3;
  grid-row: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0.625rem;
  align-items: center;
  text-decoration: none;
  color: #0f172a;
  font-weight: 500;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item .te-cart-item-title {
  font-size: 0.8125rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: break-word;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item img {
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  max-width: 52px !important;
  max-height: 52px !important;
  object-fit: contain !important;
  background: #f8fafc;
  border-radius: 8px;
  margin: 0 !important;
  padding: 3px;
  box-sizing: border-box;
  display: block !important;
}

.te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item > .quantity {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  padding-left: calc(52px + 0.625rem);
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
}

.te-cart-drawer-totals .woocommerce-mini-cart__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 0.625rem;
  padding: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
  border: none;
}

.te-cart-drawer-foot .te-cart-checkout-btn,
.te-cart-drawer-foot .te-mp-btn {
  width: 100%;
  margin-top: 0;
  min-height: 48px;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 10px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.te-cart-drawer-foot .te-cart-checkout-btn:hover:not(:disabled),
.te-cart-drawer-foot .te-mp-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}

.te-cart-drawer-link {
  display: block;
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
}

.te-cart-drawer-link:hover {
  text-decoration: underline;
}

/* MÃ³vil: bottom sheet + botÃ³n de pago siempre visible */
@media (max-width: 768px) {
  .te-cart-drawer-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: min(88dvh, 100dvh);
    max-height: 88dvh;
    transform: translateY(100%);
    border-radius: 16px 16px 0 0;
  }

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

  .te-cart-drawer-head {
    padding: 0.875rem 1rem;
    flex-shrink: 0;
  }

  .te-cart-drawer-head h2 {
    font-size: 1rem;
  }

  #cart-drawer-body,
  #te-cart-items-container.te-cart-drawer-body {
    padding: 0.75rem 1rem;
  }

  .te-cart-drawer-foot {
    padding: 0.875rem 1rem;
    padding-bottom: max(0.875rem, env(safe-area-inset-bottom));
  }

  .te-cart-drawer-foot .te-cart-checkout-btn,
  .te-cart-drawer-foot .te-mp-btn {
    min-height: 50px;
    font-size: 1rem;
    border-radius: 12px;
  }

  .te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item {
    grid-template-columns: 44px minmax(0, 1fr) 26px;
    column-gap: 0.5rem;
  }

  .te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item a.ct-media-container,
  .te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item > a:not(.remove):not(.ct-media-container) {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item a.ct-media-container {
    width: 44px !important;
    max-width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    max-height: 44px !important;
  }

  .te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item img {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
  }

  .te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item .product-data .product-title {
    font-size: 0.75rem;
  }

  .te-cart-drawer #te-cart-items-container .te-cart-qty button {
    width: 36px;
    height: 36px;
  }

  .te-cart-drawer #te-cart-items-container .woocommerce-mini-cart-item > .te-cart-qty-row {
    padding-left: calc(44px + 0.5rem);
  }
}

/* Desktop: panel lateral derecho */
@media (min-width: 769px) {
  .te-cart-drawer-panel {
    transform: translateX(100%);
  }

  .te-cart-drawer.is-open .te-cart-drawer-panel {
    transform: translateX(0);
  }
}

body.te-cart-open {
  overflow: hidden;
}
