/* ==============================================
   SINGLE TOUR PRODUCT PAGE STYLES - MATCH HTML MOCKUP
   File: assets/css/single-tour.css
   UPDATED: Enhanced gallery fixes and reviews integration
   FIXED: Mobile white space issue resolved
   ENHANCED: Added lightbox styles and removed yellow borders
   UPDATED: New enhanced reviews design with filters and masonry layout
   ============================================== */

/* ========================================
   1. PRODUCT CONTAINER & WRAPPER
   ======================================== */
.product-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px;
}

.product-wrapper {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-transition {
    animation: fadeIn 0.4s ease;
}

/* ========================================
   2. PRODUCT GALLERY - ENHANCED FIXED GRID LAYOUT
   ======================================== */
.product-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 450px;
    width: 100%;
    position: relative;
    margin-bottom: 40px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    border-radius: 20px;
    overflow: hidden;
}

.gallery-main {
    position: relative;
    overflow: hidden;
    background: #f5f5f5 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.gallery-main .main-image,
.gallery-main img#mainGalleryImage {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    background: #f5f5f5 !important;
    cursor: pointer;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-main:hover .main-image {
    transform: scale(1.05);
}

/* ========================================
   LIGHTBOX STYLES - ENHANCED
   ======================================== */
.gallery-lightbox.hidden { 
    display: none; 
}

.gallery-lightbox {
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,.9);
    display: flex; 
    align-items: center; 
    justify-content: center;
    z-index: 9999;
}

