/**
 * HL Product Card Component
 * Product card với prefix hl- cho custom styling
 */

.hl-product-card {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.hl-product-card:hover {
    border: 2px solid #27AA50;
    box-shadow: 0 8px 25px rgba(39, 170, 80, 0.15);
}

.hl-product-card:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(39, 170, 80, 0.1) 0%, rgba(39, 170, 80, 0.05) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Product Image Container */
.hl-product-card__image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f8fafc;
}

.hl-product-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.hl-product-card:hover .hl-product-card__image img {
    transform: scale(1.05);
}

/* Shimmer Effect on Image */
.hl-product-card__image::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: hl-shimmer 2s infinite;
}

.hl-product-card:hover .hl-product-card__image::before {
    animation-play-state: running;
}

@keyframes hl-shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Product Content */
.hl-product-card__content {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Product Title */
.hl-product-card__title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.hl-product-card:hover .hl-product-card__title {
    color: #1f2937;
}

/* Product Price */
.hl-product-card__price {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
}

.hl-product-card__price-amount {
    font-size: 1.125rem;
    font-weight: 700;
    color: #dc2626;
    line-height: 1.2;
}

.hl-product-card__price-amount .woocommerce-Price-currencySymbol {
    font-size: 0.875rem;
}

.hl-product-card__price-regular {
    font-size: 0.875rem;
    color: #6b7280;
    text-decoration: line-through;
    margin-right: 0.5rem;
}

/* Sale Badge */
.hl-product-card__sale {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #ef4444;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

/* Out of Stock Badge */
.hl-product-card__out-of-stock {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #6b7280;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 2;
}

/* Rating Stars - Removed */

/* Category Badge */
.hl-product-card__category {
    display: inline-block;
    background: #f3f4f6;
    color: #6b7280;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Loading State */
.hl-product-card--loading {
    pointer-events: none;
}

.hl-product-card--loading .hl-product-card__image {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: hl-loading 1.5s infinite;
}

@keyframes hl-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Quick Actions */
.hl-product-card__actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hl-product-card:hover .hl-product-card__actions {
    opacity: 1;
}

.hl-product-card__quick-view,
.hl-product-card__add-to-cart {
    width: 2rem;
    height: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hl-product-card__quick-view:hover,
.hl-product-card__add-to-cart:hover {
    background: #27AA50;
    border-color: #27AA50;
    color: white;
}

/* Responsive Design */
@media (max-width: 640px) {
    .hl-product-card {
        border-radius: 6px;
    }

    .hl-product-card__content {
        padding: 0.75rem;
    }

    .hl-product-card__title {
        font-size: 0.813rem;
    }

    .hl-product-card__price-amount {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .hl-product-card__content {
        padding: 0.5rem;
    }

    .hl-product-card__title {
        font-size: 0.75rem;
        -webkit-line-clamp: 2;
    }

    .hl-product-card__price-amount {
        font-size: 0.875rem;
    }
}

/* Quick View Modal - Removed */

/* Notification System - Removed (using existing toast system) */

/* Quantity Wrapper */
.hl-quantity-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.hl-quantity-wrapper input[type="number"] {
    border: none;
    padding: 0.5rem;
    text-align: center;
    width: 60px;
    -moz-appearance: textfield;
}

.hl-quantity-wrapper input[type="number"]::-webkit-inner-spin-button,
.hl-quantity-wrapper input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-btn {
    background: #f9fafb;
    border: none;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
    color: #6b7280;
    font-size: 0.75rem;
}

.qty-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

/* Product with contact price styling */
.hl-product-card[data-contact="true"] .hl-product-card__add-to-cart,
.hl-product-card:has(.price-contact) .hl-product-card__add-to-cart {
    background: transparent;
    cursor: help;
}

.hl-product-card[data-contact="true"] .hl-product-card__add-to-cart:hover,
.hl-product-card:has(.price-contact) .hl-product-card__add-to-cart:hover {
    background: transparent;
}

.hl-product-card[data-contact="true"] .hl-product-card__add-to-cart i,
.hl-product-card:has(.price-contact) .hl-product-card__add-to-cart i {
    cursor: help;
}

/* Loading States */
.hl-product-card__quick-view.loading,
.hl-product-card__add-to-cart.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Override Flatsome default product cards */
.products .product-small,
.products .col,
.products .box,
.products .product-small.box {
    /* Remove default Flatsome styling */
    background: none;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
}

/* Replace with our HL product card */
.products .product-small,
.products .col-inner,
.products .box {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Ensure HL product card is the main visible element */
.products .hl-product-card {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Hide Flatsome default elements that we don't need */
.products .box-image,
.products .box-text,
.products .image-tools,
.products .out-of-stock-label,
.products .title-wrapper,
.products .price-wrapper {
    display: none !important;
}

/* Force our HL product card to be the main container */
.products .col-inner {
    width: 100% !important;
    height: 100% !important;
}

/* Remove Flatsome hover effects */
.products .product-small:hover,
.products .box:hover {
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* Ensure proper grid layout */
.products .col {
    padding: 0.75rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .products .col {
        padding: 0.5rem;
    }
}

/* Integration with Flatsome's responsive grid */
@media (max-width: 850px) {
    .products .col {
        width: 50% !important; /* 2 columns on tablets */
    }
}

@media (max-width: 550px) {
    .products .col {
        width: 100% !important; /* 1 column on mobile */
        padding: 0.5rem 0;
    }

    .hl-product-card {
        margin-bottom: 1rem;
    }
}

/* Flatsome specific overrides */
.row.large-columns-4 .col,
.row.large-columns-3 .col,
.row.medium-columns-3 .col,
.row.small-columns-2 .col {
    /* Ensure our cards work with Flatsome's column system */
    padding: 0.75rem;
}

/* Ensure proper height for grid alignment */
.row .col .hl-product-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Fix any z-index issues with Flatsome elements */
.hl-product-card .hl-product-card__actions {
    z-index: 10;
}

/* Override Flatsome's default transitions */
.products .col {
    transition: none !important;
}

/* Ensure sale badges and other overlays work properly */
.hl-product-card__badges {
    z-index: 5;
}

/* Integration with Flatsome's lazy loading */
.hl-product-card__image img {
    transition: transform 0.3s ease;
    will-change: transform;
}

/* Splide slider styling */
.splide__track {
    padding: 20px 0px;
}