/* ==========================================================================
   VARIABLES GLOBALES (:root)
   Sustituye estos valores por los reales de tu sistema de diseño
   ========================================================================== */
:root {
  /* Tipografía */
  --text-2xs: 0.625rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;
  
  --lh-base: 1.5;
  --lh-snug: 1.2;
  
  --ls-snug: -0.01em;
  --ls-wider: 0.05em;

  /* Colores - Texto */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-disabled: #9ca3af;
  
  /* Colores - Bordes y Fondos */
  --bg-body: #ffffff;
  --border-default: #e5e7eb;
  --border-subtle: #f3f4f6;
  --line: #e5e7eb;
  --white: #ffffff;
  --white-92: rgba(255, 255, 255, 0.92);
  --muted-2: #9ca3af;
  --tint: #f3f4f6;
  --tint-2: #f9fafb;
  --ink-3: #374151;

  /* Colores - Marca y Estados */
  --brand: #3b82f6;
  --brand-hover: #2563eb;
  --brand-deep: #1d4ed8;
  --brand-dark: #1e3a8a;
  --brand-soft: #eff6ff;
  --brand-25: rgba(59, 130, 246, 0.25);
  --accent: #8b5cf6;
  --warn: #f59e0b;
  --error: #ef4444;
  --success: #10b981;

  /* Radios y Sombras */
  --r-md: 0.375rem;
  --r-lg: 0.5rem;
  --r-xl: 0.75rem;
  --r-pill: 9999px;
  
  --sh-1: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --sh-2: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --sh-3: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Transiciones y Focus */
  --dur-fast: 150ms;
  --dur-base: 300ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  
  --focus-width: 2px;
  --focus-color: var(--brand);
  --focus-offset: 2px;
}

/* =============================================================================
   00 · CHROME DE PÁGINA
   ============================================================================= */
.page-cart {
  padding-block: 56px 88px;
}

@media (max-width: 767px) {
  .page-cart {
    padding-block: 36px 56px;
  }
}

.page-cart__head {
  margin-bottom: 40px;
}

@media (max-width: 767px) {
  .page-cart__head {
    margin-bottom: 28px;
  }
}

.page-cart__title {
  margin-top: 16px;
}

.page-cart__sub {
  margin-top: 16px;
  max-width: 560px;
  font-size: var(--text-base);
  line-height: var(--lh-base);
  color: var(--text-muted);
}

/* =============================================================================
   01 · LAYOUT PRINCIPAL (ítems | totales)
   ============================================================================= */
.cart__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

@media (max-width: 991px) {
  .cart__layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.cart__main {
  min-width: 0;
}

.cart__aside {
  position: sticky;
  top: 96px;
}

@media (max-width: 991px) {
  .cart__aside {
    position: static;
  }
}

/* =============================================================================
   02 · CABECERA DE COLUMNAS (oculta en móvil)
   ============================================================================= */
.cart__head {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 110px 116px 116px 44px;
  align-items: center;
  gap: 16px;
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--border-default);
}

@media (max-width: 767px) {
  .cart__head {
    display: none;
  }
}

.cart__head-cell {
  font-size: var(--text-2xs);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-muted);
}

.cart__head-cell--product {
  grid-column: 1 / 3;
}

.cart__head-cell--price,
.cart__head-cell--qty,
.cart__head-cell--subtotal {
  text-align: center;
}

/* =============================================================================
   03 · ÍTEMS
   ============================================================================= */
.cart__items {
  width: 100%;
}

.cart__item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 110px 116px 116px 44px;
  align-items: center;
  gap: 16px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── Móvil: tarjeta apilada con áreas ────────────────────────────────────── */
@media (max-width: 767px) {
  .cart__item {
    position: relative;
    grid-template-columns: 64px 1fr;
    grid-template-areas:
      'media name'
      'media price'
      'qty   qty'
      'sub   sub';
    gap: 6px 14px;
    padding: 18px;
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    margin-bottom: 14px;
  }
}

.cart__cell {
  min-width: 0;
}

@media (max-width: 767px) {
  .cart__cell--media { grid-area: media; }
  .cart__cell--name { grid-area: name; }
}

.cart__cell--price {
  text-align: center;
}

