/* Global Photo Viewer Styles */

.photo-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-viewer-overlay.active {
    opacity: 1;
    visibility: visible;
}

.photo-viewer-container {
    position: relative;
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    max-height: 800px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.photo-viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    position: relative;
    z-index: 10;
}

.photo-viewer-counter {
    font-size: 16px;
    font-weight: 500;
}

.photo-viewer-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.photo-viewer-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.photo-viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.photo-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 5;
}

.photo-viewer-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-50%) scale(1.1);
}

.photo-viewer-prev {
    left: 20px;
}

.photo-viewer-next {
    right: 20px;
}

.photo-viewer-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#photo-viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
    cursor: grab;
    user-select: none;
}

#photo-viewer-image:active {
    cursor: grabbing;
}

.photo-viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    color: white;
}

.loading-spinner {
    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;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.photo-viewer-footer {
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.photo-viewer-controls {
    display: flex;
    gap: 10px;
}

.photo-viewer-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.photo-viewer-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.photo-viewer-btn:active {
    transform: scale(0.95);
}

/* Responsive Design */
@media (max-width: 768px) {
    .photo-viewer-container {
        width: 95vw;
        height: 95vh;
        border-radius: 0;
    }

    .photo-viewer-header {
        padding: 15px;
    }

    .photo-viewer-nav {
        width: 40px;
        height: 40px;
    }

    .photo-viewer-prev {
        left: 10px;
    }

    .photo-viewer-next {
        right: 10px;
    }

    .photo-viewer-footer {
        padding: 15px;
    }

    .photo-viewer-controls {
        gap: 8px;
    }

    .photo-viewer-btn {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .photo-viewer-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .photo-viewer-header {
        padding: 10px 15px;
    }

    .photo-viewer-counter {
        font-size: 14px;
    }

    .photo-viewer-nav {
        width: 35px;
        height: 35px;
    }

    .photo-viewer-prev {
        left: 5px;
    }

    .photo-viewer-next {
        right: 5px;
    }

    .photo-viewer-footer {
        padding: 10px 15px;
    }

    .photo-viewer-btn {
        width: 32px;
        height: 32px;
    }
}

/* Fullscreen Styles */
.photo-viewer-overlay:fullscreen {
    background: #000;
}

.photo-viewer-overlay:fullscreen .photo-viewer-container {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
}

/* Hide navigation on very small screens when zoomed */
@media (max-width: 480px) {
    .photo-viewer-nav {
        display: none;
    }
}

/* Loading animation for image */
#photo-viewer-image {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Disable text selection */
.photo-viewer-overlay * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Smooth transitions */
.photo-viewer-overlay *,
.photo-viewer-overlay *::before,
.photo-viewer-overlay *::after {
    transition: all 0.2s ease;
}

/* Focus styles for accessibility */
.photo-viewer-btn:focus,
.photo-viewer-close:focus,
.photo-viewer-nav:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .photo-viewer-overlay {
        background: #000;
    }

    .photo-viewer-btn {
        border: 2px solid #fff;
    }

    .photo-viewer-nav {
        background: #000;
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .photo-viewer-overlay,
    #photo-viewer-image,
    .photo-viewer-btn,
    .photo-viewer-nav,
    .photo-viewer-close {
        transition: none;
        animation: none;
    }

    .loading-spinner {
        animation: none;
    }
}
