/* Modern Gallery Styles */

/* Gallery Grid - More modern layout */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

/* Gallery Items - Enhanced */
.gallery-item {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(139, 122, 184, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, #f8f5ff, #fff);
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 122, 184, 0.8), rgba(244, 217, 208, 0.8));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.gallery-item:hover::before {
    opacity: 1;
}

.gallery-item:hover {
    transform: translateY(-12px) scale(1.03);
    box-shadow: 0 25px 60px rgba(139, 122, 184, 0.25);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Gallery Overlay */
.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay h4 {
    color: var(--white);
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 10px;
    transform: translateY(20px);
    transition: transform 0.4s ease;
    text-align: center;
}

.gallery-item:hover .gallery-overlay h4 {
    transform: translateY(0);
}

.gallery-overlay .view-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 24px;
    margin-top: 15px;
    transform: translateY(20px) scale(0.8);
    transition: all 0.4s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.gallery-item:hover .gallery-overlay .view-icon {
    transform: translateY(0) scale(1);
}

/* Modern Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

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

@keyframes fadeOut {
    to { opacity: 0; }
}

/* Lightbox Content */
.lightbox-content {
    position: relative;
    max-width: 95%;
    max-height: 95vh;
    transform: scale(0.9);
    animation: zoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes zoomIn {
    to {
        transform: scale(1);
    }
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
}

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

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

.lightbox-close:active {
    transform: rotate(90deg) scale(0.95);
}

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

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
    left: 30px;
}

.lightbox-nav.next {
    right: 30px;
}

/* Image Counter */
.lightbox-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    z-index: 10001;
}

/* Image Title in Lightbox */
.lightbox-title {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: white;
    font-size: 18px;
    font-weight: 500;
    max-width: 60%;
    text-align: center;
    z-index: 10001;
}

/* Loading Animation */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .gallery-item {
        border-radius: 16px;
    }
    
    .lightbox-close,
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .lightbox-close {
        top: 15px;
        right: 15px;
    }
    
    .lightbox-nav.prev {
        left: 15px;
    }
    
    .lightbox-nav.next {
        right: 15px;
    }
    
    .lightbox-counter {
        bottom: 15px;
        font-size: 14px;
        padding: 10px 20px;
    }
    
    .lightbox-title {
        top: 15px;
        font-size: 16px;
        padding: 10px 20px;
        max-width: 70%;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .lightbox-content img {
        max-height: 70vh;
    }
}

/* RTL Support */
[dir="rtl"] .lightbox-close {
    right: auto;
    left: 30px;
}

[dir="rtl"] .lightbox-nav.prev {
    left: auto;
    right: 30px;
}

[dir="rtl"] .lightbox-nav.next {
    right: auto;
    left: 30px;
}

@media (max-width: 768px) {
    [dir="rtl"] .lightbox-close {
        left: 15px;
    }
    
    [dir="rtl"] .lightbox-nav.prev {
        right: 15px;
    }
    
    [dir="rtl"] .lightbox-nav.next {
        left: 15px;
    }
}
