/* ===================================
   Single Product Page - Custom Layout
   Inspired by mes-decouvertes.com
   =================================== */

/* Main Product Layout - Two Column Grid */
.lesmusee-single-product {
    background: var(--color-white);
    padding: 40px 0;
}

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

/* ================================
   Product Gallery Section
   ================================ */

.lesmusee-product-images {
    position: sticky;
    top: 100px;
}

/* Sale Flash Badge */
.lesmusee-product-images .onsale {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--color-sale);
    color: var(--color-white);
    padding: 8px 16px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 20;
    box-shadow: var(--shadow-md);
}

/* Hide WooCommerce default weight/dimensions meta from appearing over image */
.lesmusee-product-images .product_meta,
.woocommerce-product-gallery .product_meta,
.lesmusee-product-images .sku_wrapper,
.lesmusee-product-images .posted_in,
.lesmusee-product-images .tagged_as {
    display: none !important;
}

.lesmusee-product-gallery {
    display: flex;
    gap: 15px;
}

/* Thumbnails Column (Left Side) */
.lesmusee-gallery-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80px;
    flex-shrink: 0;
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--color-gray) transparent;
}

.lesmusee-gallery-thumbnails::-webkit-scrollbar {
    width: 4px;
}

.lesmusee-gallery-thumbnails::-webkit-scrollbar-thumb {
    background: var(--color-gray);
    border-radius: 2px;
}

.lesmusee-thumbnail {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    background: var(--color-gray-light);
    flex-shrink: 0;
}

.lesmusee-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--transition-fast);
}

.lesmusee-thumbnail:hover {
    border-color: var(--color-gray-dark);
    opacity: 0.8;
}

.lesmusee-thumbnail.active {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 2px var(--color-secondary);
}

/* Main Image Display */
.lesmusee-gallery-main {
    flex: 1;
    position: relative;
}

.lesmusee-main-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    background: var(--color-gray-light);
    box-shadow: var(--shadow-md);
}

.lesmusee-main-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lesmusee-main-image.active {
    opacity: 1;
}

.lesmusee-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform var(--transition-slow);
}

.lesmusee-main-image:hover img.zoomable-image {
    transform: scale(1.05);
}

.placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--color-gray-dark);
}

.placeholder-image svg {
    width: 80px;
    height: 80px;
    opacity: 0.4;
}

/* Share Button — base circle styles from .btn-circle-icon in components/products.css */
.lesmusee-share-btn {
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    border: none;
    cursor: pointer;
    z-index: 20;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    color: var(--color-primary);
}

.lesmusee-share-btn:hover {
    transform: scale(1.1);
}

.lesmusee-share-toast {
    position: absolute;
    top: 62px;
    right: 12px;
    background: var(--color-secondary);
    color: var(--color-white);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    z-index: 20;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    white-space: nowrap;
}

.lesmusee-share-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Navigation Arrows */
.lesmusee-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background: var(--color-white);
    border: 2px solid var(--color-gray);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.lesmusee-gallery-nav:hover {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: var(--color-white);
    transform: translateY(-50%) scale(1.1);
}

.lesmusee-gallery-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: translateY(-50%);
}

.lesmusee-gallery-nav.lesmusee-gallery-prev {
    left: 15px;
}

.lesmusee-gallery-nav.lesmusee-gallery-next {
    right: 15px;
}

.lesmusee-gallery-nav svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* ================================
   Product Summary Section
   ================================ */

.lesmusee-product-summary {
    padding: 20px 0;
}

.lesmusee-product-info h1.product_title,
.lesmusee-product-title {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 600;
    color: var(--color-secondary);
    margin-bottom: 15px;
    line-height: 1.3;
    letter-spacing: 0.5px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-cream);
    position: relative;
}

.lesmusee-product-info h1.product_title::after,
.lesmusee-product-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--color-accent);
}

.lesmusee-product-price {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--color-gray);
}

.lesmusee-product-price .price {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-secondary);
    font-family: var(--font-heading);
}

.lesmusee-product-price .price ins {
    text-decoration: none;
}

.lesmusee-product-price .price del {
    color: var(--color-text-light);
    font-size: 24px;
    margin-right: 10px;
}

