/* ========================================
   Aparostudio Gallery Manager - Frontend Styles
   Version: 2.1.0 - UPDATED 16/11/2025 - Fix: Reposicionamento automático
   ======================================== */

/* ========== Container Geral ========== */
.ag-gallery {
    margin: 30px 0;
    width: 100%;
}

/* ========== FILTROS DE CATEGORIA ========== */
.ag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    justify-content: center;
}

.ag-filter-btn {
    padding: 10px 24px;
    background: #fff;
    color: #333;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ag-filter-btn:hover {
    background: #f0f0f1;
    border-color: #999;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ag-filter-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ag-filter-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

/* ========== ANIMAÇÕES DE FILTRO ========== */
.ag-item,
.ag-carousel-item,
.ag-list-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.ag-item.ag-hidden,
.ag-carousel-item.ag-hidden,
.ag-list-item.ag-hidden {
    display: none !important; /* Remove do grid completamente */
}

.ag-item.ag-visible,
.ag-carousel-item.ag-visible,
.ag-list-item.ag-visible {
    display: block !important; /* Volta ao grid */
    animation: agFadeIn 0.4s ease;
}

/* Estado inicial - todos visíveis */
.ag-item,
.ag-carousel-item,
.ag-list-item {
    display: block;
}

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

/* ========== LAYOUT: GRID ========== */
.ag-layout-grid .ag-grid {
    display: grid;
    grid-template-columns: repeat(var(--ag-columns, 3), 1fr);
    gap: var(--ag-gap, 15px);
}

.ag-layout-grid .ag-item {
    position: relative;
    overflow: hidden;
}

.ag-layout-grid .ag-item-inner {
    position: relative;
    overflow: hidden;
    background: #f0f0f1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ag-layout-grid img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

/* ========== LAYOUT: MASONRY ========== */
.ag-layout-masonry .ag-grid {
    column-count: var(--ag-columns, 3);
    column-gap: var(--ag-gap, 15px);
}

.ag-layout-masonry .ag-item {
    break-inside: avoid;
    margin-bottom: var(--ag-gap, 15px);
}

.ag-layout-masonry .ag-item-inner {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: #f0f0f1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ag-layout-masonry img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

/* ========== LAYOUT: CARROSSEL ========== */
.ag-layout-carousel .ag-carousel-wrapper {
    position: relative;
    overflow: hidden;
}

.ag-layout-carousel .ag-carousel {
    display: flex;
    gap: var(--ag-gap, 15px);
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    padding: 10px 0;
}

.ag-layout-carousel .ag-carousel::-webkit-scrollbar {
    height: 8px;
}

.ag-layout-carousel .ag-carousel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.ag-layout-carousel .ag-carousel::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.ag-layout-carousel .ag-carousel-item {
    flex: 0 0 300px;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: #f0f0f1;
}

.ag-layout-carousel .ag-carousel-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.ag-carousel-prev,
.ag-carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.ag-carousel-prev:hover,
.ag-carousel-next:hover {
    background: rgba(0, 0, 0, 0.8);
}

.ag-carousel-prev {
    left: 10px;
}

.ag-carousel-next {
    right: 10px;
}

/* ========== LAYOUT: LISTA ========== */
.ag-layout-list .ag-list {
    display: flex;
    flex-direction: column;
    gap: var(--ag-gap, 15px);
}

.ag-layout-list .ag-list-item {
    display: flex;
    gap: 20px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    overflow: hidden;
    padding: 15px;
}

.ag-layout-list .ag-list-image {
    flex: 0 0 200px;
    overflow: hidden;
    border-radius: 4px;
    background: #f0f0f1;
}

.ag-layout-list .ag-list-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.ag-layout-list .ag-list-content {
    flex: 1;
}

.ag-layout-list .ag-list-content h3 {
    margin: 0 0 10px;
    font-size: 20px;
    color: #1d2327;
}

.ag-layout-list .ag-list-content p {
    margin: 0;
    color: #646970;
    line-height: 1.6;
}

/* ========== LEGENDAS ========== */
.ag-caption {
    padding: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 13px;
    text-align: center;
}

/* ========== OVERLAY ========== */
.ag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

a.ag-lightbox-trigger:hover .ag-overlay {
    opacity: 1;
}

.ag-zoom-icon {
    font-size: 32px;
}

/* ========== EFEITOS HOVER ========== */
/* Zoom In */
.ag-hover-zoom a:hover img {
    transform: scale(1.1);
}

/* Zoom Out */
.ag-hover-zoom-out img {
    transform: scale(1.1);
}

.ag-hover-zoom-out a:hover img {
    transform: scale(1);
}

/* Opacity */
.ag-hover-opacity a:hover img {
    opacity: 0.7;
}

/* Grayscale */
.ag-hover-grayscale a:hover img {
    filter: grayscale(100%);
}

/* ========== RESPONSIVO ========== */
@media (max-width: 1024px) {
    .ag-layout-grid .ag-grid,
    .ag-layout-masonry .ag-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .ag-layout-masonry .ag-grid {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .ag-layout-grid .ag-grid,
    .ag-layout-masonry .ag-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .ag-layout-masonry .ag-grid {
        column-count: 1;
    }
    
    .ag-layout-carousel .ag-carousel-item {
        flex: 0 0 250px;
    }
    
    .ag-layout-carousel .ag-carousel-item img {
        height: 250px;
    }
    
    .ag-layout-list .ag-list-item {
        flex-direction: column;
    }
    
    .ag-layout-list .ag-list-image {
        flex: 0 0 auto;
        width: 100%;
    }
    
    .ag-carousel-prev,
    .ag-carousel-next {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
    
    /* Filtros em mobile */
    .ag-filters {
        padding: 15px;
        gap: 8px;
    }
    
    .ag-filter-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .ag-layout-grid .ag-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ag-layout-carousel .ag-carousel-item {
        flex: 0 0 200px;
    }
    
    .ag-layout-carousel .ag-carousel-item img {
        height: 200px;
    }
    
    /* Filtros em mobile pequeno */
    .ag-filter-btn {
        padding: 6px 12px;
        font-size: 12px;
        flex: 1 1 auto;
        min-width: 100px;
    }
}
