/* --- Product Detail Page Styles --- */

:root {
    --detail-bg: #f6f4f1;
    --text-muted: #666;
    --border-color: rgba(0, 0, 0, 0.08);
}

.product-detail-page {
    background: var(--detail-bg);
}

/* Breadcrumbs */
.breadcrumbs-container {
    padding: 30px 0 10px;
    margin-top: 130px; /* Increased to clear the double-row desktop header */
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.breadcrumbs a {
    color: inherit;
    transition: color 0.3s;
}

.breadcrumbs a:hover {
    color: #1E1E1E;
}

.breadcrumbs .sep {
    opacity: 0.5;
}

/* Product Main Layout */
.product-main {
    padding: 20px 0 80px;
    overflow-x: hidden;
}

.product-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    align-items: start;
}

/* Desktop Logic - Edge to Edge & Swapped Gallery */
@media (min-width: 1025px) {
    .product-main {
        padding-left: 0;
        padding-right: 0;
        overflow-x: hidden;
    }

    .product-layout {
        display: grid;
        grid-template-columns: 55% 45%;
        gap: 0;
        padding: 0;
        max-width: 100%;
        align-items: start;
    }

    .product-gallery {
        display: flex;
        gap: 20px;
        padding-right: 0;
        width: 100%;
    }

    .desktop-gallery {
        display: flex;
        flex-direction: column; /* Stack vertically: image on top, thumbnails below */
        gap: 10px; /* Reduced gap for tighter spacing */
        width: 100%;
        align-items: flex-start;
    }

    .thumbnail-list {
        display: flex;
        flex-direction: row; /* Horizontal layout below main image */
        gap: 15px;
        width: 100%; /* Full width to match main image */
        flex-shrink: 0;
        order: 2; /* Thumbnails come after the main image */
    }

    .thumb-btn {
        width: 120px; /* Fixed width for horizontal layout */
        height: 160px; /* Fixed height to maintain 3:4 ratio */
        border: none;
        background: #fdfdfd;
        padding: 0;
        cursor: pointer;
        overflow: hidden;
        position: relative;
        transition: all 0.4s var(--ease-out);
        border: 1px solid transparent;
        flex: 0 0 auto;
    }

    .thumb-btn.active {
        border-color: #1E1E1E;
    }

    .desktop-gallery .carousel-image-container {
        width: 100%;
        aspect-ratio: 3/4;
        height: auto;
        position: relative;
        overflow: hidden;
        order: 1;
        margin-left: 0;
        background: #fff;
    }

    .desktop-gallery .carousel-track {
        position: absolute;
        inset: 0;
        display: flex;
    }

    .desktop-gallery .carousel-slide {
        width: 100%;
        height: 100%;
        background: #fff;
        flex: 0 0 100%;
        position: relative;
        overflow: hidden;
        cursor: crosshair;
    }

    .desktop-gallery .carousel-slide img {
        width: 100%;
        height: 100%;
        object-fit: cover; /* Edge-to-edge full bleed */
        object-position: center top; /* Preserves heads/faces */
        pointer-events: none; /* Let parent handle mousemove perfectly */
        transition: transform 0.3s ease; /* Smooth zoom in and out instead of jumping */
    }

    .carousel-dots {
        position: absolute;
        bottom: 20px;
        right: 20px;
        display: flex;
        gap: 8px;
        z-index: 10;
        pointer-events: auto;
    }

    .product-summary {
        padding-left: 60px;
        padding-right: 60px;
        padding-top: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        text-align: left;
        max-width: 560px;
    }
}

