/* Modern Portfolio Gallery Styles - Redesigned 2025 */

/* Modal Base */
.modern-gallery-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-gallery-modal.active {
    display: flex;
    opacity: 1;
}

/* Backdrop */
.gallery-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(11, 11, 15, 0.98);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    animation: fadeIn 0.3s ease;
}

/* Main Container */
.gallery-container {
    position: relative;
    width: 100%;
    max-width: 85vw;
    max-height: 90vh;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border-radius: 28px;
    border: 1px solid rgba(212, 175, 55, 0.15);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(212, 175, 55, 0.1) inset;
    overflow: hidden;
    animation: slideUpScale 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

/* Close Button */
.gallery-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    color: #D4AF37;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.gallery-close-btn:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: rgba(212, 175, 55, 0.5);
    transform: rotate(90deg) scale(1.1);
}

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

/* Header */
.gallery-header {
    padding: 2rem 2.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.gallery-category-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
    border: 1px solid;
    transition: all 0.3s ease;
}

.gallery-category-badge.category-branding {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.4);
    color: #D4AF37;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.gallery-category-badge.category-social {
    background: rgba(110, 86, 207, 0.15);
    border-color: rgba(110, 86, 207, 0.4);
    color: #6E56CF;
    box-shadow: 0 4px 12px rgba(110, 86, 207, 0.2);
}

.gallery-category-badge.category-production {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.4);
    color: #D4AF37;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.gallery-category-badge.category-art {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.4);
    color: #D4AF37;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.gallery-title {
    font-family: 'Cairo', sans-serif;
    font-size: clamp(1.5rem, 3.5vw, 2rem);
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.gallery-description {
    font-size: clamp(0.8125rem, 1.8vw, 1rem);
    line-height: 1.6;
    color: rgba(201, 205, 210, 0.85);
    max-width: 700px;
    margin: 0 auto;
}

/* Viewport - Main Image Area */
.gallery-viewport {
    position: relative;
    flex: 1;
    min-height: 300px;
    max-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.03), rgba(110, 86, 207, 0.03));
}

.gallery-image-container {
    position: relative;
    width: auto;
    max-width: 85%;
    height: auto;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    overflow: visible;
    background: transparent;
    margin: 0 auto;
}

.gallery-main-img {
    max-width: 100%;
    max-height: calc(50vh - 4rem);
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity 0.4s ease;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Loader */
.gallery-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 16px;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: #D4AF37;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error Message */
.gallery-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: rgba(201, 205, 210, 0.6);
    background: transparent;
    border-radius: 16px;
}

.gallery-error svg {
    color: rgba(220, 38, 38, 0.6);
}

/* Navigation Buttons */
.gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(212, 175, 55, 0.12);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    color: #D4AF37;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.gallery-btn:hover {
    background: rgba(212, 175, 55, 0.25);
    border-color: rgba(212, 175, 55, 0.5);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
}

.gallery-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-btn-prev {
    left: 1.5rem;
}

.gallery-btn-next {
    right: 1.5rem;
}

/* Footer */
.gallery-footer {
    padding: 1.25rem 2.5rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
}

.gallery-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(201, 205, 210, 0.8);
}

.gallery-counter .current-index {
    color: #D4AF37;
    font-size: 1.125rem;
}

.gallery-counter .separator {
    color: rgba(201, 205, 210, 0.5);
}

.gallery-counter .total-count {
    color: rgba(201, 205, 210, 0.6);
}

/* Thumbnails */
.gallery-thumbnails-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.3) transparent;
    padding: 0.5rem 0;
    margin: 0 auto;
    max-width: 100%;
    text-align: center;
}

.gallery-thumbnails-wrapper::-webkit-scrollbar {
    height: 6px;
}

.gallery-thumbnails-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-thumbnails-wrapper::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
}

.gallery-thumbnails-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}

.gallery-thumbnails-scroll {
    width: max-content;
    margin: 0 auto;
}

.gallery-thumbnails-list {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
}

/* Thumbnail Item */
.gallery-thumb {
    position: relative;
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(11, 11, 15, 0.8);
}

.gallery-thumb:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
    background: rgba(11, 11, 15, 0.95);
}

.gallery-thumb.active {
    border-color: #D4AF37;
    border-width: 3px;
    box-shadow: 
        0 0 0 2px rgba(212, 175, 55, 0.3),
        0 4px 12px rgba(212, 175, 55, 0.5);
    transform: scale(1.05);
    background: rgba(212, 175, 55, 0.1);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.gallery-thumb.active img {
    transform: scale(1);
}

.thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 11, 15, 0.5);
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-thumb.active .thumb-overlay {
    opacity: 0;
    background: rgba(212, 175, 55, 0.2);
}

.gallery-thumb:hover .thumb-overlay {
    opacity: 0.3;
    background: rgba(212, 175, 55, 0.15);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUpScale {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .gallery-container {
        max-width: 98vw;
        max-height: 98vh;
    }

    .gallery-header {
        padding: 2rem 2rem 1.5rem;
    }

    .gallery-viewport {
        padding: 1.5rem;
        max-height: 55vh;
    }

    .gallery-btn {
        width: 48px;
        height: 48px;
    }

    .gallery-btn-prev {
        left: 1rem;
    }

    .gallery-btn-next {
        right: 1rem;
    }

    .gallery-footer {
        padding: 1.25rem 2rem 1.5rem;
    }

    .gallery-thumb {
        width: 85px;
        height: 64px;
    }
}

@media (max-width: 768px) {
    .modern-gallery-modal {
        padding: 0.5rem;
    }

    .gallery-container {
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 24px;
    }

    .gallery-close-btn {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    .gallery-header {
        padding: 1.5rem 1.5rem 1rem;
    }

    .gallery-viewport {
        padding: 1rem;
        min-height: 300px;
        max-height: 50vh;
    }

    .gallery-btn {
        width: 40px;
        height: 40px;
    }

    .gallery-btn svg {
        width: 20px;
        height: 20px;
    }

    .gallery-btn-prev {
        left: 0.5rem;
    }

    .gallery-btn-next {
        right: 0.5rem;
    }

    .gallery-footer {
        padding: 1rem 1.5rem 1.25rem;
    }

    .gallery-thumb {
        width: 70px;
        height: 53px;
    }

    .gallery-thumbnails-list {
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .gallery-title {
        font-size: 1.5rem;
    }

    .gallery-description {
        font-size: 0.875rem;
    }

    .gallery-viewport {
        min-height: 250px;
        max-height: 45vh;
    }

    .gallery-thumb {
        width: 60px;
        height: 45px;
    }
}

/* Smooth scrolling */
.gallery-thumbnails-wrapper {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Accessibility */
.gallery-btn:focus,
.gallery-close-btn:focus,
.gallery-thumb:focus {
    outline: 2px solid rgba(212, 175, 55, 0.5);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .modern-gallery-modal {
        display: none !important;
    }
}
