/* Gallery Filters Styles */
section.gallerysg {
    margin-top: 26px;
}
/* Gallery Controls Wrapper */
.gallery-controls-wrapper {
    width: 100%;
    margin: 0 auto;
}

/* Desktop Filter Layout */
#galcontrols {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    padding: 24px 0;
    position: relative;
    gap: 0;
}

/* Main Filter Row */
.filter-main-row {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    justify-content: center;
}

.filter_item {
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-radius: 150px;
    border: 2px solid #093449;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex: 1;
}

.filter_item:hover {
    border-color: #56AFCB;
    color: #56AFCB;
}

.filter_item.active {
    border: 2px solid #093449;
    background: #D6EDF2;
}

/* Selected filter state */
.filter_item.has-active-filter {
    border: 2px solid #093449;
    background: #D6EDF2;
    color: #56AFCB;
}

.gal_filter_title span {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Roboto;
    font-size: 18px;
    font-style: normal;
    font-weight: 500;
    line-height: 160%;
    color: #004054;
    white-space: nowrap;
    text-align: center;
    transition: all 0.3s ease;
    width: 100%;
    height: 100%;
    position: relative;
    padding: 17px 38px;
}
.filter_item:hover span{
    color: #56AFCB;
}

/* Clear All button styles */
.filter_item.filter_reset {
    opacity: 0.5;
    cursor: not-allowed;
    transition: all 0.3s ease;
}

.filter_item.filter_reset.active {
    opacity: 1;
    cursor: pointer;
    border: 2px solid #56AFCB;
    background: white;
}

.filter_item.filter_reset.active span {
    text-decoration: underline;
    color: #56AFCB;
}
/* Close button (SVG) positioning */
.gal_filter_title img {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    width: 25px;
    height: 25px;
    display: none;
    transition: all 0.3s ease;
}

/* Show close button only when filter is selected */
.filter_item.has-active-filter .gal_filter_title img {
    display: block;
}

/* Hide dropdown arrow styles - not needed with new design */
.filter_item:not(.has-active-filter) .gal_filter_title svg {
    display: none;
}

.filter_item.active:not(.has-active-filter) .gal_filter_title svg {
    display: none;
}

/* Filter Options Row */
.filter-options-row {
    width: 100%;
    margin-top: 0px;
    margin-bottom: 0px;
    visibility: hidden;
    opacity: 0;
    overflow: hidden;
    max-height: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.gal_filter_title {
    width: 100%;
}
.filter-options-row.active {
    visibility: visible;
    opacity: 1;
    margin-top: 25px;
    max-height: 200px;
    margin-bottom: 0px;
}

.filter-options-container {
    display: flex !important;
    width: 100%;
    gap: 25px;
    flex-wrap: wrap;
    height: 0;
    overflow: hidden;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Special layout for time-afters filter - 8 columns */
.filter-options-container[data-filter="time-afters"] {
    display: grid !important;
    grid-template-columns: repeat(8, 1fr);
    gap: 15px;
}

.filter-options-container[data-filter="time-afters"] .selectionrow {
    flex: none;
    width: auto;
    text-align: center;
}

.filter-options-container.active {
    height: auto;
}

.selectionrow {
    padding: 14px 29px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-style: normal;
    font-weight: 400;
    line-height: 160%;
    color: #595857;
    transition: all 0.2s ease;
    background: #ffffff;
    border: 1px solid #595857!important;
    border-radius: 6px;
    white-space: nowrap;
    flex: 1;
    display: flex;
    margin:0;
}

.selectionrow:hover {
    background: #D6EDF2;
}

.selectionrow.active {
    border-radius: 8px;
    background: #D6EDF2;
    color: #595857;
    font-weight: 400;
}

/* Disabled filter options (0 count) */
.selectionrow[data-count="0"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.selectionrow[data-count="0"]:hover {
    background: #F5F5F5;
    border-color: #D0D0D0 !important;
}

/* Sticky filters - prevent content jumping */
body.has-sticky-filters #galcontrols {
    margin-bottom: 120px; /* Reserve space for sticky filters */
}

.gallery-controls-wrapper.sticky-wrapper {
    position: fixed;
    top: 129px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid #E5E7EB;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
    padding: 24px 0px;
    margin: 0;
}
.gallery-controls-wrapper.sticky-wrapper #galcontrols{
    width: 90% !important;
    margin: 0 auto;
    max-width: 1440px;
}

.gallery-controls-wrapper.sticky-wrapper #galcontrols {
    padding: 0;
}

