/* =============================================
   Advanced Gallery Widget — Main Styles
   ============================================= */

/* ----- Wrapper ----- */
.agw-gallery-wrap {
    width: 100%;
    position: relative;
}

/* ----- Filter Bar ----- */
.agw-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}

.agw-filter-btn {
    padding: 6px 16px;
    font-size: 13px;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.22s ease;
    font-family: inherit;
    line-height: 1.4;
}

.agw-filter-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.agw-filter-btn.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* ----- Item Inner ----- */
.agw-item-inner {
    position: relative;
    overflow: hidden;
    display: block;
    border-radius: 6px;
}

.agw-item-inner img {
    width: 100%;
    display: block;
    transition: transform 0.35s ease;
    border-radius: inherit;
}

/* ----- Hover Effects ----- */
.agw-hover-zoom .agw-item-inner:hover img {
    transform: scale(1.06);
}

.agw-hover-zoomout .agw-item-inner img {
    transform: scale(1.08);
}

.agw-hover-zoomout .agw-item-inner:hover img {
    transform: scale(1.0);
}

.agw-hover-blur .agw-item-inner:hover img {
    filter: blur(3px);
    transform: scale(1.03);
}

/* ----- Overlay ----- */
.agw-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.28s ease;
    cursor: pointer;
    border-radius: inherit;
}

.agw-item-inner:hover .agw-overlay {
    background: rgba(0,0,0,0.45);
}

.agw-overlay-icon {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.25s ease, transform 0.25s ease;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255,255,255,0.5);
}

.agw-item-inner:hover .agw-overlay-icon {
    opacity: 1;
    transform: scale(1);
}

/* ----- Caption ----- */
.agw-caption-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 28px 12px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.6));
    opacity: 0;
    transition: opacity 0.28s ease;
    border-radius: 0 0 6px 6px;
}

.agw-item-inner:hover .agw-caption-wrap {
    opacity: 1;
}

.agw-caption {
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    display: block;
}

/* ----- Masonry Layout ----- */
.agw-masonry {
    column-gap: 12px;
}

.agw-masonry .agw-item {
    break-inside: avoid;
    margin-bottom: 12px;
}

/* ----- Grid Layout ----- */
.agw-grid {
    display: grid;
    gap: 12px;
}

/* ----- Filter Animation ----- */
.agw-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.agw-item.agw-hidden {
    display: none;
}

.agw-item.agw-fade-in {
    animation: agwFadeIn 0.35s ease forwards;
}

@keyframes agwFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================
   Carousel
   ============================================= */
.agw-carousel-outer {
    position: relative;
    overflow: hidden;
}

.agw-carousel-viewport {
    overflow: hidden;
    width: 100%;
}

.agw-carousel-track {
    display: flex;
    transition: transform 0.5s ease;
    gap: 12px;
}

.agw-carousel-slide {
    flex-shrink: 0;
}

.agw-carousel-slide img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    border-radius: 6px;
}

/* Carousel Arrows */
.agw-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: 1px solid #ddd;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.agw-arrow:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}

.agw-arrow-prev { left: 10px; }
.agw-arrow-next { right: 10px; }

/* Dots */
.agw-dots-wrap {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.agw-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.agw-dot.active {
    background: #333;
    transform: scale(1.2);
}

/* =============================================
   Lightbox
   ============================================= */
.agw-lightbox-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,0.88) !important;
    z-index: 9999999 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    margin: 0 !important;
    padding: 0 !important;
}

.agw-lightbox-overlay.agw-lb-open {
    opacity: 1 !important;
    pointer-events: all !important;
}

.agw-lb-container {
    position: relative;
    max-width: 92vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.agw-lb-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 80vh;
}

.agw-lb-img {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    transition: opacity 0.2s ease;
}

.agw-lb-img.agw-loading {
    opacity: 0.4;
}

.agw-lb-close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.agw-lb-close:hover {
    background: rgba(255,255,255,0.25);
}

.agw-lb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.agw-lb-arrow:hover {
    background: rgba(255,255,255,0.22);
}

.agw-lb-prev { left: -60px; }
.agw-lb-next { right: -60px; }

.agw-lb-footer {
    text-align: center;
    margin-top: 12px;
}

.agw-lb-caption {
    color: #ddd;
    font-size: 14px;
    margin: 0 0 4px;
    font-family: inherit;
}

.agw-lb-counter {
    color: #777;
    font-size: 12px;
    margin: 0;
    font-family: inherit;
}

/* =============================================
   RESPONSIVE
   ============================================= */

/* Tablet */
@media (max-width: 1024px) {
    .agw-masonry[data-cols="4"],
    .agw-masonry[data-cols="5"],
    .agw-masonry[data-cols="6"] {
        column-count: 3 !important;
    }

    .agw-grid[data-cols="4"],
    .agw-grid[data-cols="5"],
    .agw-grid[data-cols="6"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .agw-lb-prev { left: -48px; }
    .agw-lb-next { right: -48px; }
}

@media (max-width: 768px) {
    .agw-masonry[data-cols] {
        column-count: 2 !important;
    }

    .agw-grid[data-cols] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .agw-carousel-slide img {
        height: 200px;
    }

    .agw-lb-prev { left: -38px; width: 34px; height: 34px; }
    .agw-lb-next { right: -38px; width: 34px; height: 34px; }

    .agw-lb-close { top: -40px; }
}

/* Mobile */
@media (max-width: 480px) {
    .agw-masonry[data-cols] {
        column-count: 1 !important;
    }

    .agw-grid[data-cols] {
        grid-template-columns: 1fr !important;
    }

    .agw-filter-bar {
        gap: 6px;
    }

    .agw-filter-btn {
        font-size: 12px;
        padding: 5px 12px;
    }

    .agw-carousel-slide img {
        height: 180px;
    }

    .agw-arrow {
        width: 32px;
        height: 32px;
    }

    .agw-lb-prev { left: -30px; width: 30px; height: 30px; }
    .agw-lb-next { right: -30px; width: 30px; height: 30px; }

    .agw-lb-img {
        max-height: 65vh;
    }

    .agw-dots-wrap {
        gap: 5px;
    }
}