@media (max-width: 767px) {
  .cart__cell--price {
    grid-area: price;
    text-align: left;
  }
}

.cart__cell--qty {
  display: flex;
  justify-content: center;
}

@media (max-width: 767px) {
  .cart__cell--qty {
    grid-area: qty;
    justify-content: flex-start;
    margin-top: 6px;
  }
}

.cart__cell--subtotal {
  text-align: center;
  font-weight: var(--fw-bold);
}

@media (max-width: 767px) {
  .cart__cell--subtotal {
    grid-area: sub;
    text-align: left;
  }
}

.cart__cell--remove {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 767px) {
  .cart__cell--remove {
    position: absolute;
    top: 12px;
    right: 12px;
  }
}

/* Etiquetas inline en móvil (usan el data-title de las celdas) */
@media (max-width: 767px) {
  .cart__cell--price::before,
  .cart__cell--subtotal::before {
    content: attr(data-title) ': ';
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
  }
}

/* ── Miniatura ──────────────────────────────────────────────────────────────── */
.cart__cell--media img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 1px solid var(--border-subtle);
  background: var(--tint-2);
}

.cart__cell--media .cart__thumb-link {
  display: block;
  transition: transform var(--dur-base) var(--ease);
}

.cart__cell--media .cart__thumb-link:hover {
  transform: translateY(-2px);
}

/* ── Nombre + meta ────────────────────────────────────────────────────────────── */
.cart__cell--name .cart__item-name,
.cart__cell--name a {
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: var(--lh-snug);
  transition: color var(--dur-fast) var(--ease);
}

.cart__cell--name .cart__item-name:hover,
.cart__cell--name a:hover {
  color: var(--brand-deep);
}

/* Meta de variaciones / add-ons */
.cart__cell--name .variation,
.cart__cell--name dl.variation {
  margin: 6px 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.cart__cell--name .variation dt,
.cart__cell--name .variation dd,
.cart__cell--name dl.variation dt,
.cart__cell--name dl.variation dd {
  display: inline;
  margin: 0;
}

.cart__cell--name .variation dt,
.cart__cell--name dl.variation dt {
  font-weight: var(--fw-semibold);
}

.cart__cell--name .variation dd,
.cart__cell--name dl.variation dd {
  margin-right: 8px;
}

.cart__cell--name .variation dd p,
.cart__cell--name dl.variation dd p {
  margin: 0;
  display: inline;
}

.cart__cell--name .backorder_notification {
  margin: 6px 0 0;
  font-size: var(--text-xs);
  color: var(--warn);
}

/* ── Precio / subtotal ────────────────────────────────────────────────────────── */
.cart__cell--price,
.cart__cell--subtotal {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.cart__cell--price .woocommerce-Price-amount,
.cart__cell--subtotal .woocommerce-Price-amount {
  white-space: nowrap;
}

.cart__cell--price del,
.cart__cell--subtotal del {
  color: var(--muted-2);
  font-weight: var(--fw-regular);
  margin-right: 6px;
}

.cart__cell--price ins,
.cart__cell--subtotal ins {
  text-decoration: none;
  color: var(--text-primary);
}

.cart__cell--subtotal {
  color: var(--text-primary);
  font-size: var(--text-base);
}

/* ── Cantidad (input nativo .qty reestilizado) ────────────────────────────────── */
.cart__cell--qty .quantity {
  display: inline-flex;
  align-items: center;
}

.cart__cell--qty .qty {
  width: 72px;
  height: 44px;
  padding: 0 10px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  background: var(--bg-body);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  /*-moz-appearance: textfield;*/
  transition: border-color var(--dur-fast) var(--ease);
}

.cart__cell--qty .qty::-webkit-outer-spin-button,
.cart__cell--qty .qty::-webkit-inner-spin-button {
  margin: 0;
}

.cart__cell--qty .qty:hover {
  border-color: var(--muted-2);
}

.cart__cell--qty .qty:focus {
  outline: none;
}

.cart__cell--qty .qty:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
  border-color: transparent;
}

/* ── Eliminar ítem ────────────────────────────────────────────────────────────── */
.cart__remove,
a.remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  color: var(--text-muted);
  background: var(--tint);
  transition: all var(--dur-fast) var(--ease);
}

