/* Image label styling - desktop only */
.image-label {
    position: absolute;
    z-index: 10;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    max-width: 80%;
    pointer-events: none;
    /* Only show on desktop devices by default */
    display: none;
}

/* Apply display block only on desktop devices */
@media (min-width: 769px) {
    .image-label {
        display: block;
    }
}

/* When in zoomed mode, hide the label as well */
body.zoomed-mode .image-label {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Special class for when an image is zoomed */
body.zoomed-mode .navigation,
body.zoomed-mode .nav-dot,
body.zoomed-mode .click-area,
body.zoomed-mode .prev-btn,
body.zoomed-mode .next-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Add a zoom indicator for mobile */
.zoom-indicator {
    position: absolute;
    bottom: 50px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
}

/* Full size image button */
.fullsize-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.fullsize-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Hide full size button on mobile */
@media (max-width: 768px) {
    .fullsize-btn {
        display: none;
    }
}

/* When in zoomed mode, hide the fullsize button as well */
body.zoomed-mode .fullsize-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Slideshow styles */

/* Slideshow container */
.slideshow-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    background-color: #000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    aspect-ratio: 4/3;
    overflow: hidden;
    margin: 20px auto;
    /* Important for touch handling */
    touch-action: pan-y pinch-zoom;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Slides container */
#slides-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    /* Important for touch handling */
    touch-action: none;
}

/* Individual slide */
.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Active slide */
.slide.active {
    opacity: 1;
    z-index: 2;
}

/* Zoomed slide */
.slide.zoomed {
    z-index: 5; /* Higher z-index when zoomed */
}

/* Slide image */
.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* For smoother zooming */
    transition: transform 0.2s ease;
    transform-origin: center center;
}

/* Override transition for panning to make it immediate */
.slide.zoomed img {
    transition: none;
}

/* Reset transition for zoom out */
.slide.zoomed.zooming-out img {
    transition: transform 0.2s ease;
}

/* Navigation dots */
.navigation {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Navigation dot */
.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    margin: 0 5px;
    cursor: pointer;
}

/* Active dot */
.nav-dot.active {
    background-color: white;
}

/* Navigation buttons */
.prev-btn, .next-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 18px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

/* Click areas for wider clickable regions */
.click-area {
    position: absolute;
    height: 100%;
    width: 40%;
    top: 0;
    z-index: 5;
    cursor: pointer;
}

.click-area.left {
    left: 0;
}

.click-area.right {
    right: 0;
}

/* Status text */
.status {
    padding: 10px;
    text-align: center;
    color: white;
    z-index: 10;
    font-size: 14px;
    position: absolute;
    bottom: 0;
    width: 100%;
}

/* Error message styling */
.error-message {
    color: white;
    text-align: center;
    padding: 20px;
    background-color: rgba(255, 0, 0, 0.5);
    border-radius: 5px;
    margin: 20px;
}

/* For mobile devices - AGGRESSIVE NO BLACK BARS VERSION */
@media (max-width: 768px) {
    .slideshow-container {
        /* Take up full width but with margin for centering */
        width: 95%;
        max-width: 95%;
        /* Calculate height dynamically - critical change */
        height: calc(100vw * 0.75); /* 4:3 aspect ratio */
        /* Center the slideshow */
        margin: 0 auto;
        /* Ensure proper display */
        background-color: #000;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
        /* Ensure proper overflow behavior */
        overflow: hidden;
        position: relative;
    }
    
    /* For portrait orientation, limit the height */
    @media (orientation: portrait) {
        .slideshow-container {
            /* Max height in portrait mode */
            max-height: 70vh;
            /* Ensure it does not exceed viewport */
            height: auto;
            aspect-ratio: auto;
            /* Explicitly center */
            margin-left: auto;
            margin-right: auto;
        }
    }
    
    /* For landscape orientation */
    @media (orientation: landscape) {
        .slideshow-container {
            /* Max height in landscape to eliminate bars */
            height: calc(100vh - 60px);
            width: 90%;
            max-width: 90%;
            /* Ensure proper background */
            background-color: black;
            /* Explicitly center */
            margin-left: auto;
            margin-right: auto;
        }
    }
    
    /* Make slides fill the container */
    .slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        /* Ensure images fit perfectly */
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #000;
    }
    
    /* Radically change the image display strategy */
    .slide img {
        /* Contain ensures no cropping */
        object-fit: contain;
        /* Use natural dimensions */
        width: 100%;
        height: 100%;
        /* Maximum dimensions */
        max-width: 100%;
        max-height: 100%;
    }
    
    /* Smaller navigation controls for mobile */
    .prev-btn, .next-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
        background-color: rgba(0, 0, 0, 0.7);
    }
    
    /* Status bar with solid background */
    .status {
        font-size: 12px;
        background-color: rgba(0, 0, 0, 0.7);
        padding: 5px 0;
    }
    
    /* Navigation dots adjustment */
    .navigation {
        bottom: 40px;
    }
    
    .nav-dot {
        width: 8px;
        height: 8px;
        margin: 0 4px;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none;
    }
    
    /* Position image labels higher on mobile */
    .image-label {
        /* Hide on mobile entirely */
        display: none;
    }
    
    /* Zoom indicator styling */
    .slide:not(.zoomed) .zoom-indicator {
        content: "Pinch to zoom"; 
        opacity: 0.7;
        animation: fadeOut 3s forwards;
        animation-delay: 2s;
    }
    
    .slide.zoomed .zoom-indicator {
        content: "Drag to pan";
        opacity: 0.7;
        animation: fadeOut 3s forwards;
        animation-delay: 2s;
    }
}

@keyframes fadeOut {
    from { opacity: 0.7; }
    to { opacity: 0; }
}