/* Enhanced Gallery Styles - Modern Grid */
.enhanced-gallery {
    background: #ffffff;
    border-radius: 12px;
    padding: 0;
    margin: 0;
}

/* Gallery Grid Layout */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

/* Responsive grid adjustments for many photos */
@media (min-width: 1400px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 2rem;
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.25rem;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
}

/* Make the first item (featured) span more columns on larger screens */
.gallery-item.featured {
    grid-column: span 2;
}

@media (max-width: 768px) {
    .gallery-item.featured {
        grid-column: span 1;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1rem;
    }
}

/* Gallery Item Styles */
.gallery-item {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    min-height: 280px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item.featured {
    min-height: 320px;
}

.gallery-item.featured .gallery-item-info {
    background: #fff;
    color: #333;
}

/* Gallery Item Image */
.gallery-item-image {
    position: relative;
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

.gallery-item.featured .gallery-item-image {
    height: 250px;
}

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

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

/* Gallery Item Overlay */
.gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

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

.gallery-item-overlay i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Gallery Badge */
.gallery-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    z-index: 5;
}

.gallery-badge.official {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #d97706;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

/* Gallery Item Info */
.gallery-item-info {
    padding: 1rem;
    background: #fff;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 0;
}

.gallery-item-meta {
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.gallery-item-meta small {
    font-size: 0.8rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.gallery-item-description {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* Gallery Controls */
.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.gallery-actions {
    display: flex;
    gap: 0.75rem;
}

.gallery-counter {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

/* Single Column View */
.gallery-grid.single-column-view {
    grid-template-columns: 1fr !important;
}

.gallery-grid.single-column-view .gallery-item {
    max-width: 600px;
    margin: 0 auto;
}

.gallery-grid.single-column-view .gallery-item.featured {
    grid-column: span 1;
}

/* Slideshow Active State */
.gallery-grid.slideshow-active .gallery-item {
    transition: all 0.5s ease;
}

.gallery-grid.slideshow-active .gallery-item.slideshow-current {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    border: 3px solid #667eea;
}

/* Empty State */
.gallery-empty {
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state .empty-icon {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.empty-state h6 {
    color: #475569;
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* Legacy Gallery Styles (for backward compatibility) */
.modern-gallery {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.gallery-main-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.gallery-viewer {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.gallery-image-container {
    position: relative;
    height: 400px;
    overflow: hidden;
    background: #000;
}

.gallery-main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
    cursor: zoom-in;
}

.gallery-main-image:hover {
    transform: scale(1.02);
}

/* Navigation buttons */
.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.gallery-nav-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev {
    left: 20px;
}

.gallery-next {
    right: 20px;
}

/* Photo counter */
.gallery-counter {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 10;
}

/* Zoom button */
.gallery-zoom-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.gallery-zoom-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Info panel */
.gallery-info-panel {
    padding: 1.5rem;
    background: #fff;
    border-top: 1px solid #e9ecef;
}

.photo-meta .photo-title {
    color: #2c3e50;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.photo-details {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
}

.uploader-info {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.uploader-info i {
    color: #007bff;
}

.photo-description {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

/* Thumbnails */
.gallery-thumbnails-container {
    position: relative;
    margin-top: 1rem;
}

.gallery-thumbnails {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

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

.gallery-thumbnails::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.gallery-thumbnails::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.gallery-thumbnail {
    position: relative;
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.gallery-thumbnail:hover {
    transform: scale(1.05);
    border-color: #007bff;
}

.gallery-thumbnail.active {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.thumbnail-badge.official {
    background: #ffc107;
    color: #212529;
}

/* Thumbnail navigation */
.thumbnail-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #dee2e6;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
}

.thumbnail-nav-btn:hover {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.thumbnail-prev {
    left: -16px;
}

.thumbnail-next {
    right: -16px;
}

/* Modal styles */
.photo-modal .modal-content {
    background: #000;
    border: none;
}

.photo-modal .modal-header {
    background: rgba(0, 0, 0, 0.8);
    border: none;
    color: white;
}

.fullscreen-gallery {
    position: relative;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.fullscreen-image-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.fullscreen-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

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

.modal-prev {
    left: 30px;
}

.modal-next {
    right: 30px;
}

.modal-counter {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    z-index: 10;
}

.modal-info-panel {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-photo-meta .modal-uploader-info {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    opacity: 0.9;
}

.modal-photo-description {
    margin-top: 0.75rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

/* Modern Lightbox Styles */
.modern-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

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

.lightbox-content {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-image {
    max-width: 80vw;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.lightbox-info {
    padding: 1.5rem;
    background: #fff;
    border-top: 1px solid #e5e7eb;
}

.lightbox-info h5 {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: #1f2937;
    font-size: 1.1rem;
}

.lightbox-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.lightbox-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.lightbox-info p {
    margin: 0;
    color: #4b5563;
    line-height: 1.5;
}

.lightbox-counter {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Lightbox Navigation */
.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.lightbox-close i {
    font-size: 1.2rem;
    color: #374151;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    opacity: 0.8;
}

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

.lightbox-nav i {
    font-size: 1.4rem;
    color: #374151;
}

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

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .lightbox-container {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .lightbox-image {
        max-width: 90vw;
        max-height: 60vh;
    }
    
    .lightbox-info {
        padding: 1rem;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .lightbox-prev {
        left: -50px;
    }
    
    .lightbox-next {
        right: -50px;
    }
    
    .lightbox-close {
        width: 35px;
        height: 35px;
        top: 0.5rem;
        right: 0.5rem;
    }
}

@media (max-width: 480px) {
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-nav {
        width: 35px;
        height: 35px;
        background: rgba(0, 0, 0, 0.7);
    }
    
    .lightbox-nav i {
        color: #fff;
    }
    
    .lightbox-close {
        background: rgba(0, 0, 0, 0.7);
    }
    
    .lightbox-close i {
        color: #fff;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .gallery-image-container {
        height: 300px;
    }
    
    .gallery-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .gallery-prev {
        left: 10px;
    }
    
    .gallery-next {
        right: 10px;
    }
    
    .gallery-counter {
        top: 10px;
        right: 10px;
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .gallery-zoom-btn {
        bottom: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .gallery-info-panel {
        padding: 1rem;
    }
    
    .gallery-thumbnail {
        width: 60px;
        height: 45px;
    }
    
    .modal-nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }
    
    .modal-prev {
        left: 15px;
    }
    
    .modal-next {
        right: 15px;
    }
    
    .modal-counter {
        top: 15px;
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .modal-info-panel {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .gallery-image-container {
        height: 250px;
    }
    
    .modern-gallery {
        padding: 1rem;
    }
    
    .uploader-info {
        font-size: 0.85rem;
    }
    
    /* Hide thumbnail navigation on very small screens */
    .thumbnail-nav-btn {
        display: none;
    }
}

/* Animation for slideshow */
.slideshow-active .gallery-main-image {
    transition: opacity 0.5s ease-in-out;
}

.gallery-actions .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Loading state */
.gallery-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
}

.gallery-loading i {
    font-size: 2rem;
    margin-right: 0.5rem;
}

/* Gallery Show More/Less Feature */
.gallery-hidden {
    display: none !important;
}

.gallery-show-more {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.gallery-show-more .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid #007bff;
    background: transparent;
    color: #007bff;
}

.gallery-show-more .btn:hover {
    background: #007bff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.gallery-show-more .btn:active {
    transform: translateY(0);
}

.gallery-show-more .btn i {
    transition: transform 0.3s ease;
}

.gallery-show-more .btn:hover i {
    transform: scale(1.1);
}

/* Animation for showing/hiding photos */
.gallery-item {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments for show more button */
@media (max-width: 768px) {
    .gallery-show-more {
        padding: 1rem;
    }
    
    .gallery-show-more .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}