.gallery-controls-wrapper.sticky-wrapper .filter-separator {
    display: none; /* Hide separator when sticky */
}

/* Remove old selected filter display - using toggle style now */

/* Filter Separator */
.filter-separator {
    margin-top: 50px;
    width: 100%;
    height: 2px;
    background: #004054;
}

/* Responsive breakpoints */
@media (max-width: 1240px) {
    #galcontrols {
        padding: 24px 20px;
    }

    #galcontrols.sticky-filters {
        padding: 16px 20px;
    }
}

/* Mobile Filter Overlay Styles */
.gallery-filters-mob-overlay {
    position: fixed;
    left: 0;
    bottom: 0;
    height: fit-content;
    width: 100%;
    z-index: 99999;
    display: none;
}

.gallery-filters-mob-overlay.sticky {
    display: flex !important;
}

.gallery-filters-mob-overlay.mobile-filters-show {
    height: 100%;
    display: flex !important;
    flex-direction: column;
    justify-content: flex-end;
    background-color: rgba(9, 52, 73, 0.3);
    backdrop-filter: blur(4px);
}

.mobile-gallery-filters {
    width: 100%;
    background: #FFFFFF;
    box-shadow: 0 0 23.8px 0 rgba(9, 52, 73, 0.12);
    border-radius: 25px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 16px 20px;
}

.filter-list-title {
    display: none;
}

.mobile-filters-show .filter-list-title {
    font-family: 'gill-sans-nova', sans-serif;
    display: block;
    letter-spacing: -0.005em;
    text-transform: capitalize;
    color: #16435A;
    margin-bottom: 15px;
    font-size: 20px;
    font-style: normal;
    font-weight: 500;
    line-height: 160%;
}

.mobile-filter-content {
    display: none;
    max-height: 410px;
    overflow-y: auto;
    margin-bottom: 26px;
}

.mobile-filters-show .mobile-filter-content {
    display: block;
}

/* Mobile Dropdown Container */
.mobile-dropdown-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Mobile Filter Dropdown */
.mobile-filter-dropdown {
    position: relative;
    width: 100%;
}

/* Mobile Filter Button - styled like desktop filter_item */
.mobile-filter-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    border-radius: 150px;
    border: 2px solid #093449;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #004054;
    width: 100%;
    position: relative;
}

.mobile-filter-button:hover {
    border-color: #56AFCB;
    color: #56AFCB;
}

.mobile-filter-button:hover svg path {
    stroke: #56AFCB;
}

.mobile-filter-dropdown.active .mobile-filter-button {
    border: 2px solid #093449;
    background: #D6EDF2;
    z-index: 99;
}

.mobile-filter-dropdown.has-active-filter .mobile-filter-button {
    border: 2px solid #093449;
    background: #D6EDF2;
    color: #56AFCB;
}

/* Dropdown arrow animation */
.mobile-filter-button svg {
    transition: transform 0.3s ease;
}

.mobile-filter-dropdown.active .mobile-filter-button svg {
    transform: rotate(180deg);
}

/* Mobile Dropdown Options */
.mobile-dropdown-options {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    border-radius: 8px;
    z-index: 1000;
    max-height: 220px;
    overflow-y: auto;
    padding: 8px;
    margin-top: 0;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 30px 30px 18px 18px;
    border: 1px solid #093449;
    background: #FFF;
    z-index: 98;
    box-shadow: 0 0 8.3px 0 rgba(0, 0, 0, 0.20);
    padding-top: 60px;
}

.mobile-filter-dropdown.active .mobile-dropdown-options {
    display: block;
    opacity: 1;
    transform: translateY(0);
    overflow-y: scroll;
    overflow-x: hidden;
}


.mobile-dropdown-options .selectionrow:last-child {
    border-bottom: none;
}

.mobile-dropdown-options .selectionrow:hover {
    background: #F9FAFB;
    color: #56AFCB;
}

