/*
   product-detail.css
   Styles for the single product detail page, including image gallery,
   zoom effect, and tabbed content.
*/

/* --- MAIN LAYOUT --- */
.product-detail-hero {
    padding-top: calc(var(--nav-height) + 40px);
    padding-bottom: 80px;
}

.product-layout {
    display: flex;
    gap: 60px;
    flex-wrap: wrap; /* Allows wrapping on smaller screens */
    align-items: flex-start; /* Aligns content to the top */
}

/* --- IMAGE GALLERY --- */
.product-image-gallery {
    flex: 1 1 500px; /* Allows it to grow/shrink, with a base of 500px */
    max-width: 50%; /* Maximum 50% width on large screens */
}

.main-image-wrapper {
    width: 100%;
    /* Maintain a square aspect ratio for the main image */
    padding-top: 100%; 
    position: relative;
    overflow: hidden; /* Crucial for zoom effect */
    border: 1px solid #eee;
    /*background-color: var(--gray-light);*/
}

.main-image-wrapper .zoom-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensures entire image is visible, no cropping */
    transform-origin: 0 0; /* Important for zoom origin */
    transition: transform 0.1s ease-out; /* Smooth transition for zoom */
}

/* Zoom Lens (will be made visible and moved by JS) */
.zoom-lens {
    position: absolute;
    border: 2px solid var(--black);
    width: 100px; /* Default size, will be adjusted by JS */
    height: 100px;
    background-color: rgba(0, 0, 0, 0.1);
    cursor: grab;
    display: none; /* Hidden by default */
    pointer-events: none; /* Allows hover events to pass through to the image */
}


.thumbnail-images {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: flex-start; /* Align thumbnails to start */
    flex-wrap: wrap;
}

.thumbnail-images .thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.thumbnail-images .thumbnail:hover,
.thumbnail-images .thumbnail.active {
    border-color: var(--black);
}


/* --- PRODUCT DETAILS --- */
.product-details {
    flex: 1 1 400px; /* Allows it to grow/shrink, with a base of 400px */
    max-width: 45%; /* Maximum 45% width on large screens */
}

.product-title {
    font-size: 0.5rem;
    margin-bottom: 10px;
}

.product-price {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 15px;
}

.product-sku {
    font-size: 0.9rem;
    color: var(--gray-dark);
    margin-bottom: 20px;
}

.product-short-description {
    margin-bottom: 30px;
    line-height: 1.7;
}

.product-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.quantity-selector input[type="number"] {
    width: 70px;
    padding: 8px 10px;
    border: 1px solid #ccc;
    text-align: center;
    -moz-appearance: textfield; /* Hide Firefox number spinner */
}
/* Hide Chrome, Safari, Edge, Opera number spinner */
.quantity-selector input::-webkit-outer-spin-button,
.quantity-selector input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.add-to-cart-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
}


/* --- PRODUCT TABS --- */
.product-tabs {
    margin-top: 40px;
    width: 100%; /* Ensure it spans full width outside the layout grid */
}

.tab-headers {
    display: flex;
    border-bottom: 1px solid #eee;
    overflow-x: auto; /* Allow horizontal scrolling if tabs are numerous */
    -ms-overflow-style: none;    /* IE and Edge */
    scrollbar-width: none;       /* Firefox */
}
.tab-headers::-webkit-scrollbar {
    display: none; /* Hide scrollbar in Chrome/Safari/Opera */
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    background-color: var(--gray-light);
    border: none;
    border-right: 1px solid #eee; /* Separator */
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-dark);
    transition: background-color 0.2s, color 0.2s;
    white-space: nowrap; /* Prevent tab labels from wrapping */
}

.tab-button:last-child {
    border-right: none;
}

.tab-button:hover:not(.active) {
    background-color: #e0e0e0;
}

.tab-button.active {
    background-color: var(--white);
    color: var(--black);
    border-bottom: 2px solid var(--black); /* Active indicator */
    margin-bottom: -1px; /* Overlap border */
}

.tab-content {
    padding: 20px; 
}

.tab-pane {
    display: none;
    line-height: 1.7;
}

.tab-pane.active {
    display: block;
}

