/**
 * Enhanced Lightbox Styles - Modern Design
 * Accessible lightbox with smooth animations and responsive design
 */

.enhanced-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Apercu', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

.enhanced-lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Enhanced Backdrop */
.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    animation: backdropFadeIn 0.4s ease-out;
}

@keyframes backdropFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }
}

/* Enhanced Main Container */
.lightbox-container {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: containerSlideIn 0.4s ease-out 0.1s both;
}

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

/* Enhanced Close Button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 0; /* Remove rounded corners */
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: buttonSlideIn 0.4s ease-out 0.2s both;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.1) rotate(90deg);
}

.lightbox-close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-close svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.lightbox-close:hover svg {
    transform: scale(1.1);
}

/* Enhanced Navigation Buttons */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 64px;
    height: 64px;
    background: rgba(0, 0, 0, 0.7) !important;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 0;
    color: white !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 1 !important;
    visibility: visible !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: buttonSlideIn 0.4s ease-out 0.3s both;
}

.lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.9) !important;
    border-color: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-nav:focus {
    outline: 2px solid white;
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav svg {
    width: 32px;
    height: 32px;
    fill: white !important;
    color: white !important;
    transition: transform 0.3s ease;
    opacity: 1 !important;
}

.lightbox-nav:hover svg {
    transform: scale(1.1);
}

@keyframes buttonSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Enhanced Content Area */
.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: contentFadeIn 0.4s ease-out 0.4s both;
}

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

/* Enhanced Image Container */
.lightbox-image-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0; /* Remove rounded corners */
    overflow: visible;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    min-height: 400px;
    min-width: 400px;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    border-radius: 0;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    position: relative;
    z-index: 1;
    background: transparent;
}

.lightbox-image:hover {
    transform: scale(1.02);
}

/* Loading state disabled - immediate image display */
.lightbox-loading,
.loading-spinner,
.spinner {
    display: none !important;
}

/* Hide any loading elements globally in lightbox context */
.enhanced-lightbox .loading-spinner,
.enhanced-lightbox .spinner,
.enhanced-lightbox [class*="loading"],
.enhanced-lightbox [class*="spinner"] {
    display: none !important;
}

/* Enhanced Info Panel */
.lightbox-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 2rem;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lightbox-container:hover .lightbox-info {
    transform: translateY(0);
}

.lightbox-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: white;
}

.lightbox-description {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.lightbox-counter {
    font-size: 0.9rem;
    opacity: 0.8;
    font-weight: 500;
}

/* Enhanced Thumbnails */
.lightbox-thumbnails {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90%;
    height: 80px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 0; /* Remove rounded corners */
    padding: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: thumbnailsSlideUp 0.4s ease-out 0.5s both;
}

@keyframes thumbnailsSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.lightbox-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0: 2px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0: 2px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.thumbnails-container {
    display: flex;
    gap: 8px;
    height: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.1);
}

.lightbox-thumbnail {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 0; /* Remove rounded corners */
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
}

.lightbox-thumbnail:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.lightbox-thumbnail.active {
    border-color: white;
    transform: scale(1.1);
}

.lightbox-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s ease;
}

.lightbox-thumbnail.active img {
    filter: brightness(1.2);
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-thumbnail:hover .thumbnail-overlay {
    opacity: 1;
}

.lightbox-thumbnail.active .thumbnail-overlay {
    opacity: 0;
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .lightbox-container {
        padding: 10px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 48px;
        height: 48px;
    }
    
    .lightbox-nav {
        width: 48px;
        height: 48px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-title {
        font-size: 1.25rem;
    }
    
    .lightbox-description {
        font-size: 0.9rem;
    }
    
    .lightbox-thumbnails {
        bottom: 10px;
        height: 60px;
        padding: 8px;
    }
    
    .lightbox-thumbnail {
        width: 44px;
        height: 44px;
    }
    
    .thumbnails-container {
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .lightbox-prev {
        left: 5px;
    }
    
    .lightbox-next {
        right: 5px;
    }
    
    .lightbox-thumbnail {
        width: 36px;
        height: 36px;
    }
    
    .lightbox-info {
        padding: 1.5rem;
    }
    
    .lightbox-title {
        font-size: 1.1rem;
    }
    
    .lightbox-description {
        font-size: 0.85rem;
    }
}

/* Enhanced Accessibility */
@media (prefers-contrast: high) {
    .lightbox-close,
    .lightbox-nav {
        background: rgba(255, 255, 255, 0.3);
        border-color: rgba(255, 255, 255, 0.5);
    }
    
    .lightbox-close:hover,
    .lightbox-nav:hover {
        background: rgba(255, 255, 255, 0.5);
        border-color: white;
    }
    
    .lightbox-thumbnails {
        background: rgba(0, 0, 0, 0.8);
        border-color: rgba(255, 255, 255, 0.3);
    }
}

@media (prefers-reduced-motion: reduce) {
    .enhanced-lightbox,
    .lightbox-container,
    .lightbox-close,
    .lightbox-nav,
    .lightbox-content,
    .lightbox-info,
    .lightbox-thumbnails {
        animation: none;
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* Enhanced Focus Management */
.enhanced-lightbox:focus {
    outline: none;
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.lightbox-thumbnail:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
    border-color: white;
}

/* Enhanced Print Styles */
@media print {
    .enhanced-lightbox {
        display: none !important;
    }
}

/* Enhanced Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .lightbox-info {
        transform: translateY(0);
        background: rgba(0, 0, 0, 0.9);
    }
    
    .lightbox-close,
    .lightbox-nav {
        min-width: 44px;
        min-height: 44px;
    }
    
    .lightbox-thumbnail {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Enhanced Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .lightbox-backdrop {
        background: rgba(0, 0, 0, 0.98);
    }
}

/* Enhanced Screen Reader Support */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Image loading states removed - immediate display */

/* Thumbnail loading removed */

/* Enhanced Scrollbar Styling */
.lightbox-thumbnails::-webkit-scrollbar {
    height: 6px;
}

.lightbox-thumbnails::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0: 3px;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0: 3px;
    transition: background 0.3s ease;
}

.lightbox-thumbnails::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Enhanced Keyboard Navigation Indicators */
.lightbox-close:focus-visible::after,
.lightbox-nav:focus-visible::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid white;
    border-radius: 0: 50%;
    pointer-events: none;
    animation: focusPulse 2s infinite;
}

@keyframes focusPulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Loading animation removed */

/* Enhanced Error State */
.lightbox-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 2rem;
}

.lightbox-error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.lightbox-error-message {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.lightbox-error-retry {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.lightbox-error-retry:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
} 