/**
 * Simple Gallery Modal CSS
 * Clean, transparent design with zoom functionality
 */

/* Gallery Modal Overlay */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: grab;
    overflow: hidden;
}

.gallery-modal.active {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Main Image */
.gallery-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: none;
    max-height: none;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.2s ease, opacity 0.3s ease;
    user-select: none;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    display: block !important;
    visibility: visible !important;
    opacity: 1;
    z-index: 1;
    cursor: grab;
    transform-origin: center center;
}

.gallery-modal.zoomed {
    cursor: move;
}

.gallery-modal.zoomed .gallery-image {
    cursor: move;
}

.gallery-image.dragging {
    cursor: grabbing !important;
    transition: none !important;
}

.gallery-image:hover {
    cursor: grab;
}

.gallery-image.zoomed {
    cursor: move;
}

.gallery-image.zoomed:hover {
    cursor: move;
}

/* Navigation Buttons */
.gallery-nav {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10001;
}

.gallery-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

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

.gallery-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gallery-prev {
    left: 30px;
}

.gallery-next {
    right: 30px;
}

/* Download Button */
.gallery-download {
    position: fixed;
    top: 30px;
    right: 90px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10001;
}

.gallery-download:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
    transform: scale(1.1);
}

.gallery-download:active {
    transform: scale(0.95);
}

/* Close Button */
.gallery-close {
    position: fixed;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10001;
}

.gallery-close:hover {
    background: rgba(255, 88, 88, 0.2);
    border-color: rgba(255, 88, 88, 0.4);
    transform: scale(1.1);
}

.gallery-close:active {
    transform: scale(0.95);
}

/* Zoom Controls - Hidden */
.gallery-zoom-controls {
    display: none !important;
}

.gallery-zoom {
    display: none !important;
}

/* Image Counter */
.gallery-counter {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10001;
}

/* Image Title */
.gallery-title {
    position: fixed;
    top: 30px;
    left: 30px;
    right: 100px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10001;
    max-width: calc(100% - 130px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .gallery-image {
        /* No size constraints */
    }
    
    .gallery-nav {
        width: 50px;
        height: 50px;
    }
    
    .gallery-prev {
        left: 15px;
    }
    
    .gallery-next {
        right: 15px;
    }
    
    .gallery-download {
        top: 15px;
        right: 70px;
        width: 45px;
        height: 45px;
    }
    
    .gallery-close {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    .gallery-counter {
        bottom: 15px;
        left: 15px;
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .gallery-title {
        top: 15px;
        left: 15px;
        right: 125px;
        font-size: 14px;
        padding: 10px 16px;
        max-width: calc(100% - 140px);
    }
}

@media (max-width: 480px) {
    .gallery-image {
        /* No size constraints */
    }
    
    .gallery-nav {
        width: 45px;
        height: 45px;
    }
    
    .gallery-prev {
        left: 10px;
    }
    
    .gallery-next {
        right: 10px;
    }
    
    .gallery-download {
        top: 10px;
        right: 60px;
        width: 40px;
        height: 40px;
    }
    
    .gallery-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }
    
    .gallery-counter {
        bottom: 10px;
        left: 10px;
        font-size: 11px;
        padding: 5px 10px;
    }
    
    .gallery-title {
        top: 10px;
        left: 10px;
        right: 110px;
        font-size: 13px;
        padding: 8px 14px;
        max-width: calc(100% - 120px);
    }
}

/* Loading State */
.gallery-modal.loading .gallery-image {
    opacity: 0.5;
}

.gallery-modal.loading::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10002;
}

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

/* Zoom Animation */
.gallery-image.zoom-in {
    animation: zoomIn 0.3s ease;
}

.gallery-image.zoom-out {
    animation: zoomOut 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(var(--zoom-scale, 1.5));
    }
}

@keyframes zoomOut {
    from {
        transform: scale(var(--zoom-scale, 1.5));
    }
    to {
        transform: scale(1);
    }
}