.tab-pane ul {
    list-style: disc;
    margin-left: 20px;
    padding: 0;
}
.tab-pane ul li {
    margin-bottom: 8px;
}

/* --- Size Chart Styles (Now in Product Details Column) --- */
.product-size-chart-wrapper {
    margin-top: 20px;
    margin-bottom: 30px;
    padding: 15px;
    border: 1px solid #eee;
    background-color: var(--white);
    border-radius: 4px;
}
.size-chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}
.size-chart-table-container {
    width: 100%;
    overflow-x: auto; /* CRITICAL: Allows table to scroll horizontally */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}
.size-chart-table-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, and Opera */
}
.size-chart-table {
    /* Use min-width to force scroll if needed */
    min-width: 500px; 
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    border: 1px solid #ccc;
    font-size: 0.9rem; /* Smaller font for dense data */
}
.size-chart-table th, 
.size-chart-table td {
    border: 1px solid #eee;
    padding: 8px;
    white-space: nowrap; /* Keep cell content from wrapping too much */
}
.size-chart-table th {
    background-color: #ccc;
    font-weight: bold;
    color: var(--black);
}

/* --- New Styles for Size Selection and Payment Methods --- */

.product-selection-group {
    margin-bottom: 30px;
}

.product-selection-group h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.size-options {
    display: flex;
    gap: 10px;
}

.size-box {
    padding: 10px 15px;
    border: 1px solid var(--gray-dark);
    background-color: var(--white);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.size-box:hover,
.size-box.active {
    background-color: var(--black);
    color: var(--white);
    border-color: var(--black);
}

/* --- Payment Methods Div --- */

.payment-methods-div {
    border: 1px solid #eee;
    padding: 20px;
    margin-bottom: 40px;
    border-radius: 4px;
    background-color: var(--gray-light);
}

.payment-methods-div h4 {
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.payment-icons {
    display: flex;
    gap: 15px;
    font-size: 2rem; /* Style for font-awesome icons if used */
    color: var(--black);
    align-items: center;
    margin-bottom: 15px;
}
/* If using image icons, use this: */
.payment-icons img {
    height: 25px;
}

.guarantee-text {
    font-size: 0.85rem;
    color: var(--gray-dark);
    text-align: center;
}

/* --- RELATED PRODUCTS SECTION (Basic styling) --- */
.product-grid {
    margin-top: 40px;
    overflow-x: hidden; 
}

/* ------------------------------------------------------------------- */
/* CUSTOMER REVIEWS SECTION STYLES (ADDED) */
/* ------------------------------------------------------------------- */
.customer-reviews-section {
    padding: 60px 0;
    background-color: var(--gray-light);
    margin-top: 40px;
}

.customer-reviews-section .section-title {
    font-size: 2rem;
    margin-bottom: 40px;
}

/* Review Summary (Full Section) */
.review-stats-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    margin-bottom: 40px;
    padding: 30px;
    border: 1px solid #ddd;
    background-color: var(--white);
    border-radius: 5px;
}
.average-rating-display {
    flex-shrink: 0;
    text-align: center;
}
.average-rating-display .score {
    font-size: 3em;
    font-weight: bold;
    color: var(--black);
}
.average-rating-display p {
    font-size: 0.9em;
    color: var(--gray-dark);
}

/* Review Submission Form */
.review-form-container {
    flex-grow: 1;
    max-width: 600px;
    /* Styles are defined in the previous block but are repeated here for clarity */
}
.review-form-container h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}
.rating-input {
    display: flex;
    justify-content: center;
    flex-direction: row-reverse; /* Puts 5-star on the right */
    gap: 5px;
    margin-bottom: 20px;
}
.rating-input input[type="radio"] {
    display: none;
}
.rating-input label {
    font-size: 2em;
    color: #ddd;
    cursor: pointer;
    margin: 0;
    transition: color 0.2s;
}
/* Highlight stars when checked or hovered (using Font Awesome filled star style) */
.rating-input input:checked ~ label,
.rating-input label:hover,
.rating-input label:hover ~ label {
    color: #000000; /* Gold/Yellow star color */
}

