/* Gallery Styles */

.gallery-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.gallery-wrapper {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    gap: 20px;
    padding: 10px 0;
}

.gallery-wrapper::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.gallery-wrapper.grabbing {
    cursor: grabbing;
    cursor: -webkit-grabbing;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    height: 300px;
    width: auto;
    border-radius: 8px;
    overflow: hidden;
}

.gallery-item img,
.gallery-wrapper img {
    max-height: 300px !important;
    height: auto !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
    filter: brightness(1);
    cursor: pointer;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 0;
}

.gallery-pagination-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    background-color: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.gallery-pagination-dot:hover {
    background-color: rgba(0, 0, 0, 0.4);
    transform: scale(1.2);
}

.gallery-pagination-dot.active {
    background-color: rgba(0, 0, 0, 0.6);
    transform: scale(1.3);
}

/* Modal Styles */
.gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.gallery-modal.active {
    display: flex;
    opacity: 1;
    animation: fadeIn 0.3s ease forwards;
}

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

.gallery-modal-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: contentSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes contentSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.gallery-modal-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    pointer-events: none;
    transition: overflow 0.3s ease;
    /* Container stays fixed - never moves */
    transform: none !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.gallery-modal-image-container .gallery-modal-image {
    pointer-events: auto;
}

.gallery-zoom-wrapper {
    display: inline-block;
    position: relative;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
}

.gallery-zoom-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 10002;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@keyframes fadeInLoader {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.gallery-zoom-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.gallery-zoom-loader-text {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

.gallery-zoom-status {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    z-index: 10003;
    pointer-events: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.gallery-zoom-status.initializing {
    background: rgba(255, 165, 0, 0.8);
    color: #fff;
}

.gallery-zoom-status.ready {
    background: rgba(76, 175, 80, 0.8);
    color: #fff;
}

/* Position relative to image container */
.gallery-modal-image-container {
    position: relative;
}

.gallery-zoom-wrapper {
    position: relative;
}

.gallery-modal-image {
    max-width: 100%;
    max-height: 480px;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity 0.3s ease, filter 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform-origin 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: 50% 50%;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
    animation: imageFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
    display: block;
    margin: auto;
    cursor: zoom-in;
}

.gallery-modal-image.maximized {
    cursor: grab !important;
    position: relative;
}

.gallery-modal-image.maximized:active {
    cursor: grabbing !important;
}

.gallery-modal.active .gallery-modal-image {
    opacity: 1;
}

.gallery-modal-image.loading {
    opacity: 0.5;
    filter: blur(5px);
}

.gallery-modal-image.loaded {
    opacity: 1;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
}

.gallery-modal-image.changing {
    opacity: 0.7;
}

@keyframes imageFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 32px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

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

.gallery-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 36px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.gallery-modal-prev {
    left: 20px;
}

.gallery-modal-next {
    right: 20px;
}

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

.gallery-modal-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    z-index: 10001;
    backdrop-filter: blur(10px);
}

.gallery-zoom-controls {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 30px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 10001;
    pointer-events: auto;
}

.gallery-zoom-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.gallery-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

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

.gallery-zoom-reset {
    font-size: 14px;
    width: 40px;
    height: 36px;
    border-radius: 18px;
}

.gallery-zoom-level {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
    padding: 0 4px;
}

.gallery-zoom-state-indicator {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 10001;
    pointer-events: none;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    transition: all 0.3s ease;
}

.gallery-zoom-state-indicator .zoom-state-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gallery-zoom-state-indicator .zoom-state-hint {
    font-size: 11px;
    opacity: 0.7;
    font-weight: 400;
    margin-top: 2px;
    text-align: center;
    line-height: 1.3;
}

.gallery-zoom-state-indicator .zoom-state-label {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.gallery-zoom-state-indicator .zoom-state-label.original {
    background: rgba(76, 175, 80, 0.3);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.5);
}

.gallery-zoom-state-indicator .zoom-state-label.zoomed {
    background: rgba(33, 150, 243, 0.3);
    color: #64b5f6;
    border: 1px solid rgba(33, 150, 243, 0.5);
}

.gallery-zoom-state-indicator .zoom-state-percent {
    color: #fff;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .gallery-modal-nav {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
    
    .gallery-modal-prev {
        left: 10px;
    }
    
    .gallery-modal-next {
        right: 10px;
    }
    
    .gallery-modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 28px;
    }
    
    .gallery-modal-counter {
        bottom: 10px;
        font-size: 12px;
        padding: 8px 16px;
    }
    
    .gallery-zoom-controls {
        top: 10px;
        padding: 6px 10px;
        gap: 6px;
    }
    
    .gallery-zoom-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .gallery-zoom-reset {
        width: 36px;
        height: 32px;
        font-size: 12px;
    }
    
    .gallery-zoom-level {
        font-size: 12px;
        min-width: 40px;
    }
    
    .gallery-zoom-state-indicator {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 12px;
        gap: 6px;
    }
    
    .gallery-zoom-state-indicator .zoom-state-label {
        padding: 2px 6px;
        font-size: 11px;
    }
    
    .gallery-zoom-state-indicator .zoom-state-percent {
        font-size: 11px;
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    .gallery-modal-nav {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .gallery-modal-prev {
        left: 5px;
    }
    
    .gallery-modal-next {
        right: 5px;
    }
    
    .gallery-modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
    
    .gallery-modal-counter {
        bottom: 10px;
        left: 10px;
        transform: none;
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .gallery-zoom-controls {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        padding: 5px 8px;
        gap: 4px;
    }
    
    .gallery-zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .gallery-zoom-reset {
        width: 32px;
        height: 28px;
        font-size: 11px;
    }
    
    .gallery-zoom-level {
        font-size: 11px;
        min-width: 35px;
    }
    
    .gallery-zoom-state-indicator {
        top: 10px;
        left: 10px;
        padding: 5px 10px;
        font-size: 11px;
        gap: 5px;
    }
    
    .gallery-zoom-state-indicator .zoom-state-label {
        padding: 1px 5px;
        font-size: 10px;
    }
    
    .gallery-zoom-state-indicator .zoom-state-percent {
        font-size: 10px;
        min-width: 30px;
    }
}

