/* ========================================================
   ALL PRODUCTS PAGE (Colorful Tabs Layout)
   ======================================================== */
.products-banner {
    width: 100%;
    margin-bottom: 15px; /* Added a 15px gap below the banner */
    margin-top: 0; 
}
.products-banner img {
    width: 100%;
    height: auto;
    display: block;
}
.products-tabs-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px 20px;
    box-sizing: border-box;
}

/* 1. The Full-Width White Bar */
.products-tab-bar-full {
    width: 100%;
    background-color: #ffffff; 
    margin-bottom: 50px; 
    position: relative;
}

/* 2. The Tab Container */
.products-tab-header {
    max-width: 1200px;
    /* Added a 60px gap at the bottom! */
    margin: 0 auto 60px auto; 
    display: flex;
    justify-content: space-between;
    gap: 12px; 
    position: relative;
    box-sizing: border-box;
}

/* 3. The Colorful Text-Only Buttons */
.tab-btn {
    flex: 1;
    border: none;
    padding: 18px 10px;
    font-size: 24px; 
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Noto Sans Khmer', sans-serif;
    transition: opacity 0.3s ease;
    position: relative;
    border-radius: 4px; 
}
.tab-btn:hover {
    opacity: 0.85; 
}

/* --- THE 4 SPECIFIC TAB COLORS --- */
.btn-green { background-color: var(--brand-green, #0fa153); color: #ffffff; }
.btn-yellow { background-color: var(--brand-yellow, #ffb800); color: #000000; }
.btn-blue { background-color: #0b4a8f; color: #ffffff; }
.btn-dark-green { background-color: var(--brand-dark-green, #064b17); color: #ffffff; }

/* 4. The Matching Colored Triangles */
.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -14px; 
    left: 50%;
    transform: translateX(-50%);
    border-width: 15px 15px 0 15px;
    border-style: solid;
    z-index: 10;
    display: block; 
}

.btn-green.active::after { border-color: var(--brand-green, #0fa153) transparent transparent transparent; }
.btn-yellow.active::after { border-color: var(--brand-yellow, #ffb800) transparent transparent transparent; }
.btn-blue.active::after { border-color: #0b4a8f transparent transparent transparent; }
.btn-dark-green.active::after { border-color: var(--brand-dark-green, #064b17) transparent transparent transparent; }

/* 5. Tab Content & Fade Animation */
.tab-content {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}
.tab-content.active-content {
    display: block;
    opacity: 1;
}

/* 6. The 4-Column Product Grid */
.single-category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    column-gap: 25px; 
    row-gap: 60px; 
    padding-top: 25px; 
    width: 100%;
    box-sizing: border-box;
}

/* Clickable Product Link Fixes */
.product-link {
    text-decoration: none;
    color: inherit; 
    display: block; 
    transition: 0.3s ease;
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
}
.product-link:hover h4 {
    color: var(--brand-green, #0fa153);
}

/* ========================================================
   PRODUCT CARD STYLING & ALIGNMENT
   ======================================================== */
.product-card {
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 15px;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%; 
    box-sizing: border-box; 
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.product-card:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-5px);
}

.product-image {
    width: 100%;
    height: 140px;
    object-fit: contain;
    margin-top: 15px;
    margin-bottom: 15px;
}

.product-card h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-align: center;
}

.product-card p {
    font-size: 11px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 15px 0;
    text-align: center;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: auto; 
    width: 100%;
    box-sizing: border-box;
}

.product-weight {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.btn-call-now {
    background-color: #ffb800;
    color: #111;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 4px;
    text-decoration: none;
    transition: 0.3s ease;
}

/* ========================================================
   PRODUCT TAG COLORS (Restored Desktop Defaults)
   ======================================================== */
.product-tag {
    position: absolute;
    top: -15px;
    left: 15px;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'Noto Sans Khmer', sans-serif;
    font-weight: 700;
    color: #ffffff; 
    z-index: 5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tag-green { background-color: var(--brand-green, #0fa153); }
.tag-yellow { background-color: var(--brand-yellow, #ffb800); color: #000000; }
.tag-blue { background-color: #0b4a8f; }
.tag-dark-green { background-color: var(--brand-dark-green, #064b17); }

/* ================= MOBILE RESPONSIVE FIXES ================= */
@media (max-width: 900px) {
    .products-banner { margin-top: 0; }
    
    .products-tab-bar-full::after {
        content: "\f101"; 
        font-family: "Font Awesome 6 Free"; font-weight: 900;
        position: absolute; right: 0; top: 0; height: 100%; width: 60px; 
        display: flex; align-items: center; justify-content: flex-end;
        color: #111; font-size: 16px;
        background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 60%); 
        pointer-events: none; z-index: 10;
        animation: bounce-right 1.5s infinite;
    }
    .products-tab-bar-full::before {
        content: "\f100"; 
        font-family: "Font Awesome 6 Free"; font-weight: 900;
        position: absolute; left: 0; top: 0; height: 100%; width: 60px; 
        display: flex; align-items: center; justify-content: flex-start;
        color: #111; font-size: 16px;
        background: linear-gradient(to left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 60%); 
        pointer-events: none; z-index: 10;
        animation: bounce-left 1.5s infinite;
    }
    
    @keyframes bounce-right { 0%, 100% { padding-right: 5px; opacity: 0.6; } 50% { padding-right: 12px; opacity: 1; } }
    @keyframes bounce-left { 0%, 100% { padding-left: 5px; opacity: 0.6; } 50% { padding-left: 12px; opacity: 1; } }

    /* Padding bottom added so the triangle isn't clipped! */
    .products-tab-header {
        flex-wrap: nowrap; 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; 
        gap: 5px;
        padding: 0 40px 25px 40px; 
        scrollbar-width: none; 
    }
    .products-tab-header::-webkit-scrollbar { display: none; }
    
    .tab-btn {
        flex: 0 0 auto; 
        font-size: 16px;
        padding: 12px 25px;
    }
    
    /* Triangle drops safely into the new bottom padding */
    .tab-btn.active::after {
        bottom: -11px;
        border-width: 12px 12px 0 12px;
    }
    
    .products-tabs-container {
        padding: 0 15px 40px 15px;
    }
    
    .single-category-grid {
        grid-template-columns: repeat(3, 1fr);
        column-gap: 15px;
        row-gap: 40px; 
        width: 100%;
    }
}

@media (max-width: 500px) {
    /* Guarantees 10px safe margins on the physical phone screen */
    .products-tabs-container {
        padding: 0 10px 40px 10px;
    }
    
    .single-category-grid {
        grid-template-columns: repeat(2, 1fr);
        column-gap: 10px;
        row-gap: 35px; 
        width: 100%;
    }
    
    .product-card {
        padding: 10px 5px;
        overflow: hidden; 
    }
    
    .product-image {
        height: 80px;
        margin-top: 15px;
        margin-bottom: 5px;
    }
    
    .product-card h4 {
        font-size: 11px;
        margin-bottom: 5px;
    }
    
    /* Hides descriptions on phones */
    .product-card p {
        display: none; 
    }
    
    /* Stacks the bottom buttons safely */
    .product-footer {
        flex-direction: column;
        gap: 5px;
        padding-top: 8px;
    }
    
    .product-weight {
        font-size: 10px;
    }
    
    .btn-call-now {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        font-size: 10px;
        padding: 6px;
    }
    
    /* Tucks the tag flush into the corner ONLY on mobile */
    .product-tag {
        top: 0;
        left: 0;
        font-size: 8px;
        padding: 3px 6px;
        border-radius: 0 0 4px 0; 
        box-shadow: none;
    }
}