.mobile-dropdown-options .selectionrow.active {
    background: #F0F9FB;
    color: #56AFCB;
    font-weight: 500;
}

/* Mobile Clear All Link */
.mobile-clear-all-container {
    padding-top: 16px;
    text-align: center;
}

.mobile-clear-all-button {
    display: inline;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #595857;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.5;
    text-decoration: none;
}

.mobile-clear-all-button.active {
    opacity: 1;
    cursor: pointer;
    color: #56AFCB;
    text-decoration: underline;
}

.mobile-clear-all-button.active:hover {
    color: #004054;
}

.mob-filter-nav {
    display: flex;
    justify-content: center;
}

.mobile-filters-show .mob-filter-nav {
    padding-top: 16px;
    border-top: 1px solid;
}

.mob-filter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    padding-left: 20px;
}

.mob-filter-title span {
    font-family: 'gill-sans-nova', sans-serif;
    font-style: normal;
    font-weight: 500;
    font-size: 15.5817px;
    line-height: 111.4%;
    letter-spacing: -0.005em;
    text-transform: capitalize;
    color: #16435A;
}

.mob-filter-toggle {
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.mobile-filters-show .mob-filter-toggle {
    transform: rotate(180deg);
}

/* Mobile filter content scrollbar */
.mobile-filter-content::-webkit-scrollbar {
    width: 4px;
    height: calc(100% - 15px);
    border-radius: 0px;
    border: none;
    background-color: #D1DFE6;
}

.mobile-filter-content::-webkit-scrollbar-thumb {
    background-color: #AFB8C2;
    border-radius: 2px;
}

/* Desktop responsive adjustments */
@media (max-width: 1240px) {
    #galcontrols {
        margin: 0 20px;
    }

    .sticky-filters {
        padding: 16px 20px;
    }
}

@media (max-width: 768px) {
    /* Hide desktop filters on mobile */
    #galcontrols {
        display: none;
    }

    .sticky-filters {
        display: none;
    }
    .mobile-dropdown-options .selectionrow {
        padding: 12px 22px;
        background: transparent;
        font-family: 'Roboto', sans-serif;
        font-size: 16px;
        text-align: left;
        cursor: pointer;
        transition: all 0.2s ease;
        margin: 0;
        display: block;
        border: 0 !important;
        width: 100%;
    }
    .selectionrow br {
        display: none;
    }
}

/* Scrollbar styling for filter dropdowns */
.childfiltersect::-webkit-scrollbar {
    width: 4px;
}

.childfiltersect::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 4px;
}

.childfiltersect::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

.childfiltersect::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Smooth Animations and Transitions */

/* Filter dropdown animation */
@keyframes filterSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 300px;
    }
}

@keyframes filterSlideUp {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 300px;
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
}

.childfiltersect {
    animation: filterSlideUp 0.3s ease-out;
}

.childfiltersect.active {
    animation: filterSlideDown 0.3s ease-out;
}

/* Mobile overlay animations */
@keyframes mobileOverlaySlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes mobileOverlaySlideDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

.mobile-gallery-filters {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-filters-mob-overlay.sticky:not(.mobile-filters-show) .mobile-gallery-filters {
    transform: translateY(0);
    animation: stickyButtonSlideUp 0.3s ease-out;
}

.gallery-filters-mob-overlay:not(.sticky):not(.mobile-filters-show) .mobile-gallery-filters,
.gallery-filters-mob-overlay:not(.mobile-filters-show):not(.sticky) .mobile-gallery-filters {
    transform: translateY(100%);
}

.gallery-filters-mob-overlay.mobile-filters-show .mobile-gallery-filters {
    animation: mobileOverlaySlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
}

/* Selected filter indicator animation */
@keyframes indicatorPop {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(10px);
    }
    50% {
        transform: scale(1.1) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.movable_title_last {
    animation: indicatorPop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Sticky transition animation */
.sticky-filters {
    animation: stickySlideDown 0.3s ease-out;
}

@keyframes stickySlideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile sticky button animation - handled above */

@keyframes stickyButtonSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Loading state animations */
.allgalleries {
    transition: opacity 0.3s ease;
}

.filter-loading {
    position: relative;
}

.filter-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #E5E7EB;
    border-top: 2px solid #56AFCB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive animation adjustments */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