/* Individual Review List/Grid */
.reviews-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}
.review-card {
    background: var(--white);
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.review-card .reviewer-name {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1.1rem;
}
.review-card .review-date {
    font-size: 0.8rem;
    color: var(--gray-dark);
    margin-bottom: 10px;
    display: block;
}
.review-card .star-rating-card i {
    color: #acacac;
    font-size: 1em;
}
.review-card .review-text {
    margin-top: 10px;
    line-height: 1.6;
}

/* Review Card Mini (used inside the product tabs) */
.review-card-mini {
    border-bottom: 1px dashed #eee;
    padding: 10px 0;
    margin-bottom: 10px;
}
.review-card-mini .review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}
.review-card-mini .review-user {
    font-weight: 600;
}
.review-card-mini .review-date {
    font-size: 0.75rem;
    color: #999;
}
.star-rating-card i {
    /* Base style for all 5 stars */
    color: #ccc; /* Light gray color for non-filled stars */
    font-size: 1em;
}

/* Filled Star Style (Should be colored) */
.star-rating-card i.filled {
    /* Style for stars that are less than or equal to the rating */
    color: #000000; /* Gold/Yellow star color */
}
.review-card-mini:last-of-type {
    border-bottom: none;
}


/* ------------------------------------------------------------------- */
/* RESPONSIVENESS */
/* ------------------------------------------------------------------- */

@media (max-width: 1200px) {
    .product-layout {
        gap: 30px;
    }
}

@media (max-width: 992px) {
    .product-layout {
        flex-direction: column;
        align-items: center; /* Center items when stacked */
    }
    
    .product-image-gallery,
    .product-details {
        max-width: 100%; /* Take full width */
        flex: 1 1 100%; /* Take full width */
    }

    .product-image-gallery {
        margin-bottom: 30px;
    }
    /* ... (other product-details alignment) ... */
    
    .tab-headers {
        flex-wrap: nowrap;
        width: 100%;
    }
    
    /* Responsive Review Section */
    .review-stats-summary {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }
    .average-rating-display .score {
        font-size: 2.5em;
    }
}

@media (max-width: 768px) {
    .product-detail-hero {
        padding-top: calc(var(--nav-height) + 20px);
        padding-bottom: 40px;
    }
    /* ... (other 768px changes) ... */
    
    .customer-reviews-section {
        padding: 40px 0;
    }
    .size-chart-table {
        min-width: 500px; /* Ensure scrollability is triggered on smaller screens */
    }
}

@media (max-width: 480px) {
    /* ... (thumbnail, product-actions changes) ... */
    
    .reviews-list {
        /* Forces single column on very small phones */
        grid-template-columns: 1fr; 
    }
    .review-form-container {
        padding: 15px;
    }
    .rating-input label {
        font-size: 1.8em;
    }
    .product-size-chart-wrapper {
        padding: 10px;
    }
}

/* * Individual Review List/Grid */ 
.reviews-list {
    /* Existing styles */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;

    /* --- NEW SCROLLABLE STYLES START --- */
    max-height: 500px; /* Fixed maximum height */
    overflow-y: auto; /* Enable vertical scrolling when content exceeds max-height */
    padding-right: 15px; /* Add padding to account for the scrollbar on the right */
    
    /* Enhance Scrollbar (Optional, for modern browsers) */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--black) #f1f1f1; /* Firefox */
}

/* Scrollbar styles for Chrome/Safari */
.reviews-list::-webkit-scrollbar {
    width: 8px;
}
.reviews-list::-webkit-scrollbar-thumb {
    background-color: var(--black);
    border-radius: 4px;
}
.reviews-list::-webkit-scrollbar-track {
    background-color: #f1f1f1;
}
/* --- NEW SCROLLABLE STYLES END --- */

/* ... (Rest of existing styles for review-card etc.) ... */

/* ------------------------------------------------------------------- */
/* RESPONSIVENESS */
/* ------------------------------------------------------------------- */

@media (max-width: 992px) {
    /* ... (Existing responsive code) ... */
}

@media (max-width: 768px) {
    /* ... (Existing responsive code) ... */

    /* Adjust height on smaller screens */
    .reviews-list {
        max-height: 500px; /* Shorter height on tablets/mobiles */
    }
}