/* Product Page Styles */

/* Product Grid Layout */
.product-grid {
    display: grid;
    grid-template-columns: 1fr; /* Ensures a single column layout by default */
    gap: 1.5rem;
    padding: 1rem;
    width: 100%; /* Ensure it takes full width within its parent */
    margin: 0 auto; /* Center the grid container */
    max-width: 1200px; /* Max-width for the overall product content area on larger screens */
}

/* Product Card Styles */
.product-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1.5rem; /* Base padding */
    margin: 1rem 0; /* Vertical margin, no horizontal margin here as product-grid centers it */
    width: 100%; /* Take full width of its parent (.product-grid) */
    display: block; /* Ensure it behaves as a block element */
    box-sizing: border-box; /* Include padding in the width calculation */
}

/* Override general styles.css styles */
.product-detail-page {
    padding: 70px 0 2rem;
    margin: 0;
}

/* Base styles for all product-specs lists */
.product-specs {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%; /* Ensure it takes full width */
}

.product-specs li {
    display: flex;
    align-items: flex-start; /* Align icon to the top of text */
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 4px;
    width: 100%; /* Ensure list items also take full width */
    box-sizing: border-box; /* Include padding in the width calculation */
    flex-wrap: nowrap; /* Default: prevent wrapping for all list items */
    font-size: 1rem; /* Base font size */
}

.product-specs li i {
    color: var(--primary-color);
    font-size: 1.25rem;
    margin-right: 0.5rem;
    flex-shrink: 0; /* Prevent icon from shrinking */
    padding-top: 0.2rem; /* Minor adjustment for visual alignment with text */
}

/* Styles for the new .feature-description wrapper div */
.product-specs li .feature-description {
    display: flex; /* Make this inner div a flex container */
    flex-direction: row; /* Default to row (inline) */
    flex-wrap: wrap; /* Allow content inside this div to wrap */
    flex: 1; /* Allow it to take up available space */
    align-items: flex-start; /* Align strong and span to top */
}

.product-specs li .feature-description strong {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-right: 0.5rem;
    flex-shrink: 0; /* Prevent strong text from shrinking */
}

.product-specs li .feature-description span {
    flex: 1; /* Allow span to take remaining space */
    word-break: break-word; /* Ensure long words wrap */
    padding-left: 0; /* Reset */
    margin-top: 0; /* Reset */
}


/* Technical Specifications and Warranty Sections */
.spec-table {
    width: 100%;
    overflow-x: auto; /* Always allow horizontal scroll for tables */
    -webkit-overflow-scrolling: touch;
    margin-bottom: 2rem; /* Add some space below the table */
    display: block; /* Ensure the table container is a block */
}

.spec-row {
    display: block; /* Force each spec-row to take its own line */
    width: 100%; /* Ensure it takes full width within its parent */
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 8px;
    box-sizing: border-box; /* Include padding in the width calculation */
}

.spec-label {
    font-weight: bold;
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    color: var(--primary-color);
    display: block; /* Ensure label takes its own line */
    padding: 0.5rem 0;
    width: 100%; /* Ensure label takes full width */
    box-sizing: border-box;
}

.spec-value {
    width: 100%; /* Ensure value section takes full width */
    display: block; /* Ensure value section is a block */
}

.spec-value ul {
    padding: 0;
    margin: 0;
    list-style: none;
    width: 100%; /* Ensure ul takes full width */
}

.spec-value li {
    margin-bottom: 0.5rem;
    word-break: break-word; /* Prevent content from overflowing */
    display: block; /* Ensure list items take their own line */
    width: 100%; /* Ensure list items take full width */
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    box-sizing: border-box;
}

.spec-value li i {
    color: var(--primary-color);
    display: inline-block;
    margin-right: 0.5rem;
}

.spec-value li:last-child {
    border-bottom: none;
}

/* Product Image */
.product-image {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 1rem;
    max-height: 600px; /* Kept for general max height, overridden by max-width on desktop */
    object-fit: cover;
}

/* Product Content */
.product-content {
    font-size: 1rem;
    line-height: 1.6;
    width: 100%;
}

.product-content h2, .product-content h3 {
    margin: 1rem 0 0.5rem;
    font-size: 1.25rem;
}

.product-content p {
    margin-bottom: 1rem;
    width: 100%;
}

/* CTA Section */
.cta-section {
    text-align: center;
    margin-top: 2rem;
}

