/* =========================================
   4. GALLERY - گالری عمومی و صفحه اصلی
   ========================================= */

/* =========================================
   GALLERY HERO - هیرو گالری
   ========================================= */
.gallery-hero {
    min-height: 300px;
    padding: 80px 20px 40px;
    background: 
        radial-gradient(ellipse at top, rgba(212,175,55,0.12), transparent 60%),
        linear-gradient(180deg, var(--bg-body) 0%, var(--bg-card) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
    margin-bottom: 30px;
}

.gallery-hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.gallery-hero h1 i {
    color: var(--primary-color);
}

.gallery-hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin: 0;
}

/* =========================================
   GENRE FILTER - فیلتر ژانرها
   ========================================= */
.genre-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin: 0 auto 40px;
    padding: 0 15px;
    max-width: 1200px;
}

.genre-chip {
    padding: 10px 22px;
    border-radius: 30px;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.genre-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.genre-chip.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(212,175,55,0.3);
}

/* =========================================
   GALLERY GRID - گرید عکس‌ها
   ========================================= */
.public-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 0 30px 50px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
    aspect-ratio: 4/3;
    margin: 0;
    transition: var(--transition);
}

.gallery-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-card:hover img {
    transform: scale(1.08);
}

.gallery-card figcaption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 50px 15px 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.88), rgba(0,0,0,0.3) 70%, transparent);
    color: #fff;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-card:hover figcaption {
    opacity: 1;
}

.gallery-card figcaption h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.gallery-card figcaption span {
    font-size: 0.72rem;
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

/* =========================================
   PAGINATION - صفحه‌بندی
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 20px 0 60px;
    flex-wrap: wrap;
    padding: 0 15px;
}

.page-link {
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.page-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.page-link.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px rgba(212,175,55,0.3);
}

/* =========================================
   LIGHTBOX - نمایش بزرگ عکس
   ========================================= */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0,0,0,0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 30px;
    backdrop-filter: blur(8px);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 90vw;
    max-height: 82vh;
    border-radius: 10px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.7);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 25px;
    left: 25px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.lightbox-close:hover {
    background: var(--danger-color);
    transform: rotate(90deg);
}

.lightbox-caption {
    position: absolute;
    bottom: 25px;
    color: #fff;
    font-size: 0.95rem;
    background: rgba(0,0,0,0.6);
    padding: 8px 18px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
}

/* =========================================
   EMPTY STATE - حالت خالی
   ========================================= */
.empty-gallery,
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-gallery i,
.empty-state i {
    font-size: 4.5rem;
    margin-bottom: 20px;
    opacity: 0.3;
    color: var(--primary-color);
}

.empty-gallery h2 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--text-main);
}

.empty-gallery p,
.empty-state p {
    font-size: 1rem;
}

.empty-text {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
}

/* =========================================
   RESPONSIVE - ریسپانسیو
   ========================================= */
@media (max-width: 1024px) {
    .public-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        padding: 0 20px 40px;
    }
}

@media (max-width: 768px) {
    .gallery-hero {
        min-height: 240px;
        padding: 60px 15px 30px;
    }
    
    .gallery-hero h1 {
        font-size: 1.8rem;
    }
    
    .gallery-hero p {
        font-size: 0.95rem;
    }
    
    .public-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 15px 30px;
    }
    
    .genre-filter {
        gap: 8px;
        margin-bottom: 30px;
    }
    
    .genre-chip {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .lightbox {
        padding: 15px;
    }
    
    .lightbox-close {
        top: 15px;
        left: 15px;
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
    }
    
    .pagination {
        gap: 6px;
    }
    
    .page-link {
        min-width: 38px;
        height: 38px;
        font-size: 0.88rem;
    }
}

@media (max-width: 480px) {
    .gallery-hero h1 {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 8px;
    }
    
    .public-gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-card {
        aspect-ratio: 16/10;
    }
}