/**
 * Product Cards Styles
 * Estilos para las tarjetas de productos según diseño proporcionado
 */

/* ==========================================================================
   PRODUCT CARD BASE STYLES
   ========================================================================== */

.product-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Product Image Container */
.product-image-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Product Badges */
.product-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.product-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    color: #fff;
}

.product-badge.sale {
    background: #e74c3c;
}

/* Color tiers managed in WooCommerce → Etiquetas de Descuento (inline style override) */

.product-badge.new {
    background: #27ae60;
}

.product-badge.featured {
    background: #f39c12;
}

.product-badge.out-of-stock {
    background: #95a5a6;
}

/* Product Content */
.product-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 10px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 500;
}

.product-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 0 0 12px 0;
    line-height: 1.3;
    flex: 1;
}

.product-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* Product Pricing */

.price-current {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.price-original {
    font-size: 0.9rem;
    color: #6c757d;
    text-decoration: line-through;
}

.price-from {
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* Product Actions */
.product-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.btn-add-to-cart {
    flex: 1;
    padding: 8px 14px;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    line-height: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-add-to-cart:hover {
    background: var(--primary-color);
    color:#fff !important;
    transform: translateY(-1px);
}

.btn-quick-view,
.btn-wishlist {
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--secondary-color);
}

.btn-quick-view:hover,
.btn-wishlist:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* ==========================================================================
   GRID LAYOUTS
   ========================================================================== */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
}

/* Carousel specific styles */
.products-carousel .product-card {
    width: 280px;
    flex-shrink: 0;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .products-carousel .product-card {
        width: 250px;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 16px;
    }
    
    .products-carousel .product-card {
        width: 220px;
    }
    
    .product-content {
        padding: 12px;
    }
    
    .product-title {
        font-size: 0.9rem;
    }
    
    .price-current {
        font-size: 1rem;
    }
    
    .btn-add-to-cart {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .btn-quick-view,
    .btn-wishlist {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .products-carousel .product-card {
        width: 200px;
    }
    
    .product-badges {
        top: 8px;
        left: 8px;
    }
    
    .product-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    .product-content {
        padding: 10px;
    }
    
    .product-title {
        font-size: 0.85rem;
        margin-bottom: 8px;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 6px;
    }
    
    .btn-quick-view,
    .btn-wishlist {
        width: 100%;
        height: 32px;
    }
}

/* ==========================================================================
   WOOCOMMERCE INTEGRATION
   ========================================================================== */

/* WooCommerce product loop item */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Override WooCommerce default styles */
.woocommerce ul.products li.product .woocommerce-loop-product__link {
    display: block;
    text-decoration: none;
}

.woocommerce ul.products li.product img {
    margin: 0;
    box-shadow: none;
}

.woocommerce ul.products li.product .price {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.woocommerce ul.products li.product .price del {
    opacity: 0.7;
}

/* Star ratings */
.woocommerce .star-rating {
    margin: 0 0 8px 0;
    font-size: 0.8rem;
}

/* Sale flash */
.woocommerce span.onsale {
    display: none; /* We use our custom badges */
}

/* Add to cart button */
.woocommerce ul.products li.product .button {
    margin: 0;
    padding: 10px 16px;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.woocommerce ul.products li.product .button:hover {
    background: var(--primary-color);
    color: #fff;
}

/* ==========================================================================
   NOTIFICATIONS & MODALS
   ========================================================================== */

/* Product Notifications */
.product-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 300px;
    border-left: 4px solid #007cba;
}

.product-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.product-notification.success {
    border-left-color: #27ae60;
}

.product-notification.error {
    border-left-color: #e74c3c;
}

.product-notification.warning {
    border-left-color: #f39c12;
}

.notification-message {
    display: block;
    font-size: 0.9rem;
    color: var(--secondary-color);
    margin-right: 10px;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: var(--secondary-color);
}

/* Quick View Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #fff;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translate(-50%, -50%) scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--secondary-color);
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

.quick-view-modal .modal-content {
    width: 800px;
    max-width: 90vw;
}

/* Body modal open state */
body.modal-open {
    overflow: hidden;
}

/* Loading states */
.btn-quick-view.loading {
    opacity: 0.6;
    pointer-events: none;
}

.btn-quick-view.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Wishlist active state */
.btn-wishlist.in-wishlist {
    color: #e74c3c;
}

.btn-wishlist.in-wishlist:hover {
    color: #fff;
    background: #e74c3c;
    border-color: #e74c3c;
}

/* Mobile optimizations for modals */
@media (max-width: 768px) {
    .product-notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .product-notification.show {
        transform: translateY(0);
    }
    
    .quick-view-modal .modal-content {
        width: 95vw;
        margin: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
}