.cart__remove:focus-visible,
a.remove:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

.cart__remove:hover,
a.remove:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.10);
}

/* =============================================================================
   04 · ACCIONES (cupón + actualizar)
   ============================================================================= */
.cart__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 4px 4px;
}

@media (max-width: 575px) {
  .cart__actions {
    flex-direction: column;
    align-items: stretch;
  }
}

.cart__coupon {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  max-width: 420px;
}

@media (max-width: 575px) {
  .cart__coupon {
    max-width: none;
  }
}

.cart__coupon-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  padding: 0 16px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-body);
  border: 1px solid var(--border-default);
  border-radius: var(--r-pill);
  transition: border-color var(--dur-fast) var(--ease);
}

.cart__coupon-input::placeholder {
  color: var(--text-disabled);
}

.cart__coupon-input:hover {
  border-color: var(--muted-2);
}

.cart__coupon-input:focus {
  outline: none;
}

.cart__coupon-input:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
  border-color: transparent;
}

.cart__coupon-btn,
.cart__update {
  white-space: nowrap;
  flex-shrink: 0;
}

/* =============================================================================
   05 · PANEL DE TOTALES (card)
   ============================================================================= */
.cart-totals {
  background: var(--white);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
  padding: 28px;
}

@media (max-width: 767px) {
  .cart-totals {
    padding: 22px;
  }
}

.cart-totals__title {
  margin: 0 0 18px;
  font-size: var(--text-lg);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-snug);
  color: var(--text-primary);
}

.cart-totals__table {
  display: flex;
  flex-direction: column;
}

.cart-totals__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}

.cart-totals__row:first-child {
  padding-top: 0;
}

.cart-totals__label {
  color: var(--text-muted);
}

.cart-totals__value {
  text-align: right;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.cart-totals__value .woocommerce-Price-amount {
  white-space: nowrap;
}

.cart-totals__value small {
  display: block;
  font-weight: var(--fw-regular);
  color: var(--text-disabled);
  font-size: var(--text-2xs);
}

/* Fila total destacada */
.cart-totals .order-total {
  margin-top: 4px;
  padding-top: 18px;
  border-bottom: 0;
  border-top: 2px solid var(--line);
}

.cart-totals__value--total {
  font-size: var(--text-lg);
  font-weight: var(--fw-extrabold);
  color: var(--brand-deep);
}

/* Descuento de cupón */
.cart-totals .cart-discount .cart-totals__value {
  color: var(--success);
}

/* ── Métodos de envío dentro del panel ────────────────────────────────────────── */
.cart__shipping-methods {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.cart__shipping-method {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: var(--text-sm);
}

.cart__shipping-method input[type='radio'] {
  accent-color: var(--accent);
  margin-top: 2px;
}

.cart__shipping-method label {
  color: var(--text-secondary);
  cursor: pointer;
}

.cart__shipping-destination {
  margin: 10px 0 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.cart__shipping-destination strong {
  color: var(--text-secondary);
  font-weight: var(--fw-semibold);
}

/* Enlace "Calcular envío" / formulario del calculador */
.shipping-calculator-button {
  display: inline-block;
  margin-top: 8px;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.shipping-calculator-button:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

/* =============================================================================
   06 · BOTÓN FINALIZAR COMPRA
   ============================================================================= */
.cart-totals__checkout,
.wc-proceed-to-checkout {
  margin-top: 22px;
}

.wc-proceed-to-checkout .checkout-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  line-height: 1;
  color: var(--brand-dark);
  background: var(--brand);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-1);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}

.wc-proceed-to-checkout .checkout-button:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

.wc-proceed-to-checkout .checkout-button::after {
  content: '';
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--dur-fast) var(--ease);
}

.wc-proceed-to-checkout .checkout-button:hover {
  background: var(--brand-hover);
  transform: translateY(-2px);
  box-shadow: var(--sh-3);
}

.wc-proceed-to-checkout .checkout-button:hover::after {
  transform: translateX(3px);
}

/* =============================================================================
   07 · VENTA CRUZADA
   ============================================================================= */
.cart-cross-sells {
  margin-top: clamp(48px, 7vw, 80px);
}

.cart-cross-sells__head {
  margin-bottom: 24px;
}

.cart-cross-sells__title {
  font-size: var(--text-xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-snug);
  color: var(--text-primary);
}

.cart-cross-sells ul.products {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 24px;
}

.cart-cross-sells ul.products li.product {
  position: relative;
  display: flex;
  flex-direction: column;
}

.cart-cross-sells ul.products li.product .woocommerce-loop-product__link,
.cart-cross-sells ul.products li.product a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.cart-cross-sells ul.products li.product img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--r-lg);
  background: var(--tint-2);
  margin-bottom: 12px;
  transition: transform var(--dur-base) var(--ease);
}

