/* ======================================================================
   product.css
   PURPOSE:
   - Page-specific styles for product listing page (products.html)
   - Includes: Hero banner, category sidebar, product grid, pagination
   WARNING:
   - Do NOT use for home.html or shared layout (header / footer)
   - Editing this file affects ONLY product-related pages
   ====================================================================== */


/* [SECTION 1] PRODUCT HERO SECTION
   products.html (top banner section) */

.products-hero {
    padding: 60px 40px;
    display: flex;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
    height: 500px;
    overflow: hidden;
    justify-content: center;
}

.products-hero .hero-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.hero-subtitle {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.products-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.products-hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: #ffffff;
}

.products-hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 2px;
    line-height: 1.2;
}

/* [SECTION 2] PRODUCTS MAIN LAYOUT */
.products-container {
    display: flex;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px 60px;
}

/* [SECTION 3] CATEGORY SIDEBAR (Product filtering / navigation)
   Depends on: JS (toggle .active class) */    
.product-sidebar {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid #e0e0e0;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f0f0f0;
}

.category-item:hover {
    padding-left: 8px;
}

.category-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.category-item.active .category-dot {
    background: #dc3545;
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.15);
}

.category-text {
    font-size: 15px;
    color: #333;
    font-weight: 400;
}

.category-item.active .category-text {
    font-weight: 600;
    color: #000;
}

/* [SECTION 4] PRODUCT GRID */
.products-grid-wrapper {
    flex: 1;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 40px;
    min-height: 400px;
    transition: opacity 0.3s ease;
}

.products-grid.fade {
    opacity: 0.5;
}

/* [SECTION 5] PRODUCT CARD */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #f8f8f8 0%, #ececec 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 12px solid #f0f0f0;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.05);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-image i {
    font-size: 48px;
    color: #ccc;
}

.product-info {
    padding: 15px 10px;
    text-align: left;
    background: transparent;
}

.product-name {
    font-size: 13px;
    color: #333;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

/* [SECTION 6] PAGINATION */
.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 40px;
}

.page-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.page-btn.active {
    background: #1a1a1a;
    color: white;
    border-color: #1a1a1a;
}

/* [SECTION 7] RESPONSIVE BREAKPOINTS */

@media (max-width: 1200px) {
    .products-container {
        max-width: 100%;
        padding: 0 30px 50px;
    }

    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        /* ยังคง 3 คอลัมน์แต่ลด gap */
        gap: 20px;
    }
}

@media (max-width: 1024px) {
    .products-hero {
        height: 350px;
    }

    .products-hero-content h1 {
        font-size: 2.8rem;
    }

    .products-container {
        gap: 20px;
    }

    .product-sidebar {
        width: 150px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-name {
        font-size: 14px;
    }
}


@media (max-width: 768px) {
    .products-hero {
        height: 250px;
        margin-bottom: 20px;
    }

    .products-hero-content h1 {
        font-size: 2rem;
    }

    .products-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0 20px 40px;
        gap: 20px;
    }

    .product-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-bottom: 5px;
        display: flex;
        justify-content: center;
    }

    .category-list {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
        padding-bottom: 15px;
        padding: 0;
        list-style: none;
    }

    .category-list::-webkit-scrollbar {
        display: none;
    }

    .category-item {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        border-bottom: none !important;
        padding: 10px 5px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .product-card {
        width: 100%;
        max-width: 320px;
    }

    .products-hero {
        height: 200px;
    }

    .products-hero-content h1 {
        font-size: 1.6rem;
    }

    .product-image {
        aspect-ratio: 4/3;
    }

    .product-info {
        text-align: center;
        padding: 15px;
    }

    .product-name {
        font-size: 15px;
    }

    .page-btn {
        width: 35px;
        height: 35px;
    }
}


@media (max-width: 480px) {
    .logo img {
        width: 160px;
        height: auto;
    }

    .products-hero {
        height: 200px;
    }

    .products-hero-content h1 {
        font-size: 15px;
        letter-spacing: 1px;
    }

    .hero-subtitle {
        font-size: 12px;
        margin-bottom: 5px;
    }

    .product-hero {
        height: 180px;
    }

    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .product-card {
        max-width: 100%;
    }

    .product-image {
        aspect-ratio: 4/3;
    }

    .product-info {
        text-align: center;
        padding: 15px;
    }

    .product-name {
        font-size: 15px;
    }

    .page-btn {
        width: 35px;
        height: 35px;
    }
    .category-text {
        font-size: 11px;
        line-height: 1.2;
        word-break: break-word;
    }

    .category-dot {
        width: 8px;
        height: 8px;
    }
}

@media (max-width: 360px) {
    .products-hero-content h1 {
        font-size: 10px;
    }

    .category-list {
        gap: 5px;
    }

    .category-text {
        font-size: 10px;
    }

    .product-name {
        font-size: 13px;
    }
}