/**
 * CARD COMPONENTS CSS - Estilos de componentes individuales
 * 
 * CONTENIDO:
 * - Badge de categoría (perro/gato)
 * - Badge de descuento
 * - Variaciones de producto
 * - Imagen del producto
 * - Precio y título
 * - Controles de cantidad
 * - Botón add to cart
 * 
 * NOTA: Solo colores, bordes, estructura base y !important mínimos.
 *       Todo lo responsive se gestiona en card-grid-responsive.css
 */

/* ===================================================================
   CONTENEDOR DE BADGES
   ================================================================= */

.meloopets-badges-container {
  position: absolute;
  top: -1px;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  pointer-events: none;
}

/* ===================================================================
   BADGE DE CATEGORÍA (PERRO/GATO)
   ================================================================= */

.meloopets-product-badge {
  display: block;
}

.meloopets-product-badge img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0 7px 0 0;
}

/* ===================================================================
   BADGE DE DESCUENTO
   ================================================================= */

.meloopets-discount-badge {
  background: var(--meloopets-card-orange);
  border-radius: 0 0 var(--meloopets-card-radius-small) var(--meloopets-card-radius-small);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.meloopets-discount-content {
  text-align: center;
  color: white;
  font-family: var(--meloopets-card-font-family);
  font-weight: 700;
  line-height: 1;
}

.meloopets-discount-percentage {
  display: block;
  letter-spacing: -0.3px;
}

.meloopets-discount-text {
  display: block;
  letter-spacing: 0.3px;
}

/* ===================================================================
   VARIACIONES DE PRODUCTO
   ================================================================= */

.meloopets-product-variations {
  display: flex;
  flex-direction: column;
}

.meloopets-variation-btn {
  border-radius: var(--meloopets-card-radius-small);
  font-weight: 600;
  border: 2px solid #ddd;
  background: white;
  cursor: pointer;
  font-family: var(--meloopets-card-font-family);
  letter-spacing: 0.5px;
  color: var(--meloopets-card-brown);
  transition: all 0.3s ease;
  white-space: nowrap;
  text-align: center;
}

.meloopets-variation-btn:hover {
  border-color: var(--meloopets-card-orange);
  color: var(--meloopets-card-orange);
}

.meloopets-variation-btn.active {
  background: var(--meloopets-card-orange);
  color: white;
  border-color: var(--meloopets-card-orange);
  font-weight: 600;
}

.meloopets-variation-btn.meloopets-more-options {
  background: #f5f5f5;
  color: #666;
  font-style: italic;
}

.meloopets-variation-btn.meloopets-more-options:hover {
  background: #e0e0e0;
}

/* ===================================================================
   IMAGEN DEL PRODUCTO
   ================================================================= */

.meloopets-product-image {
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--meloopets-card-radius-small);
}

.meloopets-product-thumbnail {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
  transition: transform 0.3s ease;
}

.meloopets-product-card:hover .meloopets-product-thumbnail {
  transform: scale(1.05);
}

/* ===================================================================
   PRECIO DEL PRODUCTO
   ================================================================= */

.meloopets-product-price {
  margin: 0;
  text-align: left;
  justify-content: flex-start;
}

.meloopets-product-price .sale-price,
.meloopets-product-price .amount {
  color: var(--meloopets-card-orange) !important;
  font-size: 1.2em;
  font-weight: 600 !important;
  font-family: var(--meloopets-card-font-family) !important;
}

.meloopets-product-price .sale-price ins {
  text-decoration: none;
}

.meloopets-product-price .sale-price ins .amount {
  color: var(--meloopets-card-orange) !important;
  background: none;
  text-decoration: none;
}

.meloopets-product-price .sale-price del .amount {
  color: var(--meloopets-card-brown) !important;
}

/* ===================================================================
   TÍTULO DEL PRODUCTO
   ================================================================= */

.meloopets-product-title {
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  color: var(--meloopets-card-brown) !important;
  font-family: var(--meloopets-card-font-family) !important;
  line-height: 1.3 !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  justify-content: flex-start;
}

/* ===================================================================
   CONTROLES DE CANTIDAD
   ================================================================= */

.meloopets-quantity-controls {
  display: flex;
  flex-direction: column;
}

.meloopets-quantity-label {
  color: var(--meloopets-card-brown);
  font-weight: 600;
  font-family: var(--meloopets-card-font-family);
}

.meloopets-quantity-wrapper {
  display: flex;
  align-items: center;
}

.meloopets-quantity-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--meloopets-card-orange);
  transition: all 0.3s ease;
}

.meloopets-quantity-btn:hover {
  background: rgba(242, 103, 34, 0.1);
}

.meloopets-quantity-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.meloopets-quantity-input {
  font-weight: 600;
  text-align: center;
  line-height: 28px;
  background-color: var(--meloopets-card-orange);
  color: white;
  border-radius: 5px;
  border: none;
  outline: none;
  font-family: var(--meloopets-card-font-family);
}

/* ===================================================================
   BOTÓN ADD TO CART
   ================================================================= */

.meloopets-add-to-cart-btn {
  flex-grow: 1;
  background: var(--meloopets-card-green);
  color: white;
  border: none;
  border-radius: var(--meloopets-card-radius-medium);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--meloopets-card-font-family);
  letter-spacing: 1px;
  transition: all 0.3s ease;
}

.meloopets-add-to-cart-btn:hover {
  background: #245530;
  transform: translateY(-1px);
}

.meloopets-add-to-cart-btn:active {
  transform: translateY(0);
}

.meloopets-add-to-cart-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.meloopets-add-to-cart-btn.not-purchasable {
  background: #999;
  cursor: not-allowed;
}

.meloopets-card-actions .meloopets-cart-icon {
  fill: white;
  flex-shrink: 0;
}

.meloopets-button-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================================================================
   ESTADOS ESPECIALES DE COMPONENTES
   ================================================================= */

.meloopets-product-card.out-of-stock .meloopets-add-to-cart-btn {
  background: #ccc;
  cursor: not-allowed;
}

.meloopets-product-card.out-of-stock .meloopets-variation-btn {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===================================================================
   ESTADOS DINÁMICOS DEL BOTÓN ADD TO CART
   ================================================================= */

.meloopets-add-to-cart-btn {
  --button-bg: var(--meloopets-card-orange);
  background: var(--button-bg) !important;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.meloopets-add-to-cart-btn:disabled,
.meloopets-add-to-cart-btn.not-purchasable {
  background: #ccc !important;
  cursor: not-allowed;
  opacity: 0.6;
}

.meloopets-add-to-cart-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}

.meloopets-add-to-cart-btn.loading .meloopets-cart-icon {
  animation: spin 1s linear infinite;
}

.meloopets-add-to-cart-btn.success-state {
  background: var(--button-bg, #4A7356);
  transform: scale(1.05);
}

.meloopets-add-to-cart-btn.error-state {
  --button-bg: var(--meloopets-error-color, #f44336);
  animation: shake 0.5s ease-in-out;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Hover states - only for purchasable buttons */
.meloopets-add-to-cart-btn.purchasable:hover:not(.loading):not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
