/* Product Page Mobile Layout Fixes - Fresh File */

/* FIX: Widen Product Page Container to match Subcategory Page (1730px) */
.product-page-section .container {
    max-width: 100% !important;
    padding-left: 30px;
    padding-right: 30px;
}

.product-page-container {
    width: 100%;
    max-width: 1730px;
    margin: 0 auto;
}

/* ==========================================================================
   PRODUCT PAGE LAYOUT FIXES (Mobile & Desktop)
   ========================================================================== */

/* Container Flex Layout */
.product-detail-container {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 30px !important;
    margin-bottom: 0 !important;
    align-items: flex-start !important;
}

/* DESKTOP LAYOUT (min-width: 1024px) */
@media (min-width: 1024px) {
    .product-detail-container {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        /* Force single row for 4 columns */
        align-items: flex-start !important;
        justify-content: flex-start !important;
        gap: 20px !important;
        /* Reduced to 20px */
    }

    /* Column 1: Thumbnails vertical */
    .product-detail-left {
        width: 100px !important;
        flex-shrink: 0 !important;
        order: 1 !important;
    }

    .product-thumbnails-gallery {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    /* Column 2: Main Image */
    .product-detail-center {
        width: auto !important;
        max-width: 700px !important;
        flex: 0 0 auto !important;
        order: 2 !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: flex-end !important;
        align-items: flex-start !important;
        margin-right: 0 !important;
        padding-right: 0 !important;
    }

    /* Image Card styling */
    .product-main-image-card {
        padding: 10px !important;
        background: #ffffff !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: 0 0 8px rgba(0, 0, 0, 0.1) !important;
        border-radius: 20px !important;
    }

    /* Column 3: Info - fills space between image and reviews */
    .product-detail-right {
        flex: 1 1 auto !important;
        min-width: 250px !important;
        order: 3 !important;
        display: flex !important;
        flex-direction: column !important;
        margin-left: 0 !important;
        margin-right: 20px !important;
    }

    /* Column 4: Reviews */
    .product-reviews-column {
        width: 350px !important;
        flex-shrink: 0 !important;
        order: 4 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
        margin-left: auto !important;
    }

    /* Price & Action Row inside Reviews Column on PC */
    .product-reviews-column .price-action-row {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }

    .product-reviews-column .price-action-row .price-card,
    .product-reviews-column .price-action-row .action-card {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .product-page-section {
        padding-top: 20px !important;
        /* Reduced gap from header globally on PC */
    }

    .product-main-image-card {
        margin-bottom: 0 !important;
        padding: 10px !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 20px !important;
        background: #ffffff !important;
        box-shadow: 0 0 8px rgba(0, 0, 0, 0.1) !important;
        overflow: hidden;
        width: auto !important;
        max-width: 100% !important;
    }

    /* Hide the ::before pseudo-element since the card itself now has the white bg */
    .product-main-image-card::before {
        display: none !important;
    }

    .product-main-image-card img {
        border-radius: 14px !important;
        /* Slightly smaller than card's 20px to account for padding */
        display: block !important;
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }

    .product-page-container>.product-parameter-card.description-parameter-card {
        margin-top: 50px !important;
    }

    /* Parametri table: bigger font on PC */
    .product-description-table td {
        font-size: 15px !important;
    }

    .responsible-person-card {
        margin-top: 50px !important;
        margin-bottom: 0 !important;
        width: 100%;
        max-width: 1730px;
        margin-left: auto;
        margin-right: auto;
    }

    .product-youtube-video {
        margin-top: 50px !important;
        margin-bottom: 50px !important;
    }

    .product-page-container .product-youtube-video .product-parameter-card {
        padding-bottom: 25px !important;
    }

    .product-parameter-card.price-card,
    .product-parameter-card.action-card .add-to-cart-btn {
        min-height: 60px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box !important;
    }
}

/* MOBILE/TABLET LAYOUT (max-width: 1023px) */
@media (max-width: 1023px) {

    /* Force top padding */
    .product-page-section {
        padding-top: 50px !important;
    }

    /* CONTAINER PADDING FIX */
    body .product-page-section>.container,
    body .products-section>.container,
    .product-page-section .container {
        padding-left: 5px !important;
        padding-right: 5px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    /* Layout column */
    .product-detail-container {
        flex-direction: column !important;
        gap: 5px !important;
        /* Reduced to 5px */
        align-items: center !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 1. Main Image */
    .product-detail-center {
        width: 100% !important;
        order: 1 !important;
        display: flex !important;
        justify-content: center !important;
    }

    .product-main-image-card {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* 2. Thumbnails */
    .product-detail-left {
        width: 100% !important;
        order: 2 !important;
        padding-bottom: 0 !important;
        display: flex !important;
        justify-content: center !important;
    }

    .product-thumbnails-gallery {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 10px !important;
        justify-content: flex-start !important;
        overflow-x: auto !important;
        padding: 5px 5px 5px 5px !important;
        min-height: 110px !important;
        margin-bottom: 0 !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        box-sizing: border-box !important;
    }

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

    .thumbnail-card {
        width: 54px !important;
        height: 70px !important;
        flex-shrink: 0 !important;
    }

    /* 3. Info Container - USER REQUESTED FIX */
    .product-detail-right {
        width: 100% !important;
        order: 3 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .product-detail-info {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 5px !important;
        /* Reduced to 5px */
    }

    /* Ensure children fill the padded container */
    .product-detail-info .product-parameter-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin: 0 !important;
    }

    /* PRICE & ACTION ROW - Ensure it has padding too if outside info */
    .price-action-row {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        padding-top: 20px !important;
        /* Added top padding */
        margin: 0 !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 5px !important;
        /* Reduced to 5px */
    }

    .price-action-row .product-parameter-card {
        width: 100% !important;
        margin: 0 !important;
    }

    .price-action-row .action-card {
        margin-top: 20px !important;
    }

    /* Global Card Reset for Mobile */
    .product-parameter-card,
    .responsible-person-card,
    .product-youtube-video {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Common Styles */
.thumbnail-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.thumbnail-card.active {
    border-color: #545454;
    box-shadow: 0 0 0 1px #545454;
}

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

.product-main-image-card {
    position: relative !important;
    overflow: hidden !important;
    background: #fff !important;
    padding: 10px !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

.product-main-image-card img {
    width: 100%;
    height: auto;
    border-radius: 14px;
    display: block;
    object-fit: contain;
    max-height: 80vh;
    transition: opacity 0.2s ease;
}

.nav-arrow {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 10 !important;
    color: #545454 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.nav-arrow:hover {
    background: #fff !important;
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

.nav-arrow:active {
    transform: translateY(-50%) scale(0.95) !important;
}

.nav-arrow.left-arrow {
    left: 10px !important;
}

.nav-arrow.right-arrow {
    right: 10px !important;
}

.product-main-image-card.single-image .nav-arrow {
    display: none !important;
}

/* Minor Styles */
.product-detail-info {
    display: flex;
    flex-direction: column;
    gap: 1.2rem !important;
}

.product-name-title {
    font-size: 2.2rem !important;
    margin-top: 5px !important;
    /* Minimal top margin since section has 40px */
    margin-bottom: 10px !important;
    text-align: start;
}

@media (max-width: 1023px) {
    .product-name-title {
        font-size: 1.8rem !important;
        margin-top: 20px !important;
    }
}

.product-breadcrumb {
    margin-bottom: 30px !important;
    /* Substantial space under breadcrumb */
    padding-bottom: 0 !important;
}

.product-parameter-card:not(.price-card):not(.action-card) {
    padding: 0.5rem 1rem !important;
}

.product-parameter-card {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.parameter-label {
    margin-top: 0.25rem !important;
}

.rating-bar-container {
    border-radius: 50px !important;
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    height: 18px !important;
}

.rating-bar-fill {
    border-radius: 50px !important;
    background-color: #545454 !important;
}

.form-builder-option:hover {
    background: rgba(84, 84, 84, 0.1) !important;
}

@media (max-width: 1023px) {
    .description-two-squares {
        padding-left: 8px !important;
        padding-right: 8px !important;
        padding-bottom: 8px !important;
    }

    /* YouTube Video Card Styling */
    .product-youtube-video .product-parameter-card {
        padding: 8px !important;
        height: auto !important;
    }

    .youtube-video-container {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 5px !important;
        margin-bottom: 5px !important;
    }

    .product-youtube-video {
        margin-bottom: 20px !important;
    }
}