/**
 * ICCCMIT Gallery Styles
 * Modern, techy styling for conference photo galleries
 */

/* Gallery Card Styles */
.gallery-card {
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.4s ease;
    will-change: transform;
    contain: layout style paint;
    transform: translateZ(0);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gallery-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
}

.gallery-card > div:last-child {
    margin-top: auto;
}

/* Loading placeholder styles */
.thumbnail.placeholder {
    background: linear-gradient(110deg, #eff6ff 8%, #dbeafe 18%, #eff6ff 33%);
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
    contain: strict;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    contain: strict;
}

@keyframes shimmer {
    to {
        background-position: -200% 0;
    }
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.gallery-thumbnails {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 1.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.thumbnail {
    height: 100px;
    background-size: cover;
    background-position: center;
    position: relative;
    transition: all 0.3s ease;
    background-color: #f1f5f9;
}

.thumbnail.loading {
    background: linear-gradient(110deg, #f1f5f9 8%, #e2e8f0 18%, #f1f5f9 33%);
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

.thumbnail.loaded {
    animation: none;
}

.thumbnail-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s linear infinite;
}

.thumbnail.loaded .thumbnail-loader {
    display: none;
}

.image-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-radius: 50%;
    border-top-color: #3b82f6;
    animation: spin 1s linear infinite;
    display: none;
    z-index: 10;
}

.thumbnail:hover {
    filter: brightness(1.1);
}

.more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 58, 138, 0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.view-gallery {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.gallery-card > div[style*="margin-top: 1rem"] {
    margin-top: auto !important;
}

/* Gallery Modal Styles */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    will-change: opacity, visibility;
    contain: strict;
}

.gallery-modal.active {
    opacity: 1;
    visibility: visible;
}

.gallery-modal-content {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gallery-modal.active .gallery-modal-content {
    transform: scale(1);
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.gallery-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.5rem;
}

.gallery-controls {
    display: flex;
    gap: 1rem;
}

.gallery-control {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.gallery-control:hover {
    background: rgba(30, 58, 138, 0.1);
    color: var(--primary);
}

.gallery-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    background: #f8fafc;
}

.gallery-image-container {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.gallery-image {
    max-width: 100%;
    max-height: calc(100% - 60px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: opacity 0.3s ease;
    will-change: opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: subpixel-antialiased;
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.gallery-caption p {
    margin: 0;
    font-weight: 500;
    color: var(--text);
}

.gallery-counter {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.gallery-nav {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary);
    cursor: pointer;
    margin: 0 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 10;
}

.gallery-nav:hover:not([disabled]) {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.gallery-nav[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.gallery-thumbnails-container {
    height: 100px;
    padding: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.gallery-thumbnails-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    height: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) #f1f5f9;
}

.gallery-thumbnails-scroll::-webkit-scrollbar {
    height: 8px;
}

.gallery-thumbnails-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.gallery-thumbnails-scroll::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.gallery-thumbnail {
    min-width: 80px;
    height: 60px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    opacity: 0.7;
}

.gallery-thumbnail:hover {
    opacity: 1;
    transform: translateY(-3px);
}

.gallery-thumbnail.active {
    border-color: var(--primary);
    opacity: 1;
    box-shadow: 0 5px 15px rgba(30, 58, 138, 0.3);
}

/* Animation for image transitions */
@keyframes fadeIn {
    from { 
        opacity: 0;
    }
    to { 
        opacity: 1;
    }
}

/* Optimize animations for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gallery-card,
    .gallery-image,
    .gallery-thumbnail,
    .gallery-modal {
        transition: none;
        animation: none;
    }
    
    .gallery-modal::before,
    .gallery-modal::after {
        animation: none;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .gallery-header {
        padding: 1rem;
    }
    
    .gallery-header h2 {
        font-size: 1.2rem;
    }
    
    .gallery-nav {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin: 0 0.5rem;
    }
    
    .gallery-thumbnails-container {
        height: 80px;
    }
    
    .gallery-thumbnail {
        min-width: 60px;
        height: 45px;
    }
    
    .gallery-caption {
        padding: 0.5rem;
    }
    
    .gallery-caption p {
        font-size: 0.9rem;
    }
}

/* Tech-inspired decorative elements (removed for performance) */
/* Tech-inspired grid background (removed for performance) */
.gallery-main {
    position: relative;
}

/* Glowing effect for active elements */
.gallery-thumbnail.active::after {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 12px;
    background: linear-gradient(45deg, rgba(59, 130, 246, 0.5), rgba(30, 58, 138, 0.5));
    filter: blur(10px);
    z-index: -1;
    opacity: 0.7;
}

/* Futuristic loading animation */
.gallery-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
}

.gallery-loading::before,
.gallery-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.gallery-loading::after {
    animation-delay: 0.5s;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.3);
        opacity: 0.8;
    }
    80%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}