.cta-section .button {
    display: inline-block;
    padding: 0.8em 1.5em;
    background-color: var(--primary-color); /* Assuming you have this defined in styles.css */
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.cta-section .button:hover {
    background-color: #0056b3; /* Darker blue for hover, adjust to your theme */
}

/* Mobile-specific adjustments (consolidated) */
@media (max-width: 768px) {
    .product-detail-page {
        padding: 80px 0 2rem;
    }

    .product-grid {
        padding: 0.5rem;
    }

    .product-card {
        padding: 1rem; /* Consistent mobile padding */
        margin: 0.5rem 0; /* Consistent mobile margin */
        max-width: none; /* Crucial: Remove max-width for full width on mobile */
    }

    .product-content {
        padding: 0; /* Ensures content fills the card */
    }

    /* Base .product-specs li adjustments for mobile */
    .product-specs li {
        padding: 0.8rem 0.5rem; /* Slightly reduced padding for tighter mobile layout if needed */
        font-size: 0.95rem; /* Slightly smaller text for specs on mobile */
    }

    .product-specs li i {
        font-size: 1rem; /* Keep icons readable */
        margin-right: 0.3rem; /* Slightly reduced margin for tighter layout */
    }

    /* For .feature-description (Key Features, Additional Benefits) on mobile */
    .product-specs li .feature-description {
        flex-direction: column; /* Stack strong and span vertically */
        flex-basis: calc(100% - 1rem - 0.3rem); /* Allow description to take available width after icon */
    }

    .product-specs li .feature-description strong {
        margin-right: 0; /* Remove right margin when stacked */
        flex-basis: 100%; /* Ensure strong takes full width within its div */
    }

    .product-specs li .feature-description span {
        flex-basis: 100%; /* Ensure span takes full width within its div */
        padding-left: 0; /* No extra indent, as its parent div is already positioned */
        margin-top: 0.2rem; /* Small space between stacked strong and span */
    }

    /* For lists without .feature-description (Maintenance & Care, Installation Options) */
    /* Ensure icon and text stay inline and take up available space */
    .product-specs li:not(:has(.feature-description)) {
        flex-wrap: nowrap; /* Explicitly prevent wrapping for these specific lists */
    }
    .product-specs li:not(:has(.feature-description)) i {
        margin-right: 0.5rem; /* Ensure consistent margin for these icons */
    }
    /* Any direct text node will flow naturally beside the icon */


    /* Technical Specifications specific mobile adjustments */
    .spec-row {
        padding: 1.25rem; /* Adjusted mobile padding for spec rows */
        margin-bottom: 1.5rem;
    }

    .spec-label {
        font-size: 1.1rem;
        padding: 0.75rem; /* Added horizontal padding for text within the colored label */
        margin-bottom: 1rem;
        background: var(--primary-color);
        color: white;
        border-radius: 4px;
        text-align: center;
    }

    .spec-value li {
        padding: 0.75rem 0; /* Slightly reduced vertical padding for tighter list items */
        border-bottom: 1px solid #eee;
    }

    .spec-value li i {
        margin-right: 0.75rem;
    }

    .spec-value ul {
        padding-left: 0.75rem;
    }
}

/* Desktop/Larger Screen Adjustments */
@media (min-width: 769px) {
    .product-grid {
        max-width: none; /* Let the container control the max-width now */
        margin: 0; /* Remove auto margin as container handles centering */
        padding: 0 2rem; /* Add some padding on the sides for a slight margin from screen edges */
    }

    .product-card {
        max-width: none; /* Let the container control the max-width now */
        margin: 0; /* Remove auto margin as container handles centering */
    }

    /* Smaller image on laptop */
    .product-image {
        max-width: 500px; /* Set a specific max-width for the image on larger screens */
        height: auto; /* Maintain aspect ratio */
        display: block; /* Ensure margin auto works */
        margin: 0 auto 1.5rem auto; /* Center the image and add bottom margin */
    }


    /* Ensure these elements continue to take full width within their parents on desktop too */
    .product-specs,
    .product-specs li,
    .spec-table,
    .spec-row,
    .spec-label,
    .spec-value,
    .spec-value ul,
    .spec-value li {
        width: 100%;
        box-sizing: border-box; /* Ensure padding is included in width */
    }

    /* On desktop, for all product-specs li, allow contents to flow inline */
    .product-specs li {
        flex-wrap: nowrap; /* Prevent wrapping on desktop by default */
        align-items: center; /* Center vertically when inline */
    }

    .product-specs li i {
        padding-top: 0; /* Reset vertical alignment adjustment on desktop */
    }

    /* For the .feature-description on desktop, make strong and span inline */
    .product-specs li .feature-description {
        flex-direction: row; /* Stack horizontally */
        flex-wrap: nowrap; /* Prevent wrapping within this div */
    }
    .product-specs li .feature-description strong {
        margin-right: 0.5rem; /* Restore margin */
        flex-basis: auto; /* Natural size */
    }
    .product-specs li .feature-description span {
        flex-basis: auto; /* Natural size */
    }
}

/* Animation Classes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate__fadeInUp {
    animation: fadeInUp 0.6s ease-out;
}