/* ===== GALLERY MODULE ===== */
:root {
    --gl-primary: var(--primary-color, #ff6b35);
    --gl-overlay: rgba(0, 0, 0, 0.9);
}

/* ===== ОСНОВНОЙ КОНТЕЙНЕР ===== */
.gl-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.gl-header {
    text-align: center;
    margin-bottom: 50px;
}

.gl-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.gl-title:after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--gl-primary), transparent);
    border-radius: 2px;
}

.gl-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== ФИЛЬТРЫ КАТЕГОРИЙ ===== */
.gl-categories {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.gl-category-btn {
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 40px;
    padding: 12px 25px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gl-category-btn i {
    font-size: 16px;
}

.gl-category-btn:hover {
    background: var(--gl-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 53, 0.3);
}

.gl-category-btn.active {
    background: var(--gl-primary);
    color: white;
    border-color: var(--gl-primary);
}

/* ===== СЕТКА ГАЛЕРЕИ ===== */
.gl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

/* ===== ЭЛЕМЕНТ ГАЛЕРЕИ ===== */
.gl-item {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    animation: gl-fadeIn 0.5s ease;
}

.gl-item:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

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

.gl-item:hover .gl-image {
    transform: scale(1.1);
}

.gl-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gl-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gl-item-info {
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.gl-item:hover .gl-item-info {
    transform: translateY(0);
}

.gl-item-title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.gl-item-category {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.gl-item-views {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.gl-item-views i {
    font-size: 14px;
}

/* ===== БЕЙДЖИ ===== */
.gl-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--gl-primary);
    color: white;
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.gl-badge.new {
    background: var(--success-color);
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */
.gl-empty {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-secondary);
    border-radius: 30px;
}

.gl-empty-icon {
    font-size: 80px;
    color: var(--text-muted);
    margin-bottom: 20px;
    opacity: 0.5;
}

.gl-empty h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.gl-empty p {
    color: var(--text-secondary);
    margin-bottom: 25px;
}

/* ===== МОДАЛЬНОЕ ОКНО (ПРОСМОТР) ===== */
.gl-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gl-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.gl-modal.active {
    opacity: 1;
    visibility: visible;
}

.gl-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    animation: gl-zoomIn 0.3s ease;
}

.gl-modal-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.gl-modal-close {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: none;
    color: #333;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.gl-modal-close:hover {
    background: var(--gl-primary);
    color: white;
    transform: rotate(90deg);
}

.gl-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: none;
    color: #333;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.gl-modal-nav:hover {
    background: var(--gl-primary);
    color: white;
}

.gl-modal-prev {
    left: -80px;
}

.gl-modal-next {
    right: -80px;
}

.gl-modal-info {
    position: absolute;
    bottom: -60px;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
}

.gl-modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 5px;
}

.gl-modal-description {
    font-size: 14px;
    opacity: 0.8;
}

/* ===== АДМИН-ПАНЕЛЬ (внутри галереи для админа) ===== */
.gl-admin-actions {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s;
}

.gl-item:hover .gl-admin-actions {
    opacity: 1;
}

.gl-admin-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: white;
    border: none;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.gl-admin-btn:hover {
    background: var(--gl-primary);
    color: white;
}

.gl-admin-btn.delete:hover {
    background: var(--danger-color);
}

/* ===== ЗАГРУЗКА (СКЕЛЕТОН) ===== */
.gl-skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-card) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: gl-loading 1.5s infinite;
    border-radius: 20px;
    aspect-ratio: 1 / 1;
}

@keyframes gl-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===== ПАГИНАЦИЯ ===== */
.gl-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 50px 0;
    flex-wrap: wrap;
}

.gl-page-btn {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.gl-page-btn:hover {
    background: var(--gl-primary);
    color: white;
    border-color: var(--gl-primary);
    transform: translateY(-2px);
}

.gl-page-btn.active {
    background: var(--gl-primary);
    color: white;
    border-color: var(--gl-primary);
}

/* ===== АНИМАЦИИ ===== */
@keyframes gl-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes gl-zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 1200px) {
    .gl-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .gl-title {
        font-size: 2rem;
    }

    .gl-category-btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    .gl-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .gl-modal-nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .gl-modal-prev {
        left: -50px;
    }

    .gl-modal-next {
        right: -50px;
    }

    .gl-modal-close {
        top: -30px;
        right: -30px;
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .gl-grid {
        grid-template-columns: 1fr;
    }

    .gl-categories {
        flex-direction: column;
        align-items: stretch;
    }

    .gl-category-btn {
        width: 100%;
        justify-content: center;
    }

    .gl-modal-nav {
        display: none;
    }

    .gl-modal-close {
        top: 10px;
        right: 10px;
    }
}
