/* ========================================================
   CROP DETAIL PAGE (template-crop-detail-rice.php)
   ======================================================== */

/* --- 1. HERO BANNER --- */
.crop-detail-hero {
    position: relative;
    width: 100%;
    height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.crop-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* 1. Force the overlay to perfectly center everything */
.crop-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 79, 44, 0.7);
    z-index: 2;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important; 
    justify-content: center !important; 
    text-align: center !important; 
    padding: 0 20px;
    box-sizing: border-box !important; /* THE FIX: Forces padding inward so it doesn't stretch past the screen */
}

/* 2. Lock the Title in the middle */
.crop-hero-title {
    color: #ffffff;
    font-size: 54px;
    font-weight: 700;
    margin-bottom: 15px;
    font-family: 'Noto Sans Khmer', sans-serif;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    text-align: center !important;
    width: 100%;
}

/* 3. Lock the Subtitle in the middle */
.crop-hero-subtitle {
    color: #e8f2ec;
    font-size: 20px;
    max-width: 100%; /* THE FIX: Prevents the box from forcing itself to be 700px on phones */
    width: 100%;
    line-height: 1.6;
    text-align: center !important;
    margin: 0 auto; 
    box-sizing: border-box !important;
}

/* --- 2. MAIN CONTAINER --- */
.crop-detail-container {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
    font-family: 'Noto Sans Khmer', sans-serif;
}

/* --- 3. OVERVIEW SECTION --- */
.crop-overview-section {
    display: flex;
    gap: 50px;
    align-items: center;
    margin-bottom: 80px;
}
.crop-overview-text {
    flex: 1.2;
}
.crop-overview-text h2 {
    font-size: 36px;
    color: #111;
    font-weight: 700;
    margin-bottom: 20px;
}
.crop-overview-text p {
    color: #555;
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 15px;
    text-align: justify;
}
.crop-overview-image {
    flex: 1;
}
.crop-overview-image img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

/* --- 4. STAGES & USAGE TABLE --- */
.crop-stages-section {
    margin-bottom: 80px;
}
.crop-stages-section h3 {
    font-size: 32px;
    font-weight: 700;
    color: #111;
    margin-bottom: 25px;
    text-align: center;
}
/* Reuses your Product Page Table structure */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.usage-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 750px; 
    background: #fff;
}
.usage-table th {
    background-color: var(--brand-green, #0fa153);
    color: #ffffff;
    font-size: 18px;
    padding: 18px;
    text-align: left;
    border: 1px solid #0d8a47;
}
.usage-table td {
    padding: 18px;
    border: 1px solid #eee;
    font-size: 16px;
    line-height: 1.6;
    vertical-align: top;
    color: #444;
}
.usage-table td strong {
    color: #111;
    font-size: 18px;
}

/* --- 5. RELATED PRODUCTS --- */
.crop-related-products {
    margin-top: 50px;
    padding-top: 50px;
    border-top: 2px solid #eee;
}

/* ================= MOBILE RESPONSIVE ================= */
@media (max-width: 900px) {
    .crop-detail-hero {
        height: 350px ;
        margin-top: 0px; /* Pushes the banner safely below your sticky header! */
    }
    
    .crop-hero-title { 
        font-size: 32px !important; 
    }
    .crop-hero-subtitle { 
        font-size: 16px !important; 
        word-wrap: break-word !important; /* Helps long Khmer text wrap safely to the next line */
        padding: 0 10px;
    }
    
    .crop-overview-section {
        flex-direction: column;
        gap: 30px;
    }
    .crop-stages-section h3 {
        font-size: 26px;
    }
}

/* ========================================================
   IMAGE ZOOM HOVER EFFECTS
   ======================================================== */
.crop-overview-image {
    position: relative;
    cursor: pointer; /* Turns the mouse into a clicking hand */
    border-radius: 12px;
    overflow: hidden;
}
.crop-overview-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}
/* Zooms the picture slightly when hovering before clicking */
.crop-overview-image:hover img {
    transform: scale(1.03); 
}

/* The dark little "Click to zoom" badge that appears on hover */
.zoom-hint {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 14px;
    font-family: 'Noto Sans Khmer', sans-serif;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}
.crop-overview-image:hover .zoom-hint {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================================
   FULLSCREEN IMAGE LIGHTBOX (POPUP)
   ======================================================== */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9); /* Dims the website background */
    z-index: 9999999; /* Sits above everything else on the page */
    display: none; 
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* JavaScript adds this class to reveal the popup */
.image-lightbox.show {
    display: flex;
    opacity: 1;
}

/* The actual full-screen image */
.image-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    object-fit: contain; /* Prevents the image from stretching out of shape */
    cursor: zoom-out; /* Changes the mouse into a minus sign so users know they can click to close */
}

/* The 'X' Close Button */
.lightbox-close {
    position: absolute;
    top: 25px;
    right: 40px;
    color: #ffffff;
    font-size: 40px;
    cursor: pointer;
    z-index: 10000000;
    transition: color 0.3s ease;
}
.lightbox-close:hover {
    color: var(--brand-green, #0fa153);
}