/* 
 * 2025 Instagram-Style Gallery CSS
 * 4:5 portrait ratio (1080x1350) - Current Instagram standard
 * Optimized for performance with thousands of images
 */

/* Base style */
body {
    padding-top: 170px;
    /* space for sticky navbar */
}

/* Adjust spacing for top elements */
.containers {
    margin-top: 2rem;
}

/* 
 * 2025 Instagram Standard: 4:5 aspect ratio (1080x1350 pixels)
 * This is the preferred format for Instagram posts in 2025
 * as it takes up more screen real estate and gets better engagement
 */

/* Gallery Section Headings */
h1 {
    font-size: 2rem;
    font-weight: bold;
    color: #060606;
    margin-bottom: 2rem;
    text-align: center;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 0.75rem;
    color: #222;
    padding-left: 10px;
    font-weight: bold;
}

/* Preview section wrapper */
.preview-section {
    margin-bottom: 2rem;
}

/* Horizontal image row with scroll - INSTAGRAM STYLE */
.preview-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 0.75rem;
    /* Instagram-like spacing */
    padding-bottom: 0.5rem;

    /* Performance optimizations */
    will-change: scroll-position;
    contain: layout style paint;

    /* Hide scrollbars */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
}

.preview-container::-webkit-scrollbar {
    display: none;
    /* Safari and Chrome */
}

/* Each preview wrapper - 2025 INSTAGRAM STYLE (4:5 PORTRAIT) */
.preview-wrapper {
    flex: 0 0 23%;
    scroll-snap-align: start;
    border-radius: 12px;
    /* Instagram-style rounded */
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    aspect-ratio: 4/5;
    /* 2025 Instagram portrait format */
    position: relative;

    /* Performance optimizations */
    will-change: transform;
    contain: layout style paint;
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Image elements - OPTIMIZED */
.preview-wrapper img,
.gallery-image-wrapper img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
    object-fit: cover;
    object-position: center 30%;

    /* Performance optimizations */
    will-change: transform;
    backface-visibility: hidden;
    /* Force GPU acceleration */
    transition: all 300ms;
}

/* Hover effects - INSTAGRAM STYLE */
.preview-wrapper:hover img,
.gallery-image-wrapper:hover img {
    transform: scale(1.05);
    /* Subtle Instagram-like zoom */
    z-index: 10;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Instagram-style overlay effect */
.preview-wrapper::after,
.gallery-image-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0, 0, 0, 0.02), rgba(255, 255, 255, 0.02));
    opacity: 0;
    transition: opacity 150ms ease-out;
    pointer-events: none;
    will-change: opacity;
    border-radius: 12px;
}

.preview-wrapper:hover::after,
.gallery-image-wrapper:hover::after {
    opacity: 1;
}

/* Controls bar at top right */
.controls-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

/* Button Styles - OPTIMIZED */
.btn-primary-custom {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    border: 2px solid rgb(231, 118, 52);
    background-color: rgb(231, 118, 52);
    font-weight: 600;
    color: rgb(255, 254, 254);
    cursor: pointer;
    transition: background-color 200ms ease-out, border-color 200ms ease-out, transform 200ms ease-out;
    text-decoration: none;
    will-change: transform;
    backface-visibility: hidden;
}

.btn-primary-custom:hover {
    border-color: rgb(200, 90, 30);
    transform: translate3d(0, 0, 0) scale(1.05);
}

/* See More button specific sizing */
.see-more-btn {
    width: 100px;
    height: 40px;
    font-size: 0.9rem;
}

