/* Product Details Styles */

/* Product Detail Layout */
.product-detail {
    margin-bottom: 50px;
    padding: 30px;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.product-detail h3 {
    color: #2e7d32;
    font-size: 24px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2e7d32;
}

.product-info {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.product-image {
    flex: 1;
    min-width: 300px;
}

.product-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.product-specs {
    flex: 2;
    min-width: 300px;
}

.product-specs > p {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #333;
}

/* Single Image Auto-Swipe Layout */
.product-single-image-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Single Image Container */
.single-image-container {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.single-image-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.single-image-slide.active {
    opacity: 1;
    z-index: 1;
}

.single-image-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image Counter */
.image-counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10;
}

/* Product Description Section */
.product-description-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.product-description-section p {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #333;
}

/* Specifications Grid */
.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.spec-item {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.spec-item h4 {
    color: #2e7d32;
    margin-bottom: 8px;
    font-size: 16px;
}

.spec-item p {
    margin: 0;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

/* Product Features */
.product-features {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.product-features h4 {
    color: #2e7d32;
    margin-bottom: 15px;
    font-size: 18px;
}

.product-features ul {
    padding-left: 20px;
}

.product-features li {
    margin-bottom: 8px;
    color: #555;
    line-height: 1.5;
}

.product-features p {
    color: #555;
    line-height: 1.6;
    margin: 0;
}

/* Other Agricultural Products Section */
#other-agricultural .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.product-highlights {
    list-style-type: none;
    padding: 0;
    margin: 15px 0;
}

.product-highlights li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
    font-size: 14px;
    line-height: 1.5;
}

.product-highlights li:before {
    content: '•';
    position: absolute;
    left: 0;
    color: #2e7d32;
}

/* Image Modal */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.image-modal.active {
    display: flex;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: none;
    border: none;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .product-info {
        flex-direction: column;
    }
    
    .single-image-container {
        height: 350px;
    }
    
    .specs-grid {
        grid-template-columns: 1fr;
    }
    
    .product-detail {
        padding: 20px 15px;
    }
    
    .product-description-section {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .single-image-container {
        height: 280px;
    }
    
    .image-counter {
        top: 10px;
        right: 10px;
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* Auto-adjusted image sizing */
.single-image-slide img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Maintain original layout structure */
.product-info {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.product-image {
    flex: 1;
    min-width: 300px;
}

.product-specs {
    flex: 2;
    min-width: 300px;
}

/* Single Image Container adjustments for auto-sized images */
.single-image-container {
    position: relative;
    width: 100%;
    height: 400px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f9f9f9;
}

.single-image-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.single-image-slide.active {
    opacity: 1;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .single-image-container {
        height: 350px;
    }
    
    .single-image-slide {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .single-image-container {
        height: 280px;
    }
    
    .single-image-slide {
        padding: 10px;
    }
}

/* =========================================
   RESPONSIVE MEDIA QUERIES (PRODUCT DETAILS)
   ========================================= */

/* Tablet / Small Laptop (Max Width: 1024px) */
@media (max-width: 1024px) {
    .product-detail {
        padding: 25px;
    }
    
    /* Ensure images and specs share space evenly before stacking */
    .product-image, 
    .product-specs {
        min-width: 45%;
    }
}

/* Mobile Landscape / Tablets (Max Width: 768px) */
@media (max-width: 768px) {
    /* 1. LAYOUT STACKING */
    /* Force flex items to take full width to prevent squishing */
    .product-info {
        flex-direction: column;
        gap: 20px;
    }

    .product-image, 
    .product-specs {
        min-width: 100%; /* Override the 300px limit to fit narrower screens */
        flex: 1 1 100%;
    }

    /* 2. SPECS GRID */
    /* Force 2 columns on tablet, 1 on mobile */
    .specs-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* 3. MODAL ADJUSTMENTS */
    /* Move close button inside the viewport so it doesn't get cut off */
    .close-modal {
        top: 10px;
        right: 10px;
        background-color: rgba(0, 0, 0, 0.6); /* Add background for visibility */
        width: 35px;
        height: 35px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        z-index: 1001;
    }
    
    .modal-content {
        width: 95%;
        max-height: 80vh;
    }
}

/* Small Mobile (Max Width: 480px) */
@media (max-width: 480px) {
    
    /* 1. CONTAINER SPACING */
    .product-detail {
        padding: 15px; /* Tighten padding */
        margin-bottom: 30px;
    }

    .product-detail h3 {
        font-size: 20px; /* Reduce header size */
        margin-bottom: 15px;
    }

    /* 2. IMAGE SLIDER */
    .single-image-container {
        height: 250px; /* Reduce height further for small screens */
    }
    
    .single-image-slide {
        padding: 0; /* Remove padding to maximize image size */
    }
    
    .single-image-slide img {
        border-radius: 0; /* Remove border radius on small images for edge-to-edge feel */
    }

    /* 3. SPECS & FEATURES */
    .specs-grid {
        grid-template-columns: 1fr; /* Force single column */
    }
    
    .spec-item {
        padding: 12px;
    }
    
    .spec-item h4 {
        font-size: 15px;
    }
    
    /* 4. DESCRIPTION */
    .product-description-section {
        padding: 15px;
    }
    
    .product-description-section p,
    .product-features li {
        font-size: 0.95rem; /* Slightly smaller text for readability */
    }

    /* 5. OTHER PRODUCTS GRID */
    #other-agricultural .products-grid {
        grid-template-columns: 1fr; /* Stack other products vertically */
        gap: 20px;
    }
}
