/* Modern Lightbox Gallery Styles */
.modern-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.lightbox-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.lightbox-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.gallery-icon {
    font-size: 1.5rem;
}

.image-counter {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.lightbox-close {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

/* Content */
.lightbox-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2rem;
}

.lightbox-image-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease;
}

.image-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: white;
    font-size: 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Navigation */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
    font-weight: bold;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

/* Footer */
.lightbox-footer {
    padding: 1rem 2rem 2rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.1) 100%);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.image-title {
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-align: center;
}

.lightbox-thumbnails {
    display: flex;
    justify-content: center;
}

.thumbnails-scroll {
    display: flex;
    gap: 0.5rem;
    max-width: 100%;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.thumbnails-scroll::-webkit-scrollbar {
    height: 4px;
}

.thumbnails-scroll::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.thumbnails-scroll::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
}

.thumbnails-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

.lightbox-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

.lightbox-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.2s ease;
}

.lightbox-thumbnail:hover {
    transform: scale(1.05);
    border-color: rgba(255,255,255,0.5);
}

.lightbox-thumbnail.active {
    border-color: #4f9c5c;
    box-shadow: 0 0 0 1px #4f9c5c;
}

.lightbox-thumbnail.active::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #4f9c5c;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .lightbox-header {
        padding: 1rem;
    }
    
    .lightbox-content {
        padding: 1rem;
    }
    
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .lightbox-prev {
        left: 1rem;
    }
    
    .lightbox-next {
        right: 1rem;
    }
    
    .lightbox-footer {
        padding: 1rem;
    }
    
    .lightbox-thumbnail {
        width: 60px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .lightbox-title {
        font-size: 1rem;
        gap: 0.5rem;
    }
    
    .gallery-icon {
        font-size: 1.2rem;
    }
    
    .image-counter {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
    }
    
    .lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .lightbox-prev {
        left: 0.5rem;
    }
    
    .lightbox-next {
        right: 0.5rem;
    }
}

/* Body lock when lightbox is open */
body.lightbox-open {
    overflow: hidden;
}

/* Smooth animations */
.modern-lightbox * {
    box-sizing: border-box;
}

/* Accessibility improvements */
.lightbox-nav:focus,
.lightbox-close:focus,
.lightbox-thumbnail:focus {
    outline: 2px solid #4f9c5c;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .lightbox-backdrop {
        background: rgba(0, 0, 0, 0.98);
    }
    
    .lightbox-nav,
    .lightbox-close {
        border: 2px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modern-lightbox,
    .lightbox-nav,
    .lightbox-close,
    .lightbox-thumbnail,
    .lightbox-image-container img {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* Fix for house and unit details heading icon conflict */
.house-details-enhanced h3::before,
.unit-details h3::before {
    content: none !important;
    display: none !important;
}