.cart-cross-sells ul.products li.product:hover img {
  transform: translateY(-3px);
  box-shadow: var(--sh-2);
}

.cart-cross-sells ul.products li.product .woocommerce-loop-product__title {
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  margin-bottom: 4px;
  color: var(--text-primary);
}

.cart-cross-sells ul.products li.product .price {
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.cart-cross-sells ul.products li.product .price del {
  color: var(--muted-2);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  margin-right: 8px;
}

.cart-cross-sells ul.products li.product .price ins {
  text-decoration: none;
}

.cart-cross-sells ul.products li.product .button,
.cart-cross-sells ul.products li.product .add_to_cart_button {
  margin-top: auto;
  display: block;
  text-align: center;
  padding: 10px;
  background: var(--tint);
  border-radius: var(--r-md);
  font-weight: var(--fw-semibold);
  font-size: var(--text-sm);
  color: var(--text-primary);
  transition: background var(--dur-fast) var(--ease);
}

.cart-cross-sells ul.products li.product .button:focus-visible,
.cart-cross-sells ul.products li.product .add_to_cart_button:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

.cart-cross-sells ul.products li.product .button:hover,
.cart-cross-sells ul.products li.product .add_to_cart_button:hover {
  background: var(--line);
}

.cart-cross-sells ul.products li.product .added_to_cart {
  margin-top: 8px;
  display: block;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── WPRY Commerce Kit · módulo Wishlist ────────────────────────────── */
.cart-cross-sells ul.products li.product .wck-wl-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--r-pill);
  background: var(--white-92);
  color: var(--ink-3);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--sh-1);
  font-size: 0;
  transition: transform var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.cart-cross-sells ul.products li.product .wck-wl-btn:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

.cart-cross-sells ul.products li.product .wck-wl-btn:hover {
  transform: scale(1.08);
  color: var(--error);
  background: var(--white);
}

.cart-cross-sells ul.products li.product .wck-wl-btn[data-in='1'],
.cart-cross-sells ul.products li.product .wck-wl-btn.is-active {
  color: var(--error);
}

.cart-cross-sells ul.products li.product .wck-wl-btn svg,
.cart-cross-sells ul.products li.product .wck-wl-btn i {
  font-size: 16px;
}

/* =============================================================================
   08 · CARRITO VACÍO
   ============================================================================= */
.cart-empty {
  max-width: 520px;
  margin-inline: auto;
  padding: clamp(40px, 6vw, 72px) 24px;
  text-align: center;
}

.cart-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  margin-bottom: 24px;
  border-radius: var(--r-pill);
  color: var(--brand-deep);
  background: var(--brand-soft);
  border: 1px solid var(--brand-25);
}

.cart-empty .woocommerce-info,
p.cart-empty {
  margin: 0 0 8px;
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.cart-empty__action {
  margin-top: 28px;
}

/* =============================================================================
   09 · MENSAJES (notices) dentro de la página de carrito
   ============================================================================= */
.page-cart .woocommerce-message,
.page-cart .woocommerce-error,
.page-cart .woocommerce-info:not(.cart-empty) {
  margin: 0 0 24px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  border: 1px solid var(--border-default);
  background: var(--tint);
  list-style: none;
}

.page-cart .woocommerce-message {
  border-color: rgba(16, 185, 129, 0.30);
  background: rgba(16, 185, 129, 0.07);
}

.page-cart .woocommerce-error {
  border-color: rgba(239, 68, 68, 0.30);
  background: rgba(239, 68, 68, 0.07);
}