/**
 * Products Section Styles for Titan Fitnes Theme
 * 
 * @package Titan_Fitnes
 * @since 1.0.0
 */

/* ==========================================================================
   Popular & Newest Products Sections
   ========================================================================== */
.popular-products-section {
    position: relative;
    width: 100%;
    background-color: #000;
    padding: 80px 0;
    z-index: 7;
}

.newest-products-section {
    position: relative;
    width: 100%;
    background-color: #000;
    padding: 80px 0;
    z-index: 4;
}

.popular-products-container,
.newest-products-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 75px;
}

/* ==========================================================================
   Section Header with Brand Filter
   ========================================================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
    flex-wrap: wrap;
    gap: var(--titan-spacing-md);
}

.section-headline {
    font-family: 'Montserrat', sans-serif;
    font-size: 36px;
    font-weight: 400;
    color: #ffffff;
    margin: 0;
    position: relative;
    padding-bottom: 20px;
}

.section-headline::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100px;
    height: 3px;
    background-color: var(--titan-primary);
}

/* Brand Filter Links */
.brand-filter {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.brand-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Sofia Sans', sans-serif;
    font-size: 16px;
    font-weight: 400;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.brand-btn::after {
    content: '/';
    color: rgba(255, 255, 255, 0.3);
    margin-left: 5px;
}

.brand-btn:last-child::after {
    content: '';
    margin-left: 0;
}

.brand-btn:hover {
    color: var(--titan-primary);
}

.brand-btn.active {
    color: var(--titan-primary);
    font-weight: 600;
}

/* ==========================================================================
   Products Carousel
   ========================================================================== */
.products-carousel-wrapper {
    position: relative;
    padding: 0;
}

.products-grid {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 30px;
    scroll-behavior: smooth;
    cursor: grab;
    user-select: none;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    scroll-snap-type: x mandatory;
    scroll-padding-left: 0;
}

.products-grid::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.products-grid.dragging {
    cursor: grabbing;
    scroll-behavior: auto;
    scroll-snap-type: none;
}

.product-item {
    flex: 0 0 calc((100% - 90px) / 4); /* Show 4 full products */
    transition: opacity 0.3s ease, transform 0.3s ease;
    scroll-snap-align: start;
    scroll-snap-stop: normal;
}

.product-item.hidden {
    display: none;
}

/* Carousel Dots Navigation */
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 30px;
}

.carousel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.carousel-dot:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

.carousel-dot.active {
    background-color: var(--titan-primary);
    width: 30px;
    border-radius: 6px;
}

/* Product Card */
.product-card {
    background: #4a4d44;
    border-radius: 8px;
    overflow: hidden;
}

.product-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Product Image */
.product-image {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    overflow: hidden;
    background: transparent;
}

.product-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

/* Product Info */
.product-info {
    position: relative;
    padding: 50px 15px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    background: #000;
}

/* Product Price Badge (Overlapping) */
.product-price {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--titan-primary);
    color: #000;
    font-family: 'Sofia Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 25px;
    text-align: center;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 5;
    opacity: 1;
    transition: opacity 0.6s ease;
}

.product-price del {
    font-size: 16px;
    color: rgba(0, 0, 0, 0.5);
    margin-right: 8px;
    font-weight: 400;
}

.product-price ins {
    text-decoration: none;
}

/* Keep price visible on hover */
.product-card:hover .product-price {
    opacity: 1;
    z-index: 10;
    top: -60px;
}

/* Product Actions (Show on hover) - Below price */
.product-actions {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: none;
    z-index: 6;
    pointer-events: none;
}

.product-card:hover .product-actions {
    opacity: 1;
    transform: translateX(-50%);
    pointer-events: all;
    transition: opacity 0.6s ease;
    top: -10px;
}

/* Add to Cart Button (Main) */
.btn-add-to-cart {
    background-color: var(--titan-primary);
    color: #000;
    font-family: 'Sofia Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 25px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.5s ease, transform 0.3s ease;
    white-space: nowrap;
}