.lesmusee-product-price .price .woocommerce-Price-amount {
    font-weight: 700;
}

/* Short Description */
.lesmusee-product-excerpt {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--color-gray);
}

.lesmusee-product-excerpt p {
    font-size: 16px;
    line-height: 1.8;
    color: var(--color-text);
    margin: 0;
}

/* Stock Status */
.lesmusee-product-stock {
    margin-bottom: 20px;
}

.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--border-radius);
}

.stock-status.in-stock {
    color: var(--color-success);
    background: rgba(39, 174, 96, 0.1);
}

.stock-status.out-of-stock {
    color: var(--color-error);
    background: rgba(231, 76, 60, 0.1);
}

.stock-status svg {
    width: 16px;
    height: 16px;
}

/* Add to Cart Section */
.lesmusee-product-info form.cart {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--color-gray);
}

/* Variable product forms */
.lesmusee-product-info .variations {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

.lesmusee-product-info .variations label {
    font-weight: 600;
    color: var(--color-primary);
}

.lesmusee-product-info .variations select {
    padding: 10px 15px;
    border: 2px solid var(--color-gray);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: var(--font-body);
    background: var(--color-white);
    cursor: pointer;
}

.lesmusee-product-info .reset_variations {
    font-size: 13px;
    color: var(--color-secondary);
    text-decoration: underline;
}

/* Quantity Input */
.lesmusee-product-info .quantity {
    display: flex;
    align-items: center;
    border: 2px solid var(--color-gray);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.lesmusee-product-info .quantity input[type="number"] {
    width: 60px;
    padding: 12px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-family: var(--font-body);
    -moz-appearance: textfield;
}

.lesmusee-product-info .quantity input[type="number"]::-webkit-outer-spin-button,
.lesmusee-product-info .quantity input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Add to Cart Button */
.lesmusee-product-info button.button.alt,
.lesmusee-product-info button.single_add_to_cart_button,
.lesmusee-product-info a.button {
    flex: 1;
    min-width: 200px;
    padding: 15px 30px !important;
    background: var(--color-secondary) !important;
    color: var(--color-white) !important;
    border: none !important;
    border-radius: var(--border-radius) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    font-family: var(--font-heading) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    cursor: pointer;
    transition: all var(--transition-base) !important;
}

.lesmusee-product-info button.button.alt:hover,
.lesmusee-product-info button.single_add_to_cart_button:hover,
.lesmusee-product-info a.button:hover {
    background: #6b3410 !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-lg) !important;
}

.lesmusee-product-info button.button.alt:disabled,
.lesmusee-product-info button.single_add_to_cart_button:disabled {
    background: var(--color-gray) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Product Meta Information */
.lesmusee-product-meta {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.lesmusee-product-meta > div {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 14px;
}

.product-sku,
.product-weight,
.product-dimensions,
.product-categories,
.product-tags {
    padding: 10px 0;
}

.meta-label {
    font-weight: 600;
    color: var(--color-primary);
    min-width: 120px;
}

.meta-value {
    color: var(--color-text-light);
}

.meta-value a {
    color: var(--color-secondary);
    transition: color var(--transition-fast);
}

.meta-value a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ================================
   Related Products
   ================================ */

.lesmusee-single-product .related.products {
    clear: both;
    margin-top: 80px;
    padding-top: 50px;
    border-top: 1px solid var(--color-gray);
    width: 100%;
}

.lesmusee-single-product .related.products h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--color-primary);
    margin-bottom: 30px;
    letter-spacing: 1px;
}

/* ================================
   Responsive Design
   ================================ */

/* ≤1200px - Tablet Landscape */
@media (max-width: 1200px) {
    .lesmusee-product-layout {
        gap: 40px;
    }

    .lesmusee-product-title {
        font-size: 32px;
    }

    .lesmusee-product-price .price {
        font-size: 28px;
    }
}

/* ≤992px - Tablet Portrait */
@media (max-width: 992px) {
    .lesmusee-product-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    /* Grid items default to min-width:auto which lets them expand to their
       min-content size (e.g. 16 thumbnails × 60px = ~1080px), inflating the
       1fr track beyond the viewport. min-width:0 lets the track constrain them. */
    .lesmusee-product-images,
    .lesmusee-product-info {
        min-width: 0;
    }

    .lesmusee-product-images {
        position: static;
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }

    .lesmusee-gallery-thumbnails {
        width: 70px;
    }

    .lesmusee-product-summary {
        max-width: 600px;
        margin: 0 auto;
        width: 100%;
    }

    .lesmusee-product-title {
        font-size: 32px;
    }

    .lesmusee-product-price .price {
        font-size: 28px;
    }
}

/* ≤768px - Mobile Landscape */
@media (max-width: 768px) {
    .lesmusee-single-product {
        padding: 20px 0;
    }

    .lesmusee-product-gallery {
        flex-direction: column-reverse;
        width: 100%;
        /* overflow-x:hidden clips any child that leaks beyond the gallery box.
           The thumbnail strip's own overflow-x:auto still creates its internal
           scroll context — internal scroll is NOT affected by a parent's overflow. */
        overflow-x: hidden;
    }

    /* Remove flex growth so natural content size (aspect-ratio) drives height */
    .lesmusee-gallery-main {
        flex: none;
        width: 100%;
    }

    .lesmusee-gallery-thumbnails {
        flex-direction: row;
        width: 100%;
        /* min-width:0 prevents Chrome Android from using the thumbnails'
           min-content width (~1080px) as the cross-axis minimum of the
           column-reverse flex container, which would push the whole page wider */
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        max-height: none;
        gap: 8px;
        padding: 5px 0;
        -webkit-overflow-scrolling: touch;
    }

    .lesmusee-gallery-thumbnails::-webkit-scrollbar {
        display: none;
    }

    .lesmusee-gallery-thumbnails {
        scrollbar-width: none;
    }

    .lesmusee-thumbnail {
        width: 60px;
        height: 60px;
        flex-shrink: 0;
    }

    .lesmusee-main-image-container {
        aspect-ratio: 1;
    }

    .lesmusee-gallery-nav {
        display: none; /* swipe handles navigation on mobile */
    }

    .lesmusee-product-info h1.product_title,
    .lesmusee-product-title {
        font-size: 28px;
    }

    .lesmusee-product-price .price {
        font-size: 24px;
    }

    .lesmusee-product-excerpt p {
        font-size: 15px;
        line-height: 1.7;
    }

    .lesmusee-product-info form.cart {
        flex-direction: column;
        align-items: stretch;
    }

    .lesmusee-product-info .quantity {
        width: 100%;
    }

    .lesmusee-product-info .quantity input[type="number"] {
        width: 100%;
    }

    .lesmusee-product-info button.single_add_to_cart_button {
        width: 100%;
        min-width: 0 !important; /* defeats (0,3,1) specificity from .button.alt selector */
    }

    .lesmusee-product-meta > div {
        flex-direction: column;
        gap: 5px;
    }

    .meta-label {
        min-width: auto;
    }
}

/* ≤480px - Mobile Portrait */
@media (max-width: 480px) {
    .lesmusee-product-layout {
        gap: 20px;
    }

    .lesmusee-product-title {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .lesmusee-product-price {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }

    .lesmusee-product-price .price {
        font-size: 22px;
    }

    .lesmusee-product-excerpt {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }

    .lesmusee-product-excerpt p {
        font-size: 14px;
        line-height: 1.6;
    }

    .lesmusee-product-stock {
        margin-bottom: 15px;
    }

    .stock-status {
        font-size: 13px;
        padding: 6px 12px;
    }

    .lesmusee-product-info {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }

    .lesmusee-product-info button.single_add_to_cart_button {
        padding: 14px 20px;
        font-size: 15px;
    }

    .lesmusee-product-meta {
        gap: 10px;
    }

    .lesmusee-product-meta > div {
        font-size: 13px;
    }
}

/* ≤360px - Small Mobile */
@media (max-width: 360px) {
    .lesmusee-product-title {
        font-size: 22px;
    }

    .lesmusee-product-price .price {
        font-size: 20px;
    }

    .lesmusee-thumbnail {
        width: 50px;
        height: 50px;
    }
}