/* Tablet Logic - For iPads (769px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .product-layout {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        padding: 0 20px;
    }

    .desktop-gallery {
        display: flex;
        flex-direction: row; 
        gap: 15px; 
        width: 100%;
        align-items: flex-start;
    }

    .thumbnail-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 80px;
        max-height: 500px;
        overflow-y: auto;
        flex-shrink: 0;
        order: 1; 
    }
    
    .thumbnail-list::-webkit-scrollbar { width: 3px; }
    .thumbnail-list::-webkit-scrollbar-thumb { background: #eee; border-radius: 4px; }

    .thumb-btn {
        width: 80px; 
        height: 106px; 
        border: none;
        background: #fdfdfd;
        padding: 0;
        cursor: pointer;
        overflow: hidden;
        position: relative;
        flex: 0 0 auto;
    }

    .desktop-gallery .carousel-image-container {
        width: calc(100% - 95px);
        aspect-ratio: 3/4;
        height: auto;
        position: relative;
        overflow: hidden;
        order: 2;
        background: #fff;
    }

    .desktop-gallery .carousel-track {
        position: absolute;
        inset: 0;
        display: flex;
    }

    .desktop-gallery .carousel-slide {
        width: 100%;
        height: 100%;
        background: #fff;
        flex: 0 0 100%;
        position: relative;
        overflow: hidden;
    }

    .desktop-gallery .carousel-slide img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center top;
        pointer-events: none;
    }

    .carousel-dots {
        position: absolute;
        bottom: 20px;
        right: 20px;
        display: flex;
        gap: 8px;
        z-index: 10;
        pointer-events: auto;
    }

    .product-summary {
        padding-top: 0;
    }
}

/* Remove the breakpoint that was pushing the block too far right */
/* Previously this used calc((100vw - 1320px) / 2 + 40px) which
   created a massive unbalanced right gap on wide screens. */

/* Standard Gallery Styles (Mobile & Desktop Defaults) */
.mobile-carousel {
    display: none;
    width: 100%;
}

.desktop-gallery {
    display: flex;
    gap: 10px;
    width: 100%;
}

.thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.main-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-out);
    cursor: zoom-in;
}

.main-image-wrap:hover img {
    transform: scale(1.1);
}

/* Mobile Carousel Specifics */
.carousel-image-container {
    position: relative;
    width: 100%;
}

.carousel-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.carousel-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
    aspect-ratio: 3/4;
    position: relative;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Desktop specific: Ensure full height and width usage */
@media (min-width: 1025px) {
    .desktop-gallery .carousel-slide img {
        object-fit: cover;
        background: #fdfdfd;
    }
}

.carousel-dots {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s;
}

.carousel-dots .dot.active {
    background: #1E1E1E;
    width: 20px;
    border-radius: 4px;
}

/* Summary / Info */
.product-summary {
    position: sticky;
    top: 20px;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.product-category {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 15px;
    text-align: left;
}

.product-title {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--shop-text);
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
}

.product-title1 {
    font-family: var(--font-sans);
    font-size: 24px;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 20px;
    text-align: left;
}

.product-price-wrapper {
    margin-bottom: 30px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    justify-content: flex-start;
}

.product-price-wrapper .price {
    font-size: 18px;
    font-weight: 500;
}

.product-price-wrapper .price-old {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: line-through;
    opacity: 0.6;
}

.product-description-brief {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 25px; /* Reduced from 40px */
    text-align: left;
}

/* Options Groups */
.option-group {
    margin-bottom: 20px; /* Reduced from 30px */
}

.option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.option-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    color: #1E1E1E;
    display: block;
    margin-bottom: 12px;
}

#selectedColor {
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 5px;
}

.size-guide-trigger {
    font-size: 11px;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    color: var(--text-muted);
}

.color-options {
    display: flex;
    gap: 15px;
    padding: 5px 0; /* Extra room for the selection ring */
}

.color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 0;
    transition: transform 0.3s var(--ease-out), box-shadow 0.25s ease;
}

.color-btn:hover {
    transform: scale(1.08);
}

.color-btn.active {
    box-shadow: 0 0 0 2.5px #fff, 0 0 0 4.5px rgba(30, 30, 30, 0.55), 0 4px 12px rgba(0, 0, 0, 0.18);
    transform: scale(1.08);
}

