/* =========================================================
   Group Grid Block — front-end styles
   Mirrors the layout conventions of the existing
   taxonomy-group.php / cf-grid__wrapper pages.
   ========================================================= */

/* --- Tab row -------------------------------------------- */
.group-grid__tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    padding: 50px 0 0;
    background: transparent;
    justify-content: center;
}

.group-grid-block .group-grid__tab {
    flex: 1 1 0;
    padding: 10px 30px;
    border: none;
    border-radius: 4px;
    background: #0077c8;
    color: #fff;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 24px;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s;
    line-height: normal;
}

.group-grid-block .group-grid__tab:hover {
    background: #8cbb3f;
    color: #fff;
}

.group-grid-block .group-grid__tab.active {
    background: #8cbb3f;
    color: #fff;
}

/* --- Search bar (in sidebar) ---------------------------- */
.group-grid__searchbar {
    margin-bottom: 0;
    width: 100%;
}

.group-grid__searchbar .search-form__wrapper {
    width: 100%;
}

.group-grid__searchbar .facetwp-facet {
    display: flex;
    align-items: center;
    background: rgba(0, 119, 200, 0.1);
    border-radius: 3px;
    overflow: hidden;
    height: 56px;
    width: 100%;
    margin: 0 !important;
}

.group-grid__searchbar input.facetwp-search {
    flex: 1 1 auto;
    border: none !important;
    background: transparent !important;
    padding: 8px 4px 8px 12px;
    font-family: 'Avenir Next', sans-serif;
    font-size: 16px;
    color: #333;
    letter-spacing: 0.5px;
    outline: none;
    box-shadow: none !important;
    height: 100%;
}

.group-grid__searchbar input.facetwp-search::placeholder {
    color: #828282;
}

.group-grid__searchbar .facetwp-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.group-grid__searchbar .facetwp-icon::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230077C8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: none !important;
    border: none;
    border-radius: 0;
}

/* --- Clear-all link — match styling from grid.css on the old groups page */
.group-grid-block .facetwp-facet-clear_all {
    font-size: 16px;
    font-weight: 400;
    color: #3a3a3a;
    margin-bottom: 0;
    text-transform: none;
}

.group-grid-block .facetwp-facet-clear_all a {
    color: #3a3a3a;
    text-decoration: none;
}

.group-grid-block .facetwp-facet-clear_all a:hover {
    text-decoration: underline;
}

/* --- Sort-by row spacing and icon alignment */
.group-grid-block .sort-box {
    margin-top: 10px;
    margin-bottom: 10px;
}

.group-grid-block .sort-component .fs-wrap {
    right: 14px;
}

/* --- Grid wrapper — needed to anchor the spinner overlay */
.group-grid-block .grid-items {
    position: relative;
}

/* --- Grid loading overlay ------------------------------- */
.group-grid__spinner {
    position: absolute;
    inset: 0;
    background: #fff;
    z-index: 10;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 600ms ease-in;
}

.group-grid__spinner.active {
    opacity: 1;
    pointer-events: auto;
}

.group-grid__spinner::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #d0e4f0;
    border-top-color: #00497b;
    border-radius: 50%;
    animation: group-grid-spin 0.7s linear infinite;
}

@keyframes group-grid-spin {
    to { transform: rotate(360deg); }
}

/* =========================================================
   Responsive
   ========================================================= */

/* Tablet / large phone — 2 buttons per row */
@media (max-width: 767px) {
    .group-grid__tabs {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-start;
        padding-top: 30px;
    }

    .group-grid__tab {
        flex: 0 0 calc(50% - 5px);
        font-size: 18px;
        padding: 10px 12px;
    }
}

/* Small phone — full-width buttons, single column */
@media (max-width: 480px) {
    .group-grid__tab {
        flex: 0 0 100%;
        font-size: 20px;
    }
}
