/**
 * WooCommerce Custom Styles
 * Personalización del tema para WooCommerce
 */

/* ============================================
   PRODUCTOS
   ============================================ */

.woocommerce,
.woocommerce-page {
  font-family: var(--font-family-sans);
}

/* Grid de productos */
.products {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-lg);
  list-style: none;
  margin: 0;
  padding: 0;
}

.product {
  background-color: var(--color-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
}

.product:hover {
  border-color: var(--color-secondary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

/* Imagen del producto */
.product img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
  background-color: var(--color-primary-dark);
}

.product .product-image {
  position: relative;
  overflow: hidden;
  background-color: var(--color-primary-dark);
}

/* Contenido del producto */
.product-inner {
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Título del producto */
.product-title,
.product .product-name {
  color: var(--color-text-primary);
  font-size: 1rem;
  font-weight: var(--font-weight-semi);
  margin-bottom: var(--spacing-sm);
  line-height: 1.3;
}

.product-title a {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.product-title a:hover {
  color: var(--color-secondary);
}

/* Descripción */
.product-description {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin-bottom: var(--spacing-md);
  flex-grow: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Precio */
.price {
  color: var(--color-accent);
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
  font-family: var(--font-family-mono);
  margin-bottom: var(--spacing-md);
}

.price ins {
  text-decoration: none;
  color: var(--color-accent);
}

.price del {
  color: var(--color-text-light);
  font-size: 0.875rem;
  opacity: 0.7;
}

/* Stock */
.stock {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: var(--font-weight-semi);
  margin-bottom: var(--spacing-md);
  text-transform: uppercase;
}

.stock.in-stock {
  background-color: rgba(37, 211, 102, 0.1);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.stock.out-of-stock {
  background-color: rgba(255, 59, 92, 0.1);
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

/* Botones en lista de productos */
.product .button,
.product .add_to_cart_button,
.product .product-action {
  width: 100%;
  text-align: center;
  margin-top: auto;
}

/* ============================================
   PÁGINA DE PRODUCTO INDIVIDUAL
   ============================================ */

.single-product {
  background-color: var(--color-primary-dark);
}

.single-product .product-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-2xl);
  margin-bottom: var(--spacing-3xl);
}

/* Galería */
.product-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.product-gallery img {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.gallery-thumbnails {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-md);
}

.gallery-thumbnails img {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.gallery-thumbnails img:hover,
.gallery-thumbnails img.active {
  border-color: var(--color-secondary);
}

/* Información del producto */
.product-info {
  display: flex;
  flex-direction: column;
}

.product-info h1 {
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-md);
  font-size: 2.25rem;
}

.product-meta {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
  align-items: center;
}

.product-meta-item {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

/* Rating */
.star-rating {
  color: var(--color-accent);
  margin-bottom: var(--spacing-md);
}

/* Precio grande */
.product-info .price {
  font-size: 2rem;
  margin-bottom: var(--spacing-lg);
}

/* Descripción corta */
.short-description {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
  font-size: 1.125rem;
  line-height: 1.6;
}

/* SKU y stock */
.product-meta-sku,
.product-meta-stock {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-family: var(--font-family-mono);
}

/* Variaciones */
.variations {
  margin-bottom: var(--spacing-lg);
}

.variation {
  margin-bottom: var(--spacing-lg);
}

.variation label {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-semi);
  margin-bottom: var(--spacing-sm);
  display: block;
}

.variation select {
  width: 100%;
  padding: var(--spacing-md);
  background-color: var(--color-primary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* Cantidad y botones */
.product-actions {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
}

.qty-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.qty-input input[type="number"] {
  border: none;
  width: 80px;
  padding: var(--spacing-md);
  text-align: center;
  background-color: var(--color-primary);
  color: var(--color-text-primary);
}

.qty-input button {
  background-color: var(--color-primary);
  color: var(--color-text-primary);
  border: none;
  padding: var(--spacing-md) var(--spacing-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.qty-input button:hover {
  background-color: var(--color-border);
  color: var(--color-secondary);
}

/* Tabs de descripción */
.product-tabs {
  margin-top: var(--spacing-3xl);
  border-top: 1px solid var(--color-border);
}

.tab-nav {
  display: flex;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
}

.tab-nav li {
  list-style: none;
}

.tab-nav a {
  color: var(--color-text-secondary);
  text-decoration: none;
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.tab-nav a.active {
  color: var(--color-secondary);
  border-bottom-color: var(--color-secondary);
}

.tab-content {
  color: var(--color-text-primary);
  line-height: 1.8;
}

/* ============================================
   CARRITO
   ============================================ */

.cart {
  margin-bottom: var(--spacing-2xl);
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--color-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.cart-table th {
  background-color: var(--color-primary);
  color: var(--color-text-primary);
  padding: var(--spacing-lg);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-weight: var(--font-weight-semi);
}

.cart-table td {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
}

.cart-table tr:last-child td {
  border-bottom: none;
}

.cart-item-name a {
  color: var(--color-secondary);
}

/* Resumen del carrito */
.cart-totals {
  background-color: var(--color-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.cart-total-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
  font-size: 1.25rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
}

/* ============================================
   CHECKOUT
   ============================================ */

.checkout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--spacing-2xl);
}

.checkout-form {
  background-color: var(--color-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
}

.checkout-form h3 {
  color: var(--color-secondary);
  margin-bottom: var(--spacing-lg);
}

.checkout-review {
  background-color: var(--color-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  height: fit-content;
  position: sticky;
  top: 100px;
}

.order-review h3 {
  color: var(--color-secondary);
  margin-bottom: var(--spacing-lg);
}

/* ============================================
   MENSAJES
   ============================================ */

.woocommerce-message,
.woocommerce-notice,
.woocommerce-info {
  background-color: rgba(37, 211, 102, 0.1);
  color: var(--color-success);
  border-left: 4px solid var(--color-success);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  border-radius: var(--radius-md);
}

.woocommerce-error {
  background-color: rgba(255, 59, 92, 0.1);
  color: var(--color-danger);
  border-left-color: var(--color-danger);
}

.woocommerce-warning {
  background-color: rgba(255, 184, 0, 0.1);
  color: var(--color-accent);
  border-left-color: var(--color-accent);
}

/* ============================================
   RESPONSIVE WOOCOMMERCE
   ============================================ */

@media (max-width: 767px) {
  .products {
    grid-template-columns: 1fr;
  }

  .single-product .product-main {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .product-info h1 {
    font-size: 1.5rem;
  }

  .product-actions {
    flex-direction: column;
  }

  .product-actions > * {
    width: 100%;
  }

  .checkout {
    grid-template-columns: 1fr;
  }

  .checkout-review {
    position: static;
  }

  .cart-table {
    font-size: 0.875rem;
  }

  .cart-table th,
  .cart-table td {
    padding: var(--spacing-md);
  }

  .gallery-thumbnails {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1023px) {
  .products {
    grid-template-columns: repeat(2, 1fr);
  }
}
