/* ==========================================================================
   Product Detail Page Styles
   Clean, flat aesthetic with gallery + info layout
   ========================================================================== */

/* --- Layout --- */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-12);
    align-items: start;
}

/* --- Gallery --- */
.product-gallery {
    position: sticky;
    top: calc(var(--space-16) + 60px);
}

.gallery-layout {
    display: flex;
    gap: var(--space-3);
}

/* Vertical thumbnail strip (left side) */
.gallery-thumbs {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 500px;
    overflow-y: auto;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.gallery-thumb {
    flex-shrink: 0;
    width: 68px;
    height: 68px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    opacity: 0.5;
    transition: opacity 0.2s ease, border-color 0.2s ease;
}

.gallery-thumb:hover {
    opacity: 0.85;
}

.gallery-thumb--active {
    border-color: var(--color-primary);
    opacity: 1;
}

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

/* Main image area */
.gallery-main {
    flex: 1;
    aspect-ratio: 1 / 1;
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    background-color: var(--color-background);
    position: relative;
    border: 1px solid var(--color-border-light);
}

.gallery-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: opacity 0.3s ease;
}

.gallery-main-img.is-fading {
    opacity: 0;
}

/* Prev / Next arrows on main image */
.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--color-border-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.15s ease;
    z-index: 2;
    padding: 0;
}

.gallery-nav svg {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
}

.gallery-main:hover .gallery-nav {
    opacity: 1;
}

.gallery-nav:hover {
    background: #ffffff;
}

.gallery-nav--prev {
    left: var(--space-3);
}

.gallery-nav--next {
    right: var(--space-3);
}

/* Image counter badge */
.gallery-counter {
    position: absolute;
    bottom: var(--space-3);
    right: var(--space-3);
    background: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-3);
    border-radius: 6px;
    letter-spacing: 0.05em;
    z-index: 2;
}

/* Placeholder (no images) */
.gallery-placeholder {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-background);
    border-radius: var(--border-radius-xl);
    border: 1px solid var(--color-border-light);
    color: var(--color-text-muted);
    font-size: var(--text-lg);
}

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background-color: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.lightbox-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    color: white;
    font-size: var(--text-3xl);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    color: var(--color-accent);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
}

.lightbox-nav svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav--prev {
    left: var(--space-6);
}

.lightbox-nav--next {
    right: var(--space-6);
}

.lightbox-counter {
    position: absolute;
    bottom: var(--space-6);
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--text-sm);
    letter-spacing: 0.1em;
}

/* --- Product Info --- */
.product-info {
    padding-top: var(--space-4);
}

.product-info-name {
    font-size: clamp(1.75rem, 3vw, var(--text-4xl));
    margin-bottom: var(--space-4);
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

.product-info-pricing {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-border-light);
}

.product-info-price {
    font-size: var(--text-2xl);
    margin-bottom: 0;
    color: var(--color-text);
    font-weight: 600;
}

.product-info-price--sale {
    color: var(--color-accent);
}

.product-info-price--original {
    font-size: var(--text-lg);
    color: var(--color-text-muted);
    text-decoration: line-through;
    font-weight: 400;
}

.product-info-sale-badge {
    display: inline-block;
    background: var(--color-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: 6px;
    margin-bottom: var(--space-2);
}

/* Pre-order notice on product detail */
.preorder-notice {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: #F3F0FF;
    border: 1px solid #E2D9F3;
    border-radius: 8px;
}

.preorder-badge {
    display: inline-flex;
    align-items: center;
    background: #553C9A;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 6px;
}

.preorder-availability {
    font-size: 0.85rem;
    color: #553C9A;
    font-weight: 500;
}

.product-info-description {
    color: var(--color-text-light);
    line-height: 1.8;
    margin-bottom: var(--space-8);
}

.product-info-description p {
    margin-bottom: var(--space-4);
}

/* --- CTA Area --- */
.product-cta {
    border-top: 1px solid var(--color-border-light);
    padding-top: var(--space-6);
}

.product-cta form {
    margin-bottom: var(--space-4);
}

.product-cta .btn {
    border-radius: 10px;
}

.product-cta-contact {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.product-cta-contact .btn {
    flex: 1;
    min-width: 140px;
    border-radius: 10px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .product-detail {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .product-gallery {
        position: static;
    }

    .gallery-layout {
        flex-direction: column-reverse;
    }

    .gallery-thumbs {
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .gallery-thumb {
        width: 56px;
        height: 56px;
    }

    .gallery-nav {
        opacity: 1;
    }

    .product-info-name {
        font-size: var(--text-2xl);
    }

    .product-info-price {
        font-size: var(--text-xl);
    }
}