.btn-add-to-cart:hover {
    background-color: #a8d608;
    color: #000;
    transform: translateY(-2px);
}

.btn-add-to-cart:active,
.btn-add-to-cart:focus {
    background-color: var(--titan-primary) !important;
    color: #000 !important;
    outline: none;
    transform: translateY(-1px);
}

/* Buy Now & Favorite Buttons (Icon only) */
.btn-buy-now,
.btn-favorite {
    background-color: var(--titan-primary);
    color: #000;
    padding: 10px;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.5s ease, transform 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    position: relative;
}

.btn-buy-now svg,
.btn-favorite svg {
    width: 18px;
    height: 18px;
    stroke: #000;
}

.btn-buy-now:hover,
.btn-favorite:hover {
    background-color: #a8d608;
    color: #000;
    transform: translateY(-2px);
}

.btn-buy-now:hover svg,
.btn-favorite:hover svg {
    stroke: #000;
}

.btn-buy-now:active,
.btn-buy-now:focus,
.btn-favorite:active,
.btn-favorite:focus {
    background-color: var(--titan-primary) !important;
    color: #000 !important;
    outline: none;
    transform: translateY(-1px);
}

.btn-buy-now:active svg,
.btn-buy-now:focus svg,
.btn-favorite:active svg,
.btn-favorite:focus svg {
    stroke: #000 !important;
}

/* Tooltip for icon buttons */
.btn-buy-now::after,
.btn-favorite::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: 'Sofia Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.btn-buy-now:hover::after,
.btn-favorite:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Tooltip arrow */
.btn-buy-now::before,
.btn-favorite::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.btn-buy-now:hover::before,
.btn-favorite:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(2px);
}

/* Favorite Button Active State */
.btn-favorite.is-favorite {
    background-color: #ff4444;
}

.btn-favorite.is-favorite svg {
    fill: #000;
}

.btn-favorite.is-favorite:hover {
    background-color: #cc0000;
}

.btn-favorite {
    border: none;
}

/* Favorite Button Animation */
@keyframes favorite-bounce {
    0%, 100% {
        transform: scale(1) translateY(0);
    }
    50% {
        transform: scale(1.2) translateY(-3px);
    }
}

.btn-favorite.favorite-bounce {
    animation: favorite-bounce 0.3s ease;
}

/* Favorite Notification */
.favorite-notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 15px 25px;
    border-radius: 8px;
    border-left: 4px solid var(--titan-primary);
    font-family: 'Sofia Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.favorite-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Product Image Link */
.product-image-link {
    display: block;
    text-decoration: none;
}

/* Product Title */
.product-title {
    font-family: 'Sofia Sans', sans-serif;
    font-size: 18px;
    font-weight: 400;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.product-title-link {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title-link:hover {
    color: var(--titan-primary);
}

/* Product Brand */
.product-brand {
    font-family: 'Sofia Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    order: 2;
}

.product-brand-link {
    color: #9DAFBD;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-brand-link:hover {
    color: var(--titan-primary);
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 1024px) {
    .popular-products-section,
    .newest-products-section {
        padding: 60px 0;
    }
    
    .popular-products-container,
    .newest-products-container {
        padding: 0 var(--titan-spacing-md);
    }
    
    .product-item {
        flex: 0 0 calc((100% - 60px) / 3); /* Show 3 full products on tablets */
    }
    
    .section-headline {
        font-size: 32px;
    }
}

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .product-item {
        flex: 0 0 calc(100% - 30px); /* Show 1 full product on mobile */
    }
    
    .section-headline {
        font-size: 28px;
    }
    
    .brand-filter {
        width: 100%;
        justify-content: flex-start;
    }
    
    .brand-btn {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .popular-products-section,
    .newest-products-section {
        padding: 40px 0;
    }
    
    .product-item {
        flex: 0 0 calc(100% - 30px); /* Show 1 product on small mobile */
    }
    
    .section-headline {
        font-size: 24px;
    }
    
    .carousel-dot {
        width: 10px;
        height: 10px;
    }
    
    .carousel-dot.active {
        width: 24px;
    }
}

