/* Enhanced Product Grid Styles - v1.0.2 */

.enhanced-product-grid {
    display: grid;
    width: 100%;
    transition: all 0.3s ease;
}

/* =========================================
   GRID MODE - DYNAMIC COLUMNS
   ========================================= */

/* Desktop (Default) - Uses Elementor's inline CSS for grid-template-columns */
.enhanced-product-grid:not(.swiper) {
    /* Grid template columns are set via Elementor's responsive controls */
    /* Gap is also set via Elementor's responsive controls */
}

/* Responsive Grid Fallbacks (if inline styles fail) */
@media (max-width: 1024px) {
    .enhanced-product-grid:not(.swiper) {
        /* Tablet fallback - uses Elementor inline styles */
    }
}

@media (max-width: 768px) {
    .enhanced-product-grid:not(.swiper) {
        /* Mobile fallback - uses Elementor inline styles */
    }
}

/* Force single column on very small screens */
@media (max-width: 480px) {
    .enhanced-product-grid:not(.swiper):not([style*="grid-template-columns"]) {
        grid-template-columns: 1fr !important;
    }
}

/* =========================================
   CAROUSEL MODE STYLES 
   ========================================= */

/* Carousel Wrapper */
.enhanced-product-grid-wrapper {
    position: relative;
}

.enhanced-product-grid-wrapper.carousel-mode {
    padding: 0 50px; /* Space for navigation arrows */
}

/* Swiper/Carousel Base */
.enhanced-product-grid.swiper {
    display: block;
    overflow: hidden;
}

.enhanced-product-grid.swiper .swiper-wrapper {
    display: flex;
}

.enhanced-product-grid.swiper .swiper-slide {
    height: auto;
    display: flex;
    flex-shrink: 0;
}

.enhanced-product-grid.swiper .enhanced-product-card {
    width: 100%;
    height: 100%;
}

/* Carousel Navigation Arrows */
.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #000000;
}

.carousel-nav-btn:hover {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
}

.carousel-nav-btn.carousel-prev {
    left: 0;
}

.carousel-nav-btn.carousel-next {
    right: 0;
}

.carousel-nav-btn:disabled,
.carousel-nav-btn.swiper-button-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.carousel-nav-btn svg {
    width: 20px;
    height: 20px;
}

/* Carousel Dots Pagination */
.carousel-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #cccccc;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}

.carousel-dot:hover {
    background-color: #999999;
}

.carousel-dot.active {
    background-color: #000000;
    transform: scale(1.2);
}

/* Swiper pagination bullets */
.swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background-color: #cccccc;
    opacity: 1;
}

.swiper-pagination-bullet-active {
    background-color: #000000;
}

/* Responsive Carousel Navigation */
@media (max-width: 768px) {
    .enhanced-product-grid-wrapper.carousel-mode {
        padding: 0 35px;
    }
    
    .carousel-nav-btn {
        width: 35px;
        height: 35px;
    }
    
    .carousel-nav-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .enhanced-product-grid-wrapper.carousel-mode {
        padding: 0;
    }
    
    .carousel-nav-btn {
        width: 30px;
        height: 30px;
        opacity: 0.7;
    }
    
    .carousel-nav-btn.carousel-prev {
        left: 5px;
    }
    
    .carousel-nav-btn.carousel-next {
        right: 5px;
    }
    
    .carousel-nav-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .carousel-dots {
        margin-top: 15px;
        gap: 6px;
    }
    
    .carousel-dot {
        width: 8px;
        height: 8px;
    }
}

/* =========================================
   PRODUCT CARD
   ========================================= */

.enhanced-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #fff;
    transition: all 0.3s ease;
    overflow: hidden;
}

.enhanced-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

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

.product-badges .badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 3px;
    line-height: 1.4;
}

.badge-sale {
    background: #e74c3c;
    color: #fff;
}

.badge-new {
    background: #000;
    color: #fff;
}

.badge-tag {
    background: #3498db;
    color: #fff;
}

/* Wishlist Button */
.wishlist-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

.enhanced-product-card:hover .wishlist-btn {
    opacity: 1;
    transform: scale(1);
}

.wishlist-btn:hover {
    background: #000;
    color: #fff;
}

.wishlist-btn svg {
    width: 18px;
    height: 18px;
}

.wishlist-btn.active {
    background: #e74c3c;
    color: #fff;
}

.wishlist-btn.active svg {
    fill: #fff;
}

/* Product Image */
.product-image-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 3/4; /* Default desktop ratio */
    background: #f5f5f5;
}

/* Mobile: Taller image ratio for better visibility */
@media (max-width: 768px) {
    .product-image-wrapper {
        aspect-ratio: 2/3; /* Taller ratio on mobile (0.666 vs 0.75) */
    }
}

@media (max-width: 480px) {
    .product-image-wrapper {
        aspect-ratio: 9/14; /* Even taller on small mobile (0.643) */
    }
}

.product-link {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.product-image.primary-image {
    position: relative;
    z-index: 2;
}

.product-image.hover-image {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    opacity: 0;
}

.enhanced-product-card:hover .product-image.primary-image {
    opacity: 0;
}

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

/* Size Selector - Refined Premium Look */
.size-selector {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 14px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0));
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 5;
}

.enhanced-product-card:hover .size-selector {
    opacity: 1;
    transform: translateY(0);
}

.size-buttons-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

/* Size Button - Premium & Elegant Design */
.size-btn {
    min-width: 36px;
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #000;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.size-btn:hover:not(.out-of-stock) {
    background: #000;
    color: #fff;
    border-color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.size-btn.out-of-stock {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}

.size-btn.adding {
    pointer-events: none;
}

.size-btn.adding::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 6px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.size-btn.added {
    background: #27ae60;
    border-color: #27ae60;
    color: #fff;
}

.size-btn.added::before {
    content: '✓ ';
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Product Info */
.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.product-rating .star-rating {
    font-size: 14px;
}

.product-title {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    min-height: 2.8em;
}

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

.product-title a:hover {
    color: #666;
}

.product-price {
    font-size: 16px;
    font-weight: 600;
    margin-top: auto;
}

.product-price del {
    font-size: 14px;
    opacity: 0.5;
    font-weight: 400;
    margin-right: 6px;
}

.product-price ins {
    text-decoration: none;
    color: #e74c3c;
}

/* Loading State */
.enhanced-product-grid.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success Notification */
.add-to-cart-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    background: #27ae60;
    color: #fff;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

.add-to-cart-notification.hide {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Empty State */
.enhanced-product-grid:empty::after {
    content: 'No products found';
    display: block;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar for better aesthetics */
.size-buttons-wrapper::-webkit-scrollbar {
    height: 4px;
}

.size-buttons-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.size-buttons-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.size-buttons-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Adjustments for Size Buttons */
@media (max-width: 768px) {
    .size-btn {
        min-width: 32px;
        height: 30px;
        padding: 0 10px;
        font-size: 11px;
    }
    
    .size-selector {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .size-btn {
        min-width: 30px;
        height: 28px;
        padding: 0 8px;
        font-size: 10px;
    }
    
    .size-buttons-wrapper {
        gap: 4px;
    }
}
