/* ==========================================================================
   Filterable Gallery - Main Styles
   ========================================================================== */

.fg-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

/* Fullwidth Mode */
.fg-fullwidth {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.fg-fullwidth .fg-gallery-grid,
.fg-fullwidth .fg-gallery-slider {
    padding: 0 20px;
}

@media (min-width: 1200px) {
    .fg-fullwidth .fg-gallery-grid,
    .fg-fullwidth .fg-gallery-slider {
        padding: 0 40px;
    }
}

/* ==========================================================================
   Filters
   ========================================================================== */

.fg-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 30px;
    padding: 20px 0;
}

.fg-filter-button {
    padding: 10px 25px;
    margin: 5px 10px;
    background-color: #f5f5f5;
    color: #333333;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    outline: none;
    text-transform: capitalize;
}

.fg-filter-button:hover {
    background-color: #333333;
    color: #ffffff;
    transform: translateY(-2px);
}

.fg-filter-button.active {
    background-color: #0073e6;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 115, 230, 0.3);
}

@media (max-width: 768px) {
    .fg-filters {
        margin-bottom: 20px;
    }

    .fg-filter-button {
        padding: 8px 18px;
        margin: 4px 6px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Gallery Grid Layout
   ========================================================================== */

.fg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

@media (max-width: 1024px) {
    .fg-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .fg-gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ==========================================================================
   Gallery Items
   ========================================================================== */

.fg-gallery-item {
    position: relative;
    overflow: hidden;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.fg-gallery-item.fg-hidden {
    opacity: 0;
    transform: scale(0.8);
    height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.fg-gallery-item.fg-show {
    opacity: 1;
    transform: scale(1);
}

.fg-gallery-item.fg-animated {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fg-item-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.fg-item-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

/* Image Ratios */
.fg-ratio-1_1 {
    padding-bottom: 100%; /* 1:1 */
}

.fg-ratio-4_3 {
    padding-bottom: 75%; /* 4:3 */
}

.fg-ratio-3_4 {
    padding-bottom: 133.33%; /* 3:4 */
}

.fg-ratio-16_9 {
    padding-bottom: 56.25%; /* 16:9 */
}

.fg-ratio-9_16 {
    padding-bottom: 177.78%; /* 9:16 */
}

.fg-ratio-original {
    padding-bottom: 0;
}

.fg-ratio-original img {
    position: static;
    height: auto;
}

.fg-item-wrapper:not(.fg-ratio-original) img {
    position: absolute;
    top: 0;
    left: 0;
}

/* ==========================================================================
   Hover Effects
   ========================================================================== */

/* Zoom Effect */
.fg-hover-zoom .fg-gallery-item:hover img,
.fg-hover-zoom .fg-slide:hover img {
    transform: scale(1.1);
}

/* Overlay Effect */
.fg-gallery-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
    padding: 20px;
    text-align: center;
}

.fg-hover-overlay .fg-gallery-item:hover .fg-gallery-item-overlay,
.fg-hover-overlay .fg-slide:hover .fg-gallery-item-overlay {
    opacity: 1;
}

.fg-item-title {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.fg-item-description {
    color: #ffffff;
    font-size: 14px;
    margin: 0;
    opacity: 0.9;
}

/* Fade Effect */
.fg-hover-fade .fg-gallery-item:hover img,
.fg-hover-fade .fg-slide:hover img {
    opacity: 0.7;
}

/* ==========================================================================
   Slider Layout
   ========================================================================== */

.fg-gallery-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 20px 0;
}

.fg-slides-wrapper {
    display: flex;
    gap: 20px;
    transition: transform 0.5s ease;
    align-items: stretch;
}

.fg-slide {
    flex: 0 0 100%;
    max-width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    display: none;
}

.fg-slide.fg-active {
    display: block;
}

.fg-slide.fg-visible {
    opacity: 1;
    visibility: visible;
}

/* Multiple slides per view */
.fg-slides-wrapper[data-slides="2"] .fg-slide {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
}

.fg-slides-wrapper[data-slides="3"] .fg-slide {
    flex: 0 0 calc(33.333% - 13.33px);
    max-width: calc(33.333% - 13.33px);
}

.fg-slides-wrapper[data-slides="4"] .fg-slide {
    flex: 0 0 calc(25% - 15px);
    max-width: calc(25% - 15px);
}

.fg-slides-wrapper[data-slides="5"] .fg-slide {
    flex: 0 0 calc(20% - 16px);
    max-width: calc(20% - 16px);
}

.fg-slides-wrapper[data-slides="6"] .fg-slide {
    flex: 0 0 calc(16.666% - 16.67px);
    max-width: calc(16.666% - 16.67px);
}

/* Slider fullwidth - para 1 slide */
.fg-layout-slider .fg-slide .fg-item-wrapper {
    width: 100%;
    height: 70vh;
    padding-bottom: 0 !important;
}

.fg-layout-slider .fg-slide .fg-item-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   Slider Navigation
   ========================================================================== */

.fg-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.5);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    font-size: 20px;
}

.fg-nav-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.fg-nav-button.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.fg-nav-button.disabled:hover {
    transform: translateY(-50%) scale(1);
}

.fg-prev {
    left: -60px;
}

.fg-next {
    right: -60px;
}

.fg-fullwidth .fg-prev {
    left: 10px;
}

.fg-fullwidth .fg-next {
    right: 10px;
}

@media (max-width: 1024px) {
    .fg-prev {
        left: 10px;
    }

    .fg-next {
        right: 10px;
    }
}

@media (max-width: 768px) {
    .fg-nav-button {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .fg-prev {
        left: 5px;
    }

    .fg-next {
        right: 5px;
    }
}

/* ==========================================================================
   Pagination (Dots)
   ========================================================================== */

.fg-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 25px;
    gap: 8px;
}

.fg-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.fg-dot:hover {
    background-color: rgba(0, 0, 0, 0.5);
    transform: scale(1.2);
}

.fg-dot.active {
    background-color: #0073e6;
    width: 25px;
    border-radius: 5px;
}

@media (max-width: 768px) {
    .fg-pagination {
        margin-top: 15px;
        gap: 6px;
    }

    .fg-dot {
        width: 8px;
        height: 8px;
    }

    .fg-dot.active {
        width: 20px;
    }
}

/* ==========================================================================
   Masonry Layout
   ========================================================================== */

.fg-layout-masonry .fg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 20px;
}

.fg-layout-masonry .fg-gallery-item {
    grid-row-end: span 15;
}

@media (max-width: 768px) {
    .fg-layout-masonry .fg-gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.fg-container.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #0073e6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 100;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.fg-filter-button:focus,
.fg-nav-button:focus {
    outline: 2px solid #0073e6;
    outline-offset: 2px;
}

.fg-gallery-item:focus-within {
    outline: 2px solid #0073e6;
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .fg-gallery-item,
    .fg-nav-button,
    .fg-filter-button,
    .fg-item-wrapper img,
    .fg-gallery-item-overlay {
        transition: none;
    }

    .fg-gallery-item.fg-animated {
        animation: none;
    }

    @keyframes fadeInUp {
        from,
        to {
            opacity: 1;
            transform: none;
        }
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
    .fg-filter-button {
        border: 2px solid currentColor;
    }

    .fg-nav-button {
        background-color: #000;
        border: 2px solid #fff;
    }

    .fg-dot {
        border: 2px solid currentColor;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .fg-filters,
    .fg-nav-button,
    .fg-pagination {
        display: none;
    }

    .fg-gallery-item.fg-hidden,
    .fg-slide:not(.fg-visible) {
        display: none;
    }

    .fg-gallery-grid {
        break-inside: avoid;
    }

    .fg-gallery-item {
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.fg-container * {
    box-sizing: border-box;
}

.fg-gallery-item img,
.fg-slide img {
    max-width: 100%;
    height: auto;
}

/* Clearfix */
.fg-container::after {
    content: '';
    display: table;
    clear: both;
}