/* Smooth Transitions */
.gallery-modal * {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Focus States for Accessibility */
.gallery-nav:focus,
.gallery-download:focus,
.gallery-close:focus,
.gallery-zoom:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Ensure buttons are clickable */
.gallery-nav,
.gallery-download,
.gallery-close,
.gallery-zoom {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: fixed !important;
}

/* Make sure all buttons are above the image */
.gallery-nav,
.gallery-download,
.gallery-close,
.gallery-zoom,
.gallery-counter,
.gallery-title {
    z-index: 10002 !important;
}

/* Hide controls when image is being dragged */
.gallery-modal.dragging .gallery-nav,
.gallery-modal.dragging .gallery-download,
.gallery-modal.dragging .gallery-close,
.gallery-modal.dragging .gallery-zoom-controls,
.gallery-modal.dragging .gallery-counter,
.gallery-modal.dragging .gallery-title {
    opacity: 0.3;
    pointer-events: none;
}

/* Double-click zoom hint */
.gallery-image::after {
    content: 'Двічі натисніть для збільшення';
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

.gallery-modal:hover .gallery-image::after {
    opacity: 1;
}

/* Responsive Design for Large Screens */

/* FHD (Full HD) - 1920x1080 and above */
@media (min-width: 1920px) {
    .gallery-image {
        /* No size constraints */
    }
    
    .gallery-nav {
        width: 70px;
        height: 70px;
        background: rgba(0, 0, 0, 0.8);
        border: 3px solid rgba(255, 255, 255, 0.4);
    }
    
    .gallery-nav svg {
        width: 28px;
        height: 28px;
    }
    
    .gallery-nav:hover {
        background: rgba(0, 0, 0, 0.95);
        border-color: rgba(255, 255, 255, 0.6);
        transform: translateY(-50%) scale(1.15);
    }
    
    .gallery-prev {
        left: 2rem;
    }
    
    .gallery-next {
        right: 2rem;
    }
    
    .gallery-download {
        top: 2rem;
        right: 6rem;
        width: 55px;
        height: 55px;
        background: rgba(0, 0, 0, 0.8);
        border: 3px solid rgba(255, 255, 255, 0.4);
    }
    
    .gallery-download svg {
        width: 26px;
        height: 26px;
    }
    
    .gallery-download:hover {
        background: rgba(0, 0, 0, 0.95);
        border-color: rgba(255, 255, 255, 0.6);
        transform: scale(1.1);
    }
    
    .gallery-close {
        top: 2rem;
        right: 2rem;
        width: 55px;
        height: 55px;
        background: rgba(0, 0, 0, 0.8);
        border: 3px solid rgba(255, 255, 255, 0.4);
    }
    
    .gallery-close svg {
        width: 26px;
        height: 26px;
    }
    
    .gallery-close:hover {
        background: rgba(0, 0, 0, 0.95);
        border-color: rgba(255, 255, 255, 0.6);
        transform: scale(1.1);
    }
    
    .gallery-counter {
        bottom: 2rem;
        left: 2rem;
        padding: 12px 20px;
        font-size: 16px;
        background: rgba(0, 0, 0, 0.7);
        border: 2px solid rgba(255, 255, 255, 0.2);
        border-radius: 25px;
    }
    
    .gallery-title {
        top: 2rem;
        left: 2rem;
        right: 180px;
        padding: 16px 24px;
        font-size: 18px;
        background: rgba(0, 0, 0, 0.7);
        border: 2px solid rgba(255, 255, 255, 0.2);
        border-radius: 28px;
        max-width: calc(100% - 200px);
    }
}

/* QHD (Quad HD) - 2560x1440 and above */
@media (min-width: 2560px) {
    .gallery-image {
        border-radius: 12px;
        box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
    }
    
    .gallery-nav {
        width: 80px;
        height: 80px;
        background: rgba(0, 0, 0, 0.85);
        border: 4px solid rgba(255, 255, 255, 0.5);
        border-radius: 50%;
        backdrop-filter: blur(15px);
    }
    
    .gallery-nav svg {
        width: 32px;
        height: 32px;
    }
    
    .gallery-nav:hover {
        background: rgba(0, 0, 0, 0.95);
        border-color: rgba(255, 255, 255, 0.7);
        transform: translateY(-50%) scale(1.2);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    }
    
    .gallery-prev {
        left: 3rem;
    }
    
    .gallery-next {
        right: 3rem;
    }
    
    .gallery-download {
        top: 3rem;
        right: 8rem;
        width: 65px;
        height: 65px;
        background: rgba(0, 0, 0, 0.85);
        border: 4px solid rgba(255, 255, 255, 0.5);
        border-radius: 50%;
        backdrop-filter: blur(15px);
    }
    
    .gallery-download svg {
        width: 30px;
        height: 30px;
    }
    
    .gallery-download:hover {
        background: rgba(0, 0, 0, 0.95);
        border-color: rgba(255, 255, 255, 0.7);
        transform: scale(1.15);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    }
    
    .gallery-close {
        top: 3rem;
        right: 3rem;
        width: 65px;
        height: 65px;
        background: rgba(0, 0, 0, 0.85);
        border: 4px solid rgba(255, 255, 255, 0.5);
        border-radius: 50%;
        backdrop-filter: blur(15px);
    }
    
    .gallery-close svg {
        width: 30px;
        height: 30px;
    }
    
    .gallery-close:hover {
        background: rgba(0, 0, 0, 0.95);
        border-color: rgba(255, 255, 255, 0.7);
        transform: scale(1.15);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    }
    
    .gallery-counter {
        bottom: 3rem;
        left: 3rem;
        padding: 16px 28px;
        font-size: 18px;
        background: rgba(0, 0, 0, 0.8);
        border: 3px solid rgba(255, 255, 255, 0.3);
        border-radius: 30px;
        backdrop-filter: blur(15px);
        font-weight: 600;
    }
    
    .gallery-title {
        top: 3rem;
        left: 3rem;
        right: 230px;
        padding: 20px 32px;
        font-size: 20px;
        background: rgba(0, 0, 0, 0.8);
        border: 3px solid rgba(255, 255, 255, 0.3);
        border-radius: 35px;
        backdrop-filter: blur(15px);
        max-width: calc(100% - 250px);
        font-weight: 600;
    }
    
    .gallery-modal.loading::after {
        width: 60px;
        height: 60px;
        border-width: 5px;
    }
} 