/* ==========================================================
   SELECTED FILTERS (CHIPS)
========================================================== */

.af-controls-wrap {
    position: sticky;
    /* top: var(--af-header-offset, 64px); */
    /* background: #ebebeb; */
    z-index: 25;
    padding-top: 20px;
    padding-bottom: 15px;
    margin-bottom: 10px !important;
}
    

.af-controls-filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: visible;
    white-space: normal;
}

.af-controls-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    margin-top: 25px;
}

.af-sort-orderby-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    padding-right: 20px;
}

.af-sort-orderby {
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid #c9c9c9;
    border-radius: 8px;
    background: #ffffff;
    color: #1f1f1f;
    font-size: 13px;
    line-height: 1.2;
}

.af-sort-loader {
    position: absolute;
    right: -5px;
    top: 50%;
    margin-top: -10px;
    width: 20px;
    height: 20px;
    border: 3px solid transparent;
    border-top-color: #333;
    border-radius: 50%;
    animation: af-spin 0.6s linear infinite;
    display: block;
    pointer-events: none;
    will-change: transform;
    opacity: 0;
    visibility: hidden;
}

.af-sort-orderby-wrap.is-loading .af-sort-loader {
    opacity: 1;
    visibility: visible;
}

.af-controls-section .af-clear-filters-inline {
    align-self: flex-start;
    margin-top: 0;
    margin-bottom: 0;
    padding: 6px 12px;
    background: #464646;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.af-controls-section-actions,
.af-controls-section-selected,
.af-controls-section-common {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
}

.af-controls-section-actions {
    border-left: none;
    padding-left: 0;
}

.af-controls-section-selected {
    position: relative;
    margin-top: 0px; /* messo 0 invece di 14px perchè ho temporaneamente tolto il titolo */
    padding: 14px 12px 10px;
    border: 1px solid #cfcfcf;
    border-radius: 10px;
    background: #f5f5f5;
    overflow: visible;
}

.af-controls-section-title {
    display: block;
    width: 100%;
    font-size: 14px;
    font-weight: 700;
    color: #1f1f1f;
    letter-spacing: 0.01em;
    text-transform: none;
    padding: 0 0 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid #d7d7d7;
}

.af-controls-section-selected > .af-controls-section-title {
    position: absolute;
    top: -23px;
    left: 0px;
    width: auto;
    margin: 0;
    padding: 0 8px;
    border: 0;
    font-size: 13px;
    line-height: 1.4;
    color: #2a2a2a;
    display: none; /* nascosto temporaneamente */
}

.af-controls-section-selected-body {
    display: flex;
    flex-direction: column;
    gap: 0px;
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
}

.af-controls-section-selected-body::-webkit-scrollbar {
    width: 4px;
}

.af-controls-section-selected-body::-webkit-scrollbar-thumb {
    background: #e3e3e3;
    border-radius: 3px;
}

@media (max-width: 767px) {
    .af-controls-toolbar {
        gap: 8px;
    }

    .af-controls-toolbar .af-sort-orderby-wrap {
        flex: 1 1 calc(50% - 4px);
        max-width: calc(50% - 4px);
        padding-right: 0;
    }

    .af-controls-toolbar .af-sort-orderby-wrap:only-child {
        flex-basis: 100%;
        max-width: 100%;
    }

    .af-controls-toolbar .af-sort-orderby {
        width: 100%;
    }

    .af-controls-toolbar .af-sort-loader,
    .af-controls-toolbar .af-sort-orderby-wrap.is-loading .af-sort-loader {
        display: none;
    }

    .af-controls-section .af-clear-filters-inline {
        display: inline-flex;
        flex: 1 1 calc(50% - 4px);
        max-width: calc(50% - 4px);
        justify-content: center;
        align-items: center;
    }
}

.af-controls-filters::-webkit-scrollbar {
    display: none;
}

.af-controls-group {
    border-bottom: 1px solid #dddddd;
    padding: 10px 0;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    position: relative;
    max-width: 100%;
    overflow: visible;
}

.af-controls-group:last-child {
    border-bottom: none;
}

.af-controls-group-title {
    font-size: 12px;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
    min-width: 110px;
    flex-shrink: 0;
}

.af-controls-group-items {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: center;
    align-self: center;
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 767px) {
    .af-controls-group {
        align-items: center;
        gap: 6px;
    }

    .af-controls-group-title {
        /* margin-bottom: 4px; */
    }

    .af-controls-group-items {
        width: 100%;
        padding-right: 12px;
        -ms-overflow-style: none;  /* IE/Edge */
        scrollbar-width: none;     /* Firefox */
    }

    .af-controls-group-items::-webkit-scrollbar {
        display: none;
    }
}

.af-controls-group-items .af-controls-item {
    flex: 0 0 auto;
}

@media (min-width: 768px) {
    #af-sidebar .af-header {
        display: none;
    }


    .af-controls-section .af-controls-wrap {
        position: static;
        top: auto;
        padding: 20px 0 15px;
        /* background: #f5f5f5; */
    }

    .af-controls-section .af-controls-filters {
        padding: 0px;
    }

    .af-controls-filters {
        flex-wrap: wrap;
        overflow-x: visible;
        overflow-y: visible;
        white-space: normal;
    }

    .af-controls-group-items {
        flex-wrap: wrap;
        overflow: visible;
        max-width: none;
    }
}

@media (max-width: 767px) {
    #af-sidebar .af-controls-wrap .af-apply {
        margin: 0 20px 14px;
    }
}

.af-controls-item {
    display: inline-flex;
    align-items: center;
    background: #dbdbdb;
    color: #242424;
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 100px;
    margin: 0 6px 0 0;
    height: 33px;
    line-height: 1.2;
    white-space: nowrap;
}

.af-controls-item:not(.af-controls-item-common):not(.af-controls-item-common-readonly) {
    border: 1px solid #afafaf;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.af-controls-item:not(.af-controls-item-common):not(.af-controls-item-common-readonly):hover {
    background: #d4d4d4;
    border-color: #9a9a9a;
}

.af-controls-item-common-readonly {
    background: #f7f7f7;
    border: 1px solid #d2d2d2;
    cursor: default;
    pointer-events: none;
}

.af-remove-selected {
    margin-left: 3px;
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
    color: #000000;
    opacity: 0.8;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.af-remove-selected:hover {
    opacity: 1;
}

#af-sidebar .af-clear-filters {
    margin-top: 8px;
    padding: 4px 12px;
    font-size: 12px;
    background: #ddd;
    border: 1px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.25s;
    display: block;
}

.af-controls-section .af-clear-filters:hover {
    background: #202020;
    color: white;
}

