/* ==========================================================================
   Gallery Styles - Inov Interior Design
   ========================================================================== */

/* Gallery Main Section */
.gallery-main {
    padding: 140px 0 80px;
    background: var(--bg-light);
    min-height: calc(100vh - 200px);
}

.gallery-header {
    text-align: center;
    margin-bottom: 4rem;
}

.gallery-header h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 700;
}

.gallery-header p {
    font-size: 1.2rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.gallery-item {
    position: relative;
    height: 300px;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    background: white;
}

.gallery-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-heavy);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 62, 80, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

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

.gallery-overlay i {
    font-size: 2.5rem;
    color: white;
    transition: var(--transition);
}

.gallery-item:hover .gallery-overlay i {
    transform: scale(1.2);
}

/* ==========================================================================
   Lightbox Styles
   ========================================================================== */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Lightbox Controls */
.lightbox-close {
    position: absolute;
    top: -50px;
    right: -50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.lightbox-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: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
}

.lightbox-nav:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lightbox-nav:disabled:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%);
}

.lightbox-prev {
    left: -80px;
}

.lightbox-next {
    right: -80px;
}

/* Lightbox Counter */
.lightbox-counter {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 120px;
    text-align: center;
}

/* 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.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
    }
    
    .lightbox-close {
        top: -40px;
        right: -40px;
        width: 45px;
        height: 45px;
    }
    
    .lightbox-nav {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .lightbox-prev {
        left: -60px;
    }
    
    .lightbox-next {
        right: -60px;
    }
}

@media (max-width: 768px) {
    .gallery-main {
        padding: 120px 0 60px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
    
    .gallery-item {
        height: 250px;
    }
    
    .gallery-header h1 {
        font-size: 2rem;
    }
    
    /* Mobile Lightbox Adjustments */
    .lightbox-content {
        max-width: 95vw;
        max-height: 85vh;
        padding: 20px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        position: fixed;
        width: 40px;
        height: 40px;
        z-index: 10001;
    }
    
    .lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .lightbox-prev {
        left: 10px;
        position: fixed;
        top: 50%;
    }
    
    .lightbox-next {
        right: 10px;
        position: fixed;
        top: 50%;
    }
    
    .lightbox-counter {
        bottom: 20px;
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        font-size: 0.9rem;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .gallery-item {
        height: 200px;
    }
    
    .gallery-overlay i {
        font-size: 2rem;
    }
    
    .lightbox img {
        max-height: 70vh;
    }
}

/* ==========================================================================
   Touch Gestures Support
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    .gallery-item {
        -webkit-tap-highlight-color: transparent;
    }
    
    .gallery-overlay {
        opacity: 0.3;
    }
    
    .gallery-item:active .gallery-overlay {
        opacity: 1;
    }
    
    .lightbox-nav,
    .lightbox-close {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

.gallery-item:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
}

.lightbox-nav:focus,
.lightbox-close:focus {
    outline: 2px solid var(--gold-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .gallery-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
    
    .lightbox {
        background: rgba(0, 0, 0, 1);
    }
    
    .lightbox-nav,
    .lightbox-close {
        border-color: white;
        background: rgba(0, 0, 0, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .gallery-item,
    .gallery-item img,
    .gallery-overlay,
    .lightbox,
    .lightbox-nav,
    .lightbox-close {
        transition: none;
    }
    
    .gallery-item:hover {
        transform: none;
    }
    
    .gallery-item:hover img {
        transform: none;
    }
    
    .lightbox-loading {
        animation: none;
    }
}