/* ========================================================
   PRODUCT DETAIL PAGE (template-product-detail.php)
   ======================================================== */
.product-detail-container {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
    font-family: 'Noto Sans Khmer', sans-serif;
}

/* --- 1. TOP SECTION (Gallery & Info) --- */
.product-top-section {
    display: flex;
    gap: 50px;
    margin-bottom: 60px;
}

/* Left: Gallery (Locked to exactly 45% width so it never stretches!) */
.product-gallery {
    flex: 0 0 45%;
    max-width: 45%;
}

/* THE FIX FOR THE STRETCHING IMAGE */
.main-image-box {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    background-color: #fff;
    height: 450px; /* Locks the box height permanently */
    display: flex;
    justify-content: center;
    align-items: center;
}
.main-image-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* MAGIC FIX: Stops image from stretching completely */
}

/* Thumbnails */
.thumbnail-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.thumb {
    width: 100%;
    height: 80px;
    object-fit: contain;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    background: #fff;
    padding: 5px;
}
.thumb.active-thumb {
    border: 3px solid var(--brand-green, #0fa153);
}

/* Right: Product Info */
.product-info {
    flex: 1;
}
.title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.title-row h2 {
    font-size: 42px;
    font-weight: 700;
    color: #333;
    margin: 0;
}
.product-desc {
    font-size: 16px;
    color: #444;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Composition Table */
.product-composition h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 15px;
}
.composition-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 30px;
    row-gap: 10px;
    font-size: 15px;
    color: #333;
    margin-bottom: 40px;
}
.comp-item span {
    font-weight: bold;
}

/* Action Row (Volume & Button) */
.product-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #e5e5e5;
    padding-top: 25px;
}
.product-volume-large {
    font-size: 20px;
}
.btn-call-now-large {
    background-color: #ffb700;
    color: #000;
    font-weight: 800;
    font-size: 20px;
    padding: 12px 40px;
    border-radius: 4px;
    text-decoration: none;
    transition: 0.3s;
}
.btn-call-now-large:hover {
    background-color: #e6a500;
}

/* --- 2. MIDDLE SECTION (Usage Table) --- */
.product-usage-section {
    margin-bottom: 70px;
}
.product-usage-section h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
}
/* Table responsive wrapper for mobile swiping */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
.usage-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px; /* Forces scrolling on small phones instead of squishing */
}
.usage-table th {
    background-color: #51b5b0; /* The teal color from your image */
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    padding: 15px;
    text-align: left;
    border: 1px solid #459e9a;
}
.usage-table td {
    padding: 15px;
    border: 1px solid #dcdcdc;
    font-size: 16px;
    line-height: 1.5;
    vertical-align: top;
    color: #333;
}

/* --- 3. BOTTOM SECTION (Related Products) --- */
.related-products-section {
    margin-top: 40px;
    border-top: 2px solid #e5e5e5;
    padding-top: 40px;
}
.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}
.products-header h3 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

/* ================= MOBILE RESPONSIVE FIXES ================= */
@media (max-width: 900px) {
    /* Stacks the Image and the Info box */
    .product-top-section {
        flex-direction: column;
        gap: 30px;
    }
    .product-gallery {
        flex: none;
        max-width: 100%; /* Allows it to take up the full screen width on phones */
    }
    .main-image-box {
        height: 300px; /* Shrinks the height slightly for mobile screens */
    }
    .title-row h2 {
        font-size: 32px;
    }
    .product-action-row {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    .btn-call-now-large {
        width: 100%;
        text-align: center;
        display: block; /* Forces the link to behave like a full-width box */
        box-sizing: border-box; /* Stops the padding from breaking past the screen edges! */
    }
}
@media (max-width: 500px) {
    .composition-grid {
        grid-template-columns: 1fr; /* 1 column for ingredients on tiny phones */
    }
}