/**
 * product.css — Single Product Page Styles
 *
 * This stylesheet manages the layout and styling for the premium product detail 
 * page, implementing a high-end interface inspired by modern tech branding.
 *
 * Dependencies:
 * - variables.css: Core design tokens (colors, typography, spacing).
 * - components.css: Shared UI patterns and global reset.
 *
 * @package Frigotel
 */

/* =========================================================
   1. PAGE CONTAINER
   Handles top padding to clear the fixed global header.
   ========================================================= */
.product-page-container {
    background-color: var(--color-sfondo-freddo);
    color: var(--color-blu-profondo);
    font-family: var(--font-family-base);
    padding: calc(var(--header-height) + 20px) 20px 20px;
    height: calc(100vh - var(--wp-admin-bar-height, 0px));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Prevent page-level scroll on desktop */
}

@media (max-width: 1024px) {
    .product-page-container {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }
}

/* =========================================================
   2. GRID LAYOUT
   Main content wrapper using a two-column asymmetrical grid.
   ========================================================= */
.product-layout-grid {
    max-width: 1300px;
    width: 100%;
    max-height: calc(100vh - var(--header-height) - 60px);
    margin: 0 auto;
    padding: 50px; /* Equal padding on all sides */
    display: grid;
    grid-template-columns: 1fr 450px;
    gap: 60px;
    background: var(--color-bianco);
    border-radius: 32px;
    border: 1px solid var(--color-azzurro-tenue);
    box-shadow: 0 16px 50px rgba(13, 46, 107, 0.08);
    min-width: 0;
    overflow: hidden; /* Internal scrolling handled by children */
}

/* =========================================================
   3. GALLERY (LEFT COLUMN)
   Modular carousel system with fade transitions.
   ========================================================= */
.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.carousel-container-outer {
    position: relative;
    width: 100%;
    /* Horizontal padding reserves space for absolute-positioned navigation arrows */
    padding: 0 60px;
}

.main-carousel-wrapper {
    position: relative;
    background: var(--color-sfondo-freddo);
    border-radius: 24px;
    border: 1px solid var(--color-azzurro-tenue);
    overflow: hidden;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: calc(100vh - var(--header-height) - 260px); /* Keep gallery height in check */
}

.carousel-main {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.carousel-slide.active {
    opacity: 1;
    visibility: visible;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* =========================================================
   4. CAROUSEL NAVIGATION ARROWS
   ========================================================= */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-azzurro-tenue);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

@media (hover: hover) {
    .carousel-nav:hover {
        background: var(--color-bianco);
        color: var(--color-blu-primario);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
    }
}

.carousel-nav.prev { left: 0; }
.carousel-nav.next { right: 0; }

/* =========================================================
   5. THUMBNAILS STRIP
   Scrollable thumbnail container with active state markers.
   ========================================================= */
.product-thumbnails {
    display: flex;
    gap: 12px;
    padding: 15px 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    width: 100%;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
}

.product-thumbnails::-webkit-scrollbar {
    display: none;
}

.thumb-item {
    width: 80px;
    height: 80px;
    border: 1px solid var(--color-azzurro-tenue);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    background: var(--color-bianco);
    transition: all 0.3s ease;
    padding: 4px;
}

.thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.thumb-item.active {
    border-color: var(--color-blu-primario);
    border-width: 2px;
    box-shadow: 0 4px 12px rgba(0, 87, 168, 0.1);
}

/* =========================================================
   6. INFO SIDEBAR (RIGHT COLUMN)
   Sticky sidebar containing product specs and actions.
   ========================================================= */
.product-info-sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto; /* Enable internal scroll */
    padding-block: 40px; /* Equal top and bottom padding */
    padding-inline: 25px; /* Breathing room for shadows */
    scrollbar-width: thin;
    scrollbar-color: var(--color-azzurro-tenue) transparent;
}

.product-info-sidebar::-webkit-scrollbar {
    width: 6px;
}

.product-info-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.product-info-sidebar::-webkit-scrollbar-thumb {
    background-color: var(--color-azzurro-tenue);
    border-radius: 10px;
}

.sticky-content {
    position: relative; /* Sticky not needed with internal scroll */
    z-index: 10;
}

.product-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.1;
    color: var(--color-blu-primario);
}

.product-price-section {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin-bottom: 25px;
}

.availability-tag {
    font-size: 14px;
    color: #10B981;
    font-weight: 500;
}

.product-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--color-grigio-testo);
    margin-bottom: 30px;
}

.product-features {
    position: relative;
}

.product-features h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.product-features ul {
    list-style: none;
    padding: 0;
    margin-bottom: 40px;
}

.product-features li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
    font-size: 1rem;
}

.product-features li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--color-ciano-accento);
    font-weight: bold;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: auto;
    padding-top: 40px;
    padding-bottom: 15px;
}

/* =========================================================
   7. GSAP ENTRY ANIMATION — INITIAL STATES
   ========================================================= */
.product-title,
.product-price-section,
.product-description,
.product-features li,
.product-actions .btn {
    opacity: 0;
    transform: translateY(20px);
}

.product-features li {
    transform: translateX(-20px);
}

/* =========================================================
   8. ERROR STATE
   ========================================================= */
.error-section {
    padding: 100px;
    text-align: center;
}

/* =========================================================
   9. RESPONSIVE ADJUSTMENTS
   ========================================================= */
@media (max-width: 1024px) {
    .product-page-container {
        padding: 80px 0 60px;
    }

    .product-layout-grid {
        display: block;
        padding: 30px 15px;
        max-width: 100%;
        max-height: none; /* Allow grid to grow on mobile */
        overflow: visible; /* Allow content to flow naturally */
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .product-gallery {
        width: 100%;
        margin-bottom: 30px;
    }

    .carousel-container-outer {
        padding: 0;
    }

    .carousel-nav.prev { left: 20px; }
    .carousel-nav.next { right: 20px; }

    .main-carousel-wrapper {
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
    }

    .product-info-sidebar {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        height: auto;
        overflow: visible;
        padding-inline: 0;
        padding-block: 20px; /* Reduced vertical padding for mobile */
    }

    /* Force visibility on mobile to prevent GSAP issues */
    .product-title,
    .product-price-section,
    .product-description,
    .product-features li,
    .product-actions .btn {
        opacity: 1 !important;
        transform: none !important;
    }

    .sticky-content {
        position: static;
        height: auto;
        min-height: 0;
    }

    .product-thumbnails {
        display: flex;
        justify-content: flex-start;
        /* Pull-out effect for horizontal scroll on mobile */
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        padding: 15px 15px 20px;
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .product-title {
        font-size: 2rem;
    }

    .main-carousel-wrapper {
        aspect-ratio: 1/1;
        max-height: 50vh;
        margin-bottom: 20px;
    }

    .carousel-slide {
        padding: 0;
    }

    @media (orientation: landscape) {
        .main-carousel-wrapper {
            aspect-ratio: 16/9;
            max-height: 75vh;
        }
    }
}

@media (max-width: 414px) {
    .product-page-container {
        padding-top: 100px;
    }

    .carousel-slide {
        padding: 0;
    }

    .carousel-nav {
        width: 36px;
        height: 36px;
    }

    .carousel-nav.prev { left: 10px; }
    .carousel-nav.next { right: 10px; }

    .product-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 320px) {
    .product-title {
        font-size: 1.6rem;
    }
}