.gallery-lightbox .glb-image {
    max-width: 92vw; 
    max-height: 82vh; 
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

.glb-close {
    position: absolute; 
    top: 16px; 
    right: 20px;
    font-size: 32px; 
    line-height: 1; 
    background: transparent; 
    color: #fff; 
    border: 0; 
    cursor: pointer;
    transition: transform 0.2s;
}

.glb-close:hover {
    transform: scale(1.2);
}

.glb-nav {
    position: absolute; 
    top: 50%; 
    transform: translateY(-50%);
    font-size: 48px; 
    line-height: 1; 
    background: rgba(0,0,0,.35); 
    color: #fff; 
    border: 0; 
    cursor: pointer;
    width: 56px; 
    height: 56px; 
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    user-select: none;
    transition: background 0.3s;
}

.glb-nav:hover {
    background: rgba(0,0,0,.6);
}

.glb-prev { 
    left: 20px; 
}

.glb-next { 
    right: 20px; 
}

.glb-counter {
    position: absolute; 
    bottom: 16px; 
    left: 50%; 
    transform: translateX(-50%);
    color: #fff; 
    font-size: 14px; 
    opacity: .85; 
    padding: 4px 8px; 
    background: rgba(0,0,0,.35); 
    border-radius: 6px;
}

/* Zone laterali di click per scorrere */
.glb-zone { 
    position: absolute; 
    top: 0; 
    bottom: 0; 
    width: 40%; 
    cursor: pointer; 
}

.glb-zone-left { 
    left: 0; 
}

.glb-zone-right { 
    right: 0; 
}

/* ========================================
   THUMBNAIL GRID - ENHANCED FIXED 2x2 LAYOUT
   ======================================== */

/* Desktop thumbnail grid - PRIORITÀ ALTA */
@media (min-width: 769px) {
    .product-gallery .gallery-thumbs {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: 1fr 1fr !important;
        gap: 3px !important;
        background: white !important;
        padding: 3px !important;
        width: auto !important;
        height: auto !important;
        position: relative !important;
    }
    
    .product-gallery .gallery-thumb {
        position: relative !important;
        width: 100% !important;
        aspect-ratio: 1 / 1 !important;
        overflow: hidden !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        border-radius: 12px !important;
        background: #f5f5f5 !important;
        border: 0 !important;
        outline: 0 !important;
        box-shadow: none !important;
    }
    
    .product-gallery .gallery-thumb img {
        width: 100% !important;
        height: 100% !important;
        object-fit: contain !important;
        background: #f5f5f5 !important;
        transform: none !important;
        image-rendering: auto !important;
        border: 0 !important;
        outline: 0 !important;
        box-shadow: none !important;
    }
}

/* Mobile - completely hide thumbnails - FIXED */
@media (max-width: 768px) {
    .product-gallery {
        display: block !important;
        height: 300px !important; /* Altezza fissa solo per la main image */
        grid-template-columns: none !important;
        margin-bottom: 20px !important; /* Ridotto il margin bottom */
    }

    .gallery-main {
        height: 100% !important; /* Usa l'altezza del parent */
        border-radius: 16px !important;
        width: 100% !important;
    }

    .product-gallery .gallery-thumbs,
    .product-gallery .gallery-thumb,
    .product-gallery .placeholder-thumb {
        display: none !important;
        visibility: hidden !important;
        position: absolute !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Hide lightbox navigation buttons on mobile - swipe only */
    .glb-nav.glb-prev,
    .glb-nav.glb-next {
        display: none !important;
    }
}

.gallery-thumb:hover {
    transform: scale(0.95);
    opacity: 0.8;
}

.gallery-thumb.active {
    box-shadow: 0 0 0 3px #f79448 !important;
}

/* ========================================
   REMOVE ALL YELLOW BORDERS/OUTLINES - ENHANCED
   ======================================== */
.product-gallery img,
.product-gallery .gallery-thumb,
.product-gallery .gallery-thumb img,
.product-gallery #mainGalleryImage,
.product-gallery .gallery-thumb:focus,
.product-gallery .gallery-thumb:focus-visible,
.product-gallery .gallery-thumb:active,
.product-gallery .gallery-thumb *:focus,
.product-gallery #mainGalleryImage:focus,
.product-gallery #mainGalleryImage:active,
.gallery-main img,
.gallery-main img:focus,
.gallery-main img:active {
    outline: 0 !important;
    box-shadow: none !important;
    border: 0 !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Remove tap highlight on mobile */
.product-gallery * { 
    -webkit-tap-highlight-color: transparent !important; 
}

/* ========================================
   PLACEHOLDER STYLING - ENHANCED
   ======================================== */
.product-gallery .gallery-thumb.placeholder-thumb,
.product-gallery .gallery-main.placeholder-gallery {
    background: linear-gradient(135deg, #5a8fd3 0%, #7ba3e0 100%) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-align: center !important;
    aspect-ratio: 1 / 1 !important;
}

/* Enhanced placeholder colors for thumbnails */
.product-gallery .gallery-thumb.placeholder-thumb:nth-child(1) {
    background: linear-gradient(135deg, #3068b3 0%, #4a7bc8 100%) !important;
}

.product-gallery .gallery-thumb.placeholder-thumb:nth-child(2) {
    background: linear-gradient(135deg, #5a8fd3 0%, #7ba3e0 100%) !important;
}

.product-gallery .gallery-thumb.placeholder-thumb:nth-child(3) {
    background: linear-gradient(135deg, #4a7bc8 0%, #6495ed 100%) !important;
}

.product-gallery .gallery-thumb.placeholder-thumb:nth-child(4) {
    background: linear-gradient(135deg, #6495ed 0%, #89b0f0 100%) !important;
}

.product-gallery .placeholder-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    color: white !important;
    font-weight: 600 !important;
    padding: 10px !important;
}

.placeholder-text {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

/* DISABLE MOBILE GALLERY COMPLETELY */
.mobile-gallery-wrapper,
.gallery-nav,
.gallery-dots {
    display: none !important;
    visibility: hidden !important;
}

/* ========================================
   3. PRODUCT HEADER - EXACT MATCH TO MOCKUP
   ======================================== */
.product-header-section {
    padding: 50px 40px;
    background: #f8f9fa;
    text-align: center;
}

.product-title {
    font-size: 36px;
    font-weight: 800;
    color: #3068b3;
    margin-bottom: 20px;
    line-height: 1.2;
}

.product-subtitle {
    font-size: 18px;
    color: #666;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ========================================
   4. PRODUCT CONTENT LAYOUT
   ======================================== */
.product-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    padding: 40px;
}

.product-main {
    padding-right: 20px;
}

/* FIXED: Ensure all sections are visible */
.product-section {
    margin-bottom: 40px;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    position: static !important;
    z-index: auto !important;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
}

.section-content {
    color: #666;
    line-height: 1.8;
    font-size: 16px;
}

/* ========================================
   5. HIGHLIGHTS LIST (COSA INCLUDE) - ENHANCED VERSION
   ======================================== */
.highlights-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    margin-top: 20px !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    z-index: auto !important;
}

.highlight-item {
    padding: 25px !important;
    background: white !important;
    border-left: 5px solid #f79448 !important;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1) !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    position: static !important;
    z-index: auto !important;
}

.highlight-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.highlight-title {
    font-size: 20px !important;
    font-weight: 700 !important;
    color: #222 !important;
    margin-bottom: 10px !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

.highlight-text {
    font-size: 15px !important;
    color: #666 !important;
    line-height: 1.6 !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* IMPORTANT: Override any theme styles that might hide content */
.highlights-list *,
.highlight-item *,
.product-section * {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ========================================
   6. TIMELINE - EXACT MATCH TO HTML MOCKUP
   ======================================== */
.timeline {
    position: relative;
}

.timeline-item {
    display: flex;
    gap: 20px;
    margin-bottom: 0;
    position: relative;
    padding-bottom: 25px;
}

.timeline-item:not(:last-child) {
    margin-bottom: 35px;
}

/* Linea verticale grigia ESATTA come nella bozza */
.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 19px;
    top: 45px;
    width: 2px;
    height: calc(100% + 35px);
    background: rgba(224, 224, 224, 0.5);
    z-index: 1;
}

.timeline-dot {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #f79448, #e8843f);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(247, 148, 72, 0.3);
    z-index: 2;
    position: relative;
    font-size: 16px;
}

.timeline-content {
    flex: 1;
    padding-bottom: 10px;
}

.timeline-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.timeline-detail {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* TEMPO DI SOSTA - A FIANCO AL NOME */
.stop-duration-inline {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    white-space: nowrap;
}

/* TEMPO DI NAVIGAZIONE - A METÀ DELLA LINEA */
.navigation-time {
    position: absolute;
    left: 30px;
    top: calc(50% + 22px);
    font-size: 11px;
    font-weight: 500;
    color: #888;
    white-space: nowrap;
    z-index: 3;
}

.timeline-item:last-child .navigation-time {
    display: none;
}

/* ========================================
   7. BOOKING SIDEBAR - EXACT MATCH TO MOCKUP
   ======================================== */
.product-sidebar {
    position: sticky;
    top: 110px;
    height: fit-content;
}

.booking-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border: 1px solid rgba(224, 224, 224, 0.3);
}

.booking-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 20px;
}

.booking-price-amount {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(135deg, #3068b3, #2a5ba1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.booking-price-period {
    font-size: 16px;
    color: #666;
}

.booking-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid rgba(224, 224, 224, 0.5);
}

.booking-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.booking-detail-label {
    color: #666;
}

.booking-detail-value {
    font-weight: 600;
    color: #333;
}

/* ========================================
   8. BOOKING BUTTONS & FIXED SCROLL BUTTON
   ======================================== */
.booking-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #f79448, #e8843f);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(247, 148, 72, 0.3);
}

.booking-button:hover {
    background: linear-gradient(135deg, #e8843f, #d7743a);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(247, 148, 72, 0.4);
}

.back-button {
    width: 100%;
    padding: 14px;
    background: white;
    color: #3068b3;
    border: 2px solid #3068b3;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: rgba(48, 104, 179, 0.05);
    transform: translateY(-2px);
}

/* FIXED SCROLL TO BOOKING BUTTON */
.scroll-to-booking {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: auto;
    height: 50px;
    padding: 0 20px;
    background: linear-gradient(135deg, #f79448, #e8843f);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(247, 148, 72, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    white-space: nowrap;
}

.scroll-to-booking.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.scroll-to-booking:hover {
    background: linear-gradient(135deg, #e8843f, #d7743a);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(247, 148, 72, 0.5);
}

.scroll-to-booking:hover.hidden {
    transform: translateY(20px);
}

/* Bokun widget container */
.bokun-widget-container {
    margin-top: 20px;
}

/* ========================================
   ENHANCED REVIEWS SECTION - UPDATED DESIGN
   ======================================== */
.reviews-section-enhanced {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 50px;
    margin: 50px 0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}

.reviews-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.reviews-title {
    font-size: 36px;
    font-weight: 800;
    color: #3068b3;
    margin-bottom: 30px;
    position: relative;
}

.reviews-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: #3068b3;
    border-radius: 2px;
}

/* Filter chips horizontal layout */
.reviews-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin-bottom: 40px;
    background: #f8f9fa;
    border-radius: 30px;
    padding: 5px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.filter-chip {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    text-align: center;
}

.filter-chip:hover {
    transform: translateY(-1px);
}

.filter-chip.active {
    background: white;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Platform-specific colors for active filters */
.filter-chip[data-filter="getyourguide"].active {
    color: #ff6b35;
    border: 2px solid #ff6b35;
}

.filter-chip[data-filter="viator"].active {
    color: #28a745;
    border: 2px solid #28a745;
}

.filter-chip[data-filter="checkyeti"].active {
    color: #007bff;
    border: 2px solid #007bff;
}

.filter-chip[data-filter="google"].active {
    color: #ea4335;
    border: 2px solid #ea4335;
}

.filter-count {
    font-size: 12px;
    opacity: 0.8;
}

/* Masonry grid layout for reviews */
.reviews-grid-enhanced {
    column-count: 3;
    column-gap: 25px;
    margin-bottom: 40px;
}

@media (max-width: 1200px) {
    .reviews-grid-enhanced {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .reviews-grid-enhanced {
        column-count: 1;
    }
}

/* Enhanced review card */
.review-card-enhanced {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: 1px solid rgba(224, 224, 224, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    break-inside: avoid;
    margin-bottom: 25px;
    display: inline-block;
    width: 100%;
}

.review-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: var(--source-color);
    transition: width 0.3s ease;
}

.review-card-enhanced:hover::before {
    width: 7px;
}

/* Source-specific colors */
.review-card-enhanced[data-source="getyourguide"] {
    --source-color: #ff6b35;
    --source-bg: rgba(255, 107, 53, 0.1);
}

.review-card-enhanced[data-source="viator"] {
    --source-color: #28a745;
    --source-bg: rgba(40, 167, 69, 0.1);
}

.review-card-enhanced[data-source="checkyeti"] {
    --source-color: #007bff;
    --source-bg: rgba(0, 123, 255, 0.1);
}

.review-card-enhanced[data-source="google"] {
    --source-color: #ea4335;
    --source-bg: rgba(234, 67, 53, 0.1);
}

.review-card-enhanced[data-source="custom"] {
    --source-color: #3068b3;
    --source-bg: rgba(48, 104, 179, 0.1);
}

.review-card-enhanced:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

/* Review header */
.review-header-enhanced {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.review-avatar-enhanced {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--source-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.review-avatar-enhanced img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder-enhanced {
    color: white;
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
}

.review-meta-enhanced {
    flex: 1;
}

.review-name-enhanced {
    font-size: 18px;
    font-weight: 700;
    color: #222;
    margin: 0 0 6px 0;
}

.review-rating-enhanced {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.stars-enhanced {
    color: #ffc107;
    font-size: 18px;
    letter-spacing: 2px;
    filter: drop-shadow(0 1px 3px rgba(255, 193, 7, 0.3));
}

.rating-number {
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.review-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #999;
}

.review-date-enhanced {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Source badge */
.review-source-enhanced {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: var(--source-bg);
    color: var(--source-color);
    border-radius: 12px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid var(--source-color);
}

/* Review content */
.review-content-enhanced {
    line-height: 1.7;
    color: #555;
    font-size: 15px;
}

.review-content-enhanced p {
    margin: 0;
}

/* Review images gallery */
.review-images-gallery {
    margin-top: 15px;
    display: grid;
    gap: 10px;
    max-width: 100%;
}

.review-images-gallery.single {
    grid-template-columns: 1fr;
    max-width: 300px;
}

.review-images-gallery.double {
    grid-template-columns: 1fr 1fr;
}

.review-images-gallery.triple {
    grid-template-columns: repeat(3, 1fr);
}

.review-images-gallery.quad {
    grid-template-columns: repeat(4, 1fr);
}

.review-image-thumb {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.review-image-thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.review-image-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.review-image-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* Hide reviews initially except first 5 */
.review-card-enhanced.hidden-review {
    display: none !important;
}

/* ========================================
   REVIEWS PAGINATION STYLES
   ======================================== */
.reviews-pagination-container {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(224, 224, 224, 0.3);
}

.load-more-reviews-btn {
    display: inline-block;
    padding: 15px 40px;
    background: linear-gradient(135deg, #3068b3, #4a7bc8);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(48, 104, 179, 0.3);
}

.load-more-reviews-btn:hover {
    background: linear-gradient(135deg, #4a7bc8, #5a8fd3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(48, 104, 179, 0.4);
}

.load-more-reviews-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.load-more-reviews-btn.loading {
    position: relative;
    color: transparent;
}

.load-more-reviews-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

.reviews-count-info {
    color: #666;
    font-size: 14px;
    margin-top: 15px;
    font-style: italic;
}

/* ========================================
   9. RESPONSIVE DESIGN - ENHANCED
   ======================================== */

/* DESKTOP FIRST - Enhanced */
@media (min-width: 769px) {
    .product-gallery {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        height: auto !important;
        width: 100% !important;
    }
    
    .product-gallery .gallery-thumbs {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: 1fr 1fr !important;
        gap: 3px !important;
        background: white !important;
        padding: 3px !important;
    }
}

/* MOBILE - Enhanced with FULL WIDTH IMAGE FIX */
@media (max-width: 768px) {
    .product-container {
        padding: 15px;
    }
    
    /* FIX PRINCIPALE PER IMMAGINE A LARGHEZZA PIENA */
    .product-gallery {
        display: block !important;
        height: 300px !important; /* Altezza fissa solo per la main image */
        grid-template-columns: none !important;
        grid-template-rows: none !important;
        margin-bottom: 20px !important;
        overflow: hidden !important; /* Nasconde qualsiasi overflow */
        border-radius: 16px !important; /* Angoli arrotondati */
        background: transparent !important; /* Rimuove sfondo */
    }
    
    .gallery-main {
        height: 100% !important; /* Usa tutta l'altezza del parent */
        width: 100% !important;
        border-radius: 16px !important;
        background: transparent !important; /* Rimuove sfondo grigio */
    }
    
    /* FIX PER IMMAGINE A LARGHEZZA PIENA SU MOBILE */
    .gallery-main .main-image,
    .gallery-main img#mainGalleryImage {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important; /* COVER invece di CONTAIN per riempire tutto */
        object-position: center center !important;
        background: transparent !important; /* Rimuove sfondo */
    }
    
    /* Rimuovi completamente le thumbnails */
    .product-gallery .gallery-thumbs,
    .product-gallery .gallery-thumb,
    .product-gallery .placeholder-thumb {
        display: none !important;
        visibility: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }
    
    /* Assicurati che nessun elemento vuoto crei spazio */
    .product-gallery::after,
    .product-gallery::before {
        display: none !important;
    }
    
    .product-header-section {
        padding: 30px 20px;
    }
    
    .product-title {
        font-size: 28px;
    }
    
    .product-subtitle {
        font-size: 16px;
    }
    
    .product-content {
        grid-template-columns: 1fr;
        padding: 20px;
        gap: 30px;
    }
    
    .product-main {
        padding-right: 0;
    }
    
    /* Timeline mobile */
    .timeline-item {
        gap: 20px !important;
        padding-bottom: 25px !important;
        margin-bottom: 35px !important;
        align-items: flex-start !important;
    }
    
    /* Sidebar mobile */
    .product-sidebar {
        position: static;
    }
    
    .booking-card {
        padding: 20px;
    }
    
    .booking-price-amount {
        font-size: 28px;
    }
    
    /* Enhanced reviews mobile */
    .reviews-section-enhanced {
        padding: 30px 20px;
    }
    
    .reviews-filters {
        flex-direction: column;
        padding: 10px;
        gap: 5px;
    }
    
    .filter-chip {
        width: 100%;
        justify-content: center;
    }
    
    .reviews-grid-enhanced {
        column-count: 1;
    }
    
    .reviews-title {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .product-title {
        font-size: 24px;
    }
    
    .section-title {
        font-size: 22px;
    }
    
    .reviews-section-enhanced {
        padding: 20px 15px;
        margin: 30px 0;
        border-radius: 15px;
    }
    
    .reviews-title {
        font-size: 24px;
    }
    
    .review-card-enhanced {
        padding: 20px;
    }
}

/* ========================================
   10. UTILITIES & ANIMATIONS - ENHANCED
   ======================================== */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced focus styles for accessibility */
button:focus,
a:focus {
    outline: 2px solid #3068b3;
    outline-offset: 2px;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.review-card-enhanced {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: backwards;
}

.review-card-enhanced:nth-child(even) {
    animation-delay: 0.1s;
}

.review-card-enhanced:nth-child(3n) {
    animation-delay: 0.2s;
}

/* Loading spinner for future use */
.reviews-loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3068b3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Print styles */
@media print {
    .product-sidebar,
    .booking-card,
    .scroll-to-booking,
    .reviews-filters {
        display: none;
    }
    
    .product-content {
        grid-template-columns: 1fr;
    }
    
    .reviews-grid-enhanced {
        column-count: 1;
    }
}

/* ========================================
   11. STYLES TRANSFERRED FROM MAIN.CSS
   ======================================== */

/* Override background for single tour pages */
body.single-tour {
    background: linear-gradient(135deg, #4a7bc8 0%, #5a8fd3 100%);
    min-height: 100vh;
}

/* Ensure container works with new layout */
body.single-tour .site-content {
    background: transparent;
    padding: 0;
}

body.single-tour .container {
    max-width: 100%;
    padding: 0;
}

/* Gallery integration - OVERRIDE MAIN.CSS */
body.single-tour .tour-gallery,
body.single-tour .product-gallery {
    background: transparent !important;
}

/* Override main.css gallery styles */
body.single-tour .gallery-main {
    position: relative !important;
    overflow: hidden !important;
    border-radius: 16px !important;
    background: #f5f5f5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

body.single-tour .gallery-main .main-image,
body.single-tour .gallery-main img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    background: #f5f5f5 !important;
}

/* Product wrapper specifics */
body.single-tour .product-wrapper {
    position: relative;
    z-index: 1;
}

/* Mobile optimizations for single tour */
@media (max-width: 768px) {
    body.single-tour .site-header {
        position: fixed;
        top: 0;
        width: 100%;
    }
    
    body.single-tour .product-container {
        margin-top: 60px;
    }
    
    /* IMMAGINE FULL WIDTH SU MOBILE */
    body.single-tour .product-gallery {
        border-radius: 16px !important; /* Mantieni angoli arrotondati */
        background: transparent !important;
        padding: 0 !important;
        margin: 0 15px 20px 15px !important; /* Margini laterali per arrotondamento */
    }
    
    /* Override per immagini full width */
    body.single-tour .gallery-main,
    body.single-tour .gallery-main .main-image,
    body.single-tour .gallery-main img,
    body.single-tour #mainGalleryImage {
        object-fit: cover !important; /* COVER per riempire */
        background: transparent !important;
    }
    
    body.single-tour .product-wrapper {
        border-radius: 0;
    }
}

/* Bokun widget integration */
body.single-tour .bokun-widget-container {
    width: 100%;
    position: relative;
    z-index: 1;
}

body.single-tour .bokun-widget-container iframe {
    width: 100% !important;
    border: none;
}

/* Timeline styling compatibility */
body.single-tour .timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 19px;
    top: 45px;
    width: 2px;
    height: calc(100% + 35px);
    background: rgba(224, 224, 224, 0.5);
    z-index: 1;
}

/* Print styles for single tour */
@media print {
    body.single-tour .product-sidebar,
    body.single-tour .back-button,
    body.single-tour .bokun-widget-container {
        display: none !important;
    }
    
    body.single-tour .product-content {
        grid-template-columns: 1fr !important;
    }
    
    body.single-tour .product-gallery {
        page-break-after: always;
    }
}

/* ========================================
   12. ADDITIONAL COMPATIBILITY FIXES
   ======================================== */

/* Ensure no conflicts with main.css gallery styles */
body.single-tour .product-gallery .gallery-thumbs {
    width: auto !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: 1fr 1fr !important;
    gap: 3px !important;
}

/* Force aspect ratio on single tour pages */
body.single-tour .product-gallery .gallery-thumb {
    aspect-ratio: 1 / 1 !important;
}

/* Ensure main image is properly sized */
body.single-tour .product-gallery .gallery-main {
    position: relative !important;
    overflow: hidden !important;
}

/* Override any theme conflicts */
.product-gallery .gallery-thumb,
.product-gallery .gallery-thumb img {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

/* CRITICAL FIX FOR IMAGE FULL WIDTH ON MOBILE - MAXIMUM PRIORITY */
.product-gallery .gallery-main,
#tibGalleryRoot .gallery-main {
    background: #f5f5f5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Desktop - mantieni contain */
@media (min-width: 769px) {
    .product-gallery .gallery-main img,
    .product-gallery .gallery-main .main-image,
    .product-gallery .gallery-main img#mainGalleryImage,
    #tibGalleryRoot .gallery-main img,
    #mainGalleryImage {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
        object-position: center center !important;
        background: #f5f5f5 !important;
    }
}

/* Mobile - usa cover per riempire tutto */
@media (max-width: 768px) {
    .product-gallery .gallery-main,
    #tibGalleryRoot .gallery-main {
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .product-gallery .gallery-main img,
    .product-gallery .gallery-main .main-image,
    .product-gallery .gallery-main img#mainGalleryImage,
    #tibGalleryRoot .gallery-main img,
    #mainGalleryImage {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: cover !important; /* COVER su mobile */
        object-position: center center !important;
        background: transparent !important;
        border-radius: 16px !important; /* Angoli arrotondati */
    }
    
    /* Rimuovi padding dal container su mobile */
    body.single-tour .product-container {
        padding: 0 !important;
    }
    
    /* Gallery a larghezza piena con margini minimi */
    body.single-tour .product-gallery,
    .product-gallery {
        margin: 0 0 20px 0 !important;
        padding: 0 !important;
        border-radius: 0 0 16px 16px !important; /* Arrotonda solo in basso */
        width: 100% !important;
    }
}

/* Override any background: transparent from other CSS - Desktop only */
@media (min-width: 769px) {
    .product-gallery,
    #tibGalleryRoot,
    .tour-gallery {
        background: #f5f5f5 !important;
    }
}

/* Ensure gallery main has the correct dimensions */
.product-gallery .gallery-main {
    flex: 1 !important;
    height: 100% !important;
    min-height: 0 !important;
}

/* Force contain on all states */
.product-gallery img[id="mainGalleryImage"],
div.gallery-main > img {
    object-fit: contain !important;
}

/* Accessibility improvements */
.gallery-thumb[role="button"] {
    cursor: pointer;
}

.gallery-thumb:focus-visible {
    outline: 2px solid #f79448 !important;
    outline-offset: 2px !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-gallery .gallery-thumb.placeholder-thumb {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gallery-thumb,
    .gallery-main img,
    .review-card-enhanced {
        transition: none !important;
        animation: none !important;
    }
}

/* ============================================================================
   EXTERNAL REVIEWS WIDGET STYLES
   ============================================================================ */

.external-reviews-widget {
    padding: 40px 0;
}

.external-reviews-widget .reviews-title {
    font-size: 32px;
    font-weight: 800;
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    margin-top: 0;
}

.external-reviews-widget .widget-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.external-reviews-widget .widget-container iframe {
    width: 100%;
    border: none;
    min-height: 400px;
}

@media (max-width: 768px) {
    .external-reviews-widget {
        padding: 30px 0;
    }
    
    .external-reviews-widget .reviews-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .external-reviews-widget .widget-container {
        padding: 15px;
    }
}