.size-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.size-btn {
    min-width: 50px;
    height: 40px;
    background: #fff;
    border: 1px solid var(--border-color);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.size-btn:hover {
    border-color: #1E1E1E;
}

.size-btn.active {
    background: #1E1E1E;
    color: #fff;
    border-color: #1E1E1E;
}

/* Size Conversion Display */
.size-conversion {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 15px;
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-primary);
    border-top: 1px solid var(--border-color);
}

.size-conversion svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    opacity: 0.9;
}

.size-conversion span {
    font-size: 13px;
    letter-spacing: 0.02em;
    color: var(--text-primary);
}

/* Actions */
.product-actions-fixed {
    display: flex;
    margin-bottom: 25px; /* Reduced from 40px */
    padding-top: 5px;
}

.product-actions-fixed a {
    width: 100%;
}

.product-actions-fixed .btn-add-cart-detail {
    width: 100%;
}

.btn-add-cart-detail {
    flex: 1;
    height: 50px;
    padding: 0 30px; /* Remove large vertical padding to respect height */
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.1em;
    font-size: 13px;
    line-height: 1; /* Match height centering */
}

/* Meta Extra */
.product-meta-extra {
    border-top: 1px solid var(--border-color);
    padding-top: 20px; /* Reduced from 30px */
    margin-bottom: 25px; /* Reduced from 40px */
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Accordion */
.product-accordion {
    border-top: 1px solid var(--border-color);
}

.acc-item {
    border-bottom: 1px solid var(--border-color);
}

.acc-trigger {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.acc-content {
    height: 0;
    overflow: hidden;
}

.acc-icon {
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    opacity: 0.6;
}

.acc-trigger:hover .acc-icon {
    opacity: 1;
}

.acc-trigger span {
    transition: transform 0.3s ease;
}

.acc-trigger:hover span {
    transform: translateX(5px);
}

.acc-item.active .acc-content {
    /* No max-height here, GSAP handles height */
    padding-bottom: 20px;
}

.acc-content ul {
    list-style: none;
    padding-left: 0;
}

.acc-content li {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 10px;
    position: relative;
    padding-left: 20px;
}

.acc-content li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #1E1E1E;
}

.acc-content p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Related Products Grid Overlay Fix */
.related-products .product-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .product-main {
        padding: 10px 0 40px;
    }
    .product-layout {
        display: block;
        width: 100%;
        overflow: hidden;
    }
    .product-gallery {
        flex-direction: column-reverse;
        gap: 10px;
    }
    .thumbnail-list {
        flex-direction: row;
        width: 100%;
        gap: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 5px 0;
    }
    .thumb-btn {
        flex: 0 0 80px;
        max-width: 80px;
    }
    .breadcrumbs-container {
        margin-top: 54px;
        padding: 20px 0 10px;
    }
}

/* Force prevent horizontal scroll globally */
html,
body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
}

.product-detail-page main {
    overflow-x: hidden;
    width: 100%;
}

/* Tighten spacing in Related Products cards */
.related-products .product-price {
    margin-top: 0 !important;
}

.related-products .product-title {
    margin-bottom: 2px !important;
    min-height: auto !important;
}

.related-products .product-footer {
    margin-top: 2px !important;
    min-height: 35px;
}
/* --- Size Guide Drawer --- */
.size-drawer {
    position: fixed;
    top: 0;
    left: -450px; /* Off-screen to the left */
    width: 400px;
    height: 100vh;
    background: #fff;
    z-index: 3000;
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.05); /* Shadow on the right side */
    transition: left 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex;
    flex-direction: column;
}

.size-drawer.active {
    left: 0;
}

.size-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(2px);
    z-index: 2999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s;
}

.size-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 450px) {
    .size-drawer {
        width: 100%;
        left: -100%;
    }
}

/* --- Mobile Sticky Actions --- */
.mobile-sticky-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 12px 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.08);
    z-index: 2000;
    display: none;
    border-top: 1px solid #f0f0f0;
}

body.menu-open .mobile-sticky-actions {
    display: none !important;
}

.sticky-actions-inner {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 15px;
}

.btn-sticky-add {
    flex: 1;
    height: 50px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.1em;
    font-size: 13px;
    background: #1E1E1E;
    color: #fff;
    border: none;
    transition: opacity 0.2s;
}

.btn-sticky-add:hover,
.btn-sticky-add:active {
    opacity: 0.9;
}

/* Overall Mobile Refinements */
@media (max-width: 768px) {
    .product-layout {
        display: block;
        overflow: visible;
        padding: 0 20px; /* Force internal content to have margins */
        margin: 0;
    }

    .product-gallery {
        position: relative;
        left: 50%;
        right: 50%;
        margin-left: -50vw;
        margin-right: -50vw;
        width: 100vw;
        flex-direction: column;
        gap: 0;
        overflow: visible;
    }

    .mobile-carousel {
        display: flex;
        flex-direction: column;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .desktop-gallery {
        display: none;
    }

    .carousel-image-container {
        width: 100%;
        position: relative;
        padding: 0;
        margin: 0;
    }

    .carousel-track {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        padding: 0;
        margin: 0;
    }

    .carousel-dots {
        bottom: 15px;
        z-index: 20;
    }

    .thumbnail-list {
        display: flex;
        flex-direction: row;
        width: 100%;
        gap: 5px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin-top: 5px;
        scroll-padding: 0 20px;
    }

    .thumbnail-list::-webkit-scrollbar {
        display: none;
    }

    .thumb-btn {
        flex: 0 0 100px; /* Slightly larger thumbnails */
        max-width: 100px;
    }

    .mobile-sticky-actions {
        display: block;
    }

    .footer {
        padding-bottom: 90px;
    }

    .product-main {
        padding-top: 0;
    }

    /* .container {
        padding-left: 20px;
        padding-right: 20px;
    } */

    .product-summary {
        position: static;
        padding-top: 30px;
        padding-left: 0;
        padding-right: 0;
        text-align: left;
    }

    .product-actions-fixed {
        padding: 0; /* Respects layout padding */
    }

    .product-price-wrapper {
        justify-content: flex-start;
    }

    .product-price-wrapper .price {
        font-size: 2px;
    }

    .option-header {
        justify-content: space-between;
    }

    .color-options,
    .size-options {
        justify-content: flex-start;
    }

    .option-label {
        font-size: 11px;
    }

    .size-btn {
        flex: 1;
        min-width: unset;
    }

    .product-actions-fixed {
        display: none; /* Hidden on mobile */
        margin-bottom: 30px;
    }

    .meta-item {
        font-size: 13px;
        justify-content: flex-start;
    }
    .related-products .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 25px 15px !important;
        padding: 0 20px !important;
        align-items: stretch !important; /* Ensures cards have same height */
    }
}

/* Related Products Grid for Desktop */
.related-products {
    padding: 30px 0 !important; /* Forces a much smaller vertical gap */
}

.related-products .product-grid {
    margin-top: 15px !important;
}

@media (min-width: 1025px) {
    .related-products .product-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
        padding: 0 40px !important;
    }
}
/* Tighten spacing and align Related Products cards */
.related-products .product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.related-products .product-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.related-products .product-title {
    margin-bottom: 5px !important;
    min-height: 40px; /* Ensures titles take same space */
}

.related-products .product-price {
    margin-top: 0 !important;
    min-height: 44px; /* Fixes alignment for single vs double line prices */
}
/* Size Conversion Display */
.size-conversion {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 0;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

.size-conversion svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.size-conversion span {
    font-size: 11px;
    letter-spacing: 0.02em;
}
