/**
 * Arena Gallery Block - Frontend Styles
 */

/* Gallery Wrapper */
.arena-gallery-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.arena-gallery-wrapper.alignwide {
    max-width: 1400px;
}

.arena-gallery-wrapper.alignfull {
    max-width: none;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Category Filters */
.arena-gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.arena-gallery-filter {
    padding: 0.5rem 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    background: #fff;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.arena-gallery-filter:hover {
    border-color: #dc2626;
    color: #dc2626;
}

.arena-gallery-filter.active {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

@media (max-width: 480px) {
    .arena-gallery-filters {
        gap: 0.375rem;
    }

    .arena-gallery-filter {
        padding: 0.375rem 1rem;
        font-size: 0.8125rem;
    }
}

/* Gallery Grid */
.arena-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Column variants */
.arena-gallery-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.arena-gallery-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.arena-gallery-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.arena-gallery-cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.arena-gallery-cols-6 {
    grid-template-columns: repeat(6, 1fr);
}

@media (max-width: 1024px) {
    .arena-gallery-cols-5,
    .arena-gallery-cols-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .arena-gallery-cols-3,
    .arena-gallery-cols-4,
    .arena-gallery-cols-5,
    .arena-gallery-cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }

    .arena-gallery-grid {
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .arena-gallery-cols-2,
    .arena-gallery-cols-3,
    .arena-gallery-cols-4,
    .arena-gallery-cols-5,
    .arena-gallery-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    .arena-gallery-grid {
        gap: 0.5rem;
    }
}

/* Gallery Item */
.arena-gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 0.5rem;
    cursor: pointer;
    background: #f3f4f6;
}

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

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

/* Gallery Overlay */
.arena-gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.arena-gallery-item:hover .arena-gallery-overlay {
    background: rgba(0, 0, 0, 0.4);
}

.arena-gallery-zoom {
    color: #fff;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.arena-gallery-item:hover .arena-gallery-zoom {
    opacity: 1;
    transform: scale(1);
}

/* Load More Button */
.arena-gallery-load-more {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.arena-gallery-load-btn {
    padding: 0.75rem 2rem;
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.arena-gallery-load-btn:hover:not(:disabled) {
    background: #b91c1c;
}

.arena-gallery-load-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* Loader */
.arena-gallery-loader {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.arena-gallery-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #dc2626;
    border-radius: 50%;
    animation: arena-spin 0.8s linear infinite;
}

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

/* Lightbox */
.arena-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arena-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

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

.arena-lightbox-img-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arena-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.arena-lightbox-spinner {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: arena-spin 0.8s linear infinite;
}

/* Lightbox Controls */
.arena-lightbox-close,
.arena-lightbox-prev,
.arena-lightbox-next {
    position: absolute;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.arena-lightbox-close:hover,
.arena-lightbox-prev:hover,
.arena-lightbox-next:hover {
    background: rgba(0, 0, 0, 0.8);
}

.arena-lightbox-close {
    top: 1rem;
    right: 1rem;
    position: fixed;
}

.arena-lightbox-prev {
    left: 1rem;
}

.arena-lightbox-next {
    right: 1rem;
}

@media (max-width: 768px) {
    .arena-lightbox-prev,
    .arena-lightbox-next {
        width: 40px;
        height: 40px;
    }

    .arena-lightbox-prev {
        left: 0.5rem;
    }

    .arena-lightbox-next {
        right: 0.5rem;
    }

    .arena-lightbox-close {
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* Animation for gallery items */
.arena-gallery-item {
    animation: arena-fadeIn 0.4s ease;
}

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

/* Empty state */
.arena-gallery-grid:empty::after {
    content: 'Фото не знайдено';
    display: block;
    text-align: center;
    color: #6b7280;
    padding: 3rem;
    grid-column: 1 / -1;
}
