/*
 * Modern Gallery Styles for Menu Items
 * Version: 1.0
 * Description: Contemporary gallery design with animations and interactivity
 */

/* ============================================
   1. Modern Gallery Container Styles
   ============================================ */

.modern-gallery-section {
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, rgba(248,250,252,0.9) 100%);
    border-radius: 20px;
    padding: 30px;
    margin: 30px 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.06);
    border: 1px solid rgba(229,231,235,0.8);
}

.modern-gallery-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #fd540f, #20b1db);
    border-radius: 20px 20px 0 0;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    position: relative;
}

.gallery-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, rgba(253,84,15,0.3) 0%, rgba(32,177,219,0.3) 100%);
}

.gallery-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: #011166;
    font-size: 24px;
    font-weight: 700;
    position: relative;
}

.gallery-title i {
    color: #fd540f;
    font-size: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.gallery-count {
    font-size: 14px;
    color: #64748b;
    font-weight: 400;
    margin-left: 8px;
    background: rgba(100,116,139,0.1);
    padding: 4px 12px;
    border-radius: 12px;
}

/* ============================================
   2. Gallery View Controls
   ============================================ */

.gallery-controls {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(10px);
    padding: 4px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.gallery-view-btn {
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: #64748b;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.gallery-view-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.gallery-view-btn:hover::before {
    left: 100%;
}

.gallery-view-btn:hover {
    background: rgba(100,116,139,0.1);
    color: #374151;
    transform: translateY(-2px);
}

.gallery-view-btn.active {
    background: linear-gradient(135deg, #fd540f, #20b1db);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(253,84,15,0.3);
}

.gallery-view-btn.active:hover {
    transform: scale(1.05) translateY(-2px);
}

/* ============================================
   3. Gallery Grid Layouts
   ============================================ */

.modern-gallery-container {
    position: relative;
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-grid.masonry {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 10px;
}

/* ============================================
   4. Gallery Item Styles
   ============================================ */

.modern-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    transform-origin: center;
}

.modern-gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(253,84,15,0.1), rgba(32,177,219,0.1));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 1;
}

.modern-gallery-item:hover::before {
    opacity: 1;
}

.modern-gallery-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.modern-gallery-item:nth-child(odd):hover {
    transform: translateY(-8px) scale(1.02) rotate(1deg);
}

.modern-gallery-item:nth-child(even):hover {
    transform: translateY(-8px) scale(1.02) rotate(-1deg);
}

.gallery-item-inner {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    height: 100%;
}

.gallery-image-container {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
    border-radius: 16px;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 16px;
    filter: brightness(1) saturate(1);
}

.modern-gallery-item:hover .gallery-image {
    transform: scale(1.1);
    filter: brightness(1.1) saturate(1.2);
}

/* ============================================
   5. Gallery Overlay Effects
   ============================================ */

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(253,84,15,0.9), rgba(32,177,219,0.9));
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    backdrop-filter: blur(5px);
}

.modern-gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay-content {
    display: flex;
    gap: 15px;
    transform: translateY(20px) scale(0.8);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modern-gallery-item:hover .gallery-overlay-content {
    transform: translateY(0) scale(1);
}

.gallery-expand-btn,
.gallery-zoom-btn {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.gallery-expand-btn::before,
.gallery-zoom-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.gallery-expand-btn:hover::before,
.gallery-zoom-btn:hover::before {
    width: 100%;
    height: 100%;
}

.gallery-expand-btn:hover,
.gallery-zoom-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.gallery-number {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    z-index: 2;
}

.modern-gallery-item:hover .gallery-number {
    transform: scale(1.1);
    background: rgba(253,84,15,0.9);
}

/* ============================================
   6. Loading and Animation States
   ============================================ */

.gallery-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.gallery-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(253,84,15,0.3);
    border-top: 3px solid #fd540f;
    border-radius: 50%;
    animation: gallerySpinning 1s linear infinite;
}

@keyframes gallerySpinning {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gallery-item-loading {
    opacity: 0.5;
    position: relative;
}

.gallery-item-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: gallerySpinning 0.8s linear infinite;
    transform: translate(-50%, -50%);
}

/* ============================================
   7. Responsive Design
   ============================================ */

@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .modern-gallery-section {
        padding: 20px;
        margin: 20px 0;
        border-radius: 16px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .gallery-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .gallery-title {
        font-size: 20px;
    }
    
    .gallery-controls {
        align-self: stretch;
        justify-content: center;
    }
    
    .modern-gallery-item:nth-child(odd):hover,
    .modern-gallery-item:nth-child(even):hover {
        transform: translateY(-5px) scale(1.02);
    }
    
    .gallery-expand-btn,
    .gallery-zoom-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

@media (max-width: 576px) {
    .modern-gallery-section {
        padding: 15px;
        margin: 15px 0;
        border-radius: 12px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .gallery-title {
        font-size: 18px;
    }
    
    .gallery-title i {
        font-size: 16px;
    }
    
    .gallery-count {
        font-size: 12px;
        padding: 2px 8px;
    }
    
    .gallery-view-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .gallery-overlay-content {
        gap: 10px;
    }
    
    .gallery-expand-btn,
    .gallery-zoom-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .gallery-number {
        width: 24px;
        height: 24px;
        font-size: 10px;
        top: 8px;
        left: 8px;
    }
}

/* ============================================
   8. Accessibility Improvements
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .modern-gallery-item,
    .gallery-image,
    .gallery-overlay,
    .gallery-overlay-content,
    .gallery-expand-btn,
    .gallery-zoom-btn,
    .gallery-number {
        transition: none;
    }
    
    .gallery-title i {
        animation: none;
    }
    
    .gallery-spinner {
        animation: none;
    }
}

.modern-gallery-item:focus {
    outline: 2px solid #fd540f;
    outline-offset: 4px;
}

.gallery-expand-btn:focus,
.gallery-zoom-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ============================================
   9. Print Styles
   ============================================ */

@media print {
    .modern-gallery-section {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    
    .gallery-controls {
        display: none;
    }
    
    .gallery-overlay,
    .gallery-expand-btn,
    .gallery-zoom-btn {
        display: none;
    }
    
    .modern-gallery-item {
        break-inside: avoid;
        margin-bottom: 10px;
    }
}

/* ============================================
   10. Dark Mode Support (future)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .modern-gallery-section {
        background: linear-gradient(135deg, rgba(30,30,30,0.9) 0%, rgba(20,20,20,0.9) 100%);
        border-color: rgba(75,85,99,0.8);
    }
    
    .gallery-title {
        color: #f8fafc;
    }
    
    .gallery-count {
        color: #94a3b8;
        background: rgba(148,163,184,0.1);
    }
    
    .gallery-view-btn {
        color: #94a3b8;
    }
    
    .gallery-view-btn:hover {
        background: rgba(148,163,184,0.1);
        color: #f1f5f9;
    }
    
    .modern-gallery-item {
        background: #1f2937;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    }
}