/* Swipe hint styling */
.swipe-hint {
    font-size: 0.85rem;
    color: #555;
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    border-radius: 12px;
    pointer-events: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

/* Fixed back button */
.fixed-back-btn {
    position: fixed;
    top: 200px;
    /* Below navbar */
    left: 20px;
    z-index: 1050;
}

.fixed-back-btn a {
    width: 100px;
    height: 40px;
    font-size: 0.9rem;
}

/* Gallery grid view styles - 2025 INSTAGRAM STYLE (4:5 PORTRAIT) */
.gallery-image-wrapper {
    aspect-ratio: 4/5;
    /* 2025 Instagram standard (1080x1350) */
    overflow: hidden;
    border-radius: 12px;
    /* Instagram-style rounded corners */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    margin-bottom: 1rem;
    position: relative;
    cursor: pointer;

    /* Performance optimizations */
    will-change: transform;
    contain: layout style paint;
    backface-visibility: hidden;
}

/* Modal styles */
.modal-body img {
    width: 100%;
    height: auto;
    max-height: 80vh;
    border-radius: 6px;
    object-fit: contain;
}

/* Loading transition overlay */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-transition-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Enhanced destination headers - INSTAGRAM STYLE */
.destination-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    /* More spacing like Instagram */
    padding: 1.25rem;
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
    border-radius: 16px;
    /* More rounded like Instagram */
    border-left: 4px solid #f8c146;
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
    will-change: transform;
    contain: layout style paint;
}

.destination-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c3e50;
}

.tour-type-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.destination-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: #6c757d;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.tour-type-badge {
    background: #f8c146;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Updated badge colors */
.tour-type-badge.luzon {
    background: #3498db;
}

.tour-type-badge.joiners {
    background: #e74c3c;
}

.tour-type-badge.domestic {
    background: #2ecc71;
}

.tour-type-badge.private {
    background: #9b59b6;
}

.tour-type-badge.exclusive {
    background: #f39c12;
}

/* Loading spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(231, 118, 52, 0.3);
    border-radius: 50%;
    border-top-color: rgb(231, 118, 52);
    animation: spin 1s ease-in-out infinite;
}

/* Destination text below spinner */
.loading-destination {
    position: absolute;
    margin-top: 80px;
    font-size: 1.2rem;
    font-weight: bold;
    color: rgb(231, 118, 52);
}

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

/* PERFORMANCE: Instagram-style optimizations for mobile */
@media (prefers-reduced-motion: reduce) {

    .preview-wrapper,
    .gallery-image-wrapper,
    .btn-primary-custom,
    .destination-header {
        transition: none;
    }

    .preview-wrapper:hover,
    .gallery-image-wrapper:hover {
        transform: none;
    }

    img[loading="lazy"] {
        animation: none;
        background: #f5f5f5;
    }
}

/* Responsive adjustments - 2025 INSTAGRAM STYLE */
@media (max-width: 992px) {
    .preview-wrapper {
        flex: 0 0 32%;
        /* 3 per row on tablet */
    }
}

@media (max-width: 768px) {
    .preview-wrapper {
        flex: 0 0 48%;
        /* 2 per row on mobile - perfect for 4:5 */
    }

    .gallery-image-wrapper {
        aspect-ratio: 4/5;
        /* Keep 2025 Instagram ratio on mobile */
    }

    .see-more-btn {
        width: 90px;
        height: 36px;
        font-size: 0.8rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.1rem;
        font-weight: bold;
    }

    body {
        padding-top: 140px;
    }

    .destination-header {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .destination-info {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Disable heavy effects on mobile */
    .preview-wrapper:hover,
    .gallery-image-wrapper:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    }
}

@media (max-width: 576px) {
    .preview-wrapper {
        flex: 0 0 48%;
        /* Keep 2 per row - works great with 4:5 ratio */
    }

    .see-more-btn {
        width: 80px;
    }

    .controls-bar {
        margin-bottom: 6px;
    }

    /* Further disable effects on small screens */
    .preview-wrapper,
    .gallery-image-wrapper {
        transition: none;
    }

    /* Maintain 2025 Instagram ratio on all screen sizes */
    .gallery-image-wrapper {
        aspect-ratio: 4/5;
        border-radius: 8px;
        /* Slightly less rounded on small screens */
    }

    .preview-wrapper {
        border-radius: 8px;
    }
}