/* Shared ABC3Cat public toolbar/card safety styles. */
.abc3cat-spaces-toolbar-row,
.abc3cat-accordion-page .abc3search-toolbar {
    position: relative;
}

/* The left toolbar on /cat and /spaces is intentionally the same ABC3Search toolbar. */
.abc3cat-spaces-toolbar-left .abc3search-toolbar {
    margin: 0 !important;
}

/* Centered /spaces filters: keep them in one row on desktop. */
.abc3cat-spaces-filter-center {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}
.abc3cat-spaces-filter-form {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 6px;
    margin: 0;
}
.abc3cat-spaces-filter-form .form-control {
    display: inline-block !important;
    width: auto !important;
    max-width: 150px;
}

/* Never let card-mode output show inside toolbar create/dropdown menus. */
.abc3search-toolbar .dropdown-menu .abc3cat-card-visual-header,
.abc3cat-spaces-toolbar-row .dropdown-menu .abc3cat-card-visual-header,
.abc3search-toolbar .dropdown-menu .abc3cat-space-links,
.abc3cat-spaces-toolbar-row .dropdown-menu .abc3cat-space-links {
    display: none !important;
}

@media (max-width: 767px) {
    .abc3cat-spaces-filter-form .form-control {
        max-width: 126px;
        font-size: 12px;
    }
}

/* ABC3Cat v29 reusable mobile category drawer.
   This is intentionally generic enough to reuse later in abc3map. */
@media (max-width: 991px) {
    body.abc3cat-mobile-sidebar-open {
        overflow: hidden !important;
    }
    .abc3cat-mobile-category-toggle {
        display: inline-block !important;
        margin: 6px 0 8px 0 !important;
    }
    .abc3cat-mobile-category-backdrop {
        display: none !important;
        position: fixed !important;
        inset: 0 !important;
        background: rgba(0, 0, 0, .35) !important;
        z-index: 300000 !important;
    }
    body.abc3cat-mobile-sidebar-open .abc3cat-mobile-category-backdrop {
        display: block !important;
    }
    .abc3cat-desktop-layout {
        display: block !important;
        margin-top: 6px !important;
    }
    .abc3cat-desktop-layout .abc3cat-left-pane {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: -88vw !important;
        right: auto !important;
        width: 86vw !important;
        max-width: 360px !important;
        height: 100vh !important;
        max-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        background: #fff !important;
        padding: 12px !important;
        z-index: 300010 !important;
        box-shadow: 4px 0 18px rgba(0, 0, 0, .22) !important;
        transition: left .22s ease-in-out !important;
        -webkit-overflow-scrolling: touch !important;
    }
    body.abc3cat-mobile-sidebar-open .abc3cat-desktop-layout .abc3cat-left-pane {
        left: 0 !important;
    }
    .abc3cat-desktop-layout .abc3cat-right-pane {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 240px !important;
    }
    .abc3cat-spaces-panel-mobile-results,
    .abc3cat-desktop-layout .abc3cat-right-pane > .abc3cat-spaces-panel {
        display: block !important;
        margin: 0 0 8px 0 !important;
    }
}

/* ABC3Cat v30: mobile toolbar must match abc3map.
   Desktop remains unchanged. On mobile, category drawer hamburger sits before search
   and toolbar labels are hidden so all directory icons fit in one row. */
@media (max-width: 767px) {
    .abc3cat-accordion-page .abc3search-toolbar {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .abc3cat-accordion-page .abc3search-toolbar > .btn,
    .abc3cat-accordion-page .abc3search-toolbar > a.btn,
    .abc3cat-accordion-page .abc3search-toolbar > button.btn,
    .abc3cat-accordion-page .abc3search-toolbar > .btn-group > .btn,
    .abc3cat-accordion-page .abc3search-toolbar .abc3cat-mobile-category-toggle {
        font-size: 0 !important;
        min-width: 34px !important;
        height: 34px !important;
        padding: 6px 9px !important;
        line-height: 20px !important;
        margin: 0 !important;
        white-space: nowrap !important;
        flex: 0 0 auto !important;
    }

    .abc3cat-accordion-page .abc3search-toolbar .fa,
    .abc3cat-accordion-page .abc3search-toolbar .glyphicon {
        font-size: 14px !important;
        line-height: 20px !important;
        margin: 0 !important;
    }

    .abc3cat-accordion-page .abc3search-toolbar .caret {
        margin-left: 0 !important;
    }

    .abc3cat-accordion-page .abc3search-toolbar .abc3cat-mobile-category-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        order: -100 !important;
    }

    .abc3cat-accordion-page .abc3search-toolbar .abc3search-inline-search-open,
    .abc3cat-accordion-page .abc3search-toolbar [aria-label="Search"],
    .abc3cat-accordion-page .abc3search-toolbar [title="Search"] {
        order: -90 !important;
    }

    .abc3cat-mobile-category-toggle {
        display: none;
    }
}

/* ABC3Cat v31: the category drawer toggle is rendered in the toolbar server-side,
   before the search icon. Keep it icon-only on mobile and hidden on desktop. */
@media (min-width: 768px) {
    .abc3cat-accordion-page .abc3search-toolbar .abc3cat-mobile-category-toggle {
        display: none !important;
    }
}
@media (max-width: 767px) {
    .abc3cat-accordion-page .abc3search-toolbar .abc3cat-mobile-category-toggle {
        display: inline-flex !important;
        order: -100 !important;
    }
    .abc3cat-accordion-page .abc3search-toolbar .abc3cat-mobile-category-toggle-label {
        display: none !important;
    }
}


/* ABC3Cat v32: mobile-only create modal/dropdown stacking.
   The mobile category drawer uses a very high z-index, so the shared
   ABC3Search Create modal/dropdown must sit above it only on mobile. */
@media (max-width: 767px) {
    body.abc3cat-page-active #abc3searchCreateModal,
    .abc3cat-accordion-page #abc3searchCreateModal,
    body.abc3cat-page-active .modal#abc3searchCreateModal,
    .abc3cat-accordion-page .modal#abc3searchCreateModal {
        z-index: 500020 !important;
    }

    body.abc3cat-page-active .modal-backdrop,
    body.abc3cat-page-active .modal-backdrop.in,
    body.abc3cat-page-active .modal-backdrop.show {
        z-index: 500010 !important;
    }

    .abc3cat-accordion-page .abc3search-toolbar,
    .abc3cat-accordion-page .abc3search-toolbar .btn-group,
    .abc3cat-accordion-page .abc3search-toolbar .dropdown,
    .abc3cat-accordion-page .abc3search-toolbar .open,
    .abc3cat-accordion-page .abc3search-toolbar .show {
        overflow: visible !important;
    }

    .abc3cat-accordion-page .abc3search-toolbar .dropdown-menu,
    .abc3cat-accordion-page .abc3search-toolbar .open > .dropdown-menu,
    .abc3cat-accordion-page .abc3search-toolbar .show > .dropdown-menu {
        z-index: 500030 !important;
    }
}

/* ABC3Cat v36: Move up/down remain real POST forms, but look like normal dropdown items. */
.abc3cat-category-actions-menu {
    min-width: 170px !important;
}
.abc3cat-category-actions-menu > li > .abc3cat-category-post-form {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}
.abc3cat-category-actions-menu > li > .abc3cat-category-post-form > .abc3cat-category-post-submit {
    display: block !important;
    width: 100% !important;
    min-width: 170px !important;
    padding: 3px 20px !important;
    clear: both !important;
    font: inherit !important;
    line-height: 1.42857143 !important;
    color: #333 !important;
    white-space: nowrap !important;
    text-align: left !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}
.abc3cat-category-actions-menu > li > .abc3cat-category-post-form > .abc3cat-category-post-submit:hover,
.abc3cat-category-actions-menu > li > .abc3cat-category-post-form > .abc3cat-category-post-submit:focus {
    color: #262626 !important;
    text-decoration: none !important;
    background-color: #f5f5f5 !important;
    outline: none !important;
}

/* ABC3Cat v36: visual space-card area and title are links; description remains selectable. */
.abc3cat-card-visual-link {
    display: block !important;
    color: inherit !important;
    text-decoration: none !important;
    cursor: pointer !important;
}
.abc3cat-card-visual-link:hover,
.abc3cat-card-visual-link:focus {
    text-decoration: none !important;
    filter: brightness(0.98);
}
.abc3cat-space-description {
    user-select: text !important;
    -webkit-user-select: text !important;
}
.abc3cat-space-links {
    margin-bottom: 4px !important;
}
.abc3cat-space-share-row {
    margin-top: 4px !important;
    user-select: none !important;
}
.abc3cat-share-links {
    display: inline-flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
    vertical-align: middle !important;
}
.abc3cat-share-label {
    font-size: 11px !important;
    color: #777 !important;
    margin-right: 2px !important;
}
.abc3cat-share-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 22px !important;
    height: 22px !important;
    line-height: 22px !important;
    padding: 0 !important;
    border: 1px solid #ddd !important;
    border-radius: 3px !important;
    background: #fff !important;
    color: #555 !important;
    text-decoration: none !important;
    font-size: 12px !important;
    box-shadow: none !important;
}
.abc3cat-share-link:hover,
.abc3cat-share-link:focus {
    border-color: #337ab7 !important;
    color: #337ab7 !important;
    background: #f7fbff !important;
    text-decoration: none !important;
    outline: none !important;
}
.abc3cat-share-copy.abc3cat-share-copied {
    border-color: #3c763d !important;
    color: #3c763d !important;
    background: #f4fbf4 !important;
}



/* ABC3Cat v38: compact category share buttons in the selected category result header only. */
.abc3cat-category-share-buttons {
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
    margin-left: 6px !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    user-select: none !important;
}
.abc3cat-category-share-buttons .abc3cat-share-link {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    margin: 0 !important;
}
.abc3cat-category-share-heading {
    margin-right: 8px !important;
}
@media (max-width: 767px) {
    .abc3cat-category-share-heading {
        display: inline-flex !important;
        margin: 5px 0 0 0 !important;
    }
}


/* ABC3Cat v39: keep left category action button/menu clickable after share cleanup. */
.abc3cat-left-pane .abc3cat-category-actions,
.abc3cat-left-pane .abc3cat-category-actions > .dropdown-toggle,
.abc3cat-left-pane .abc3cat-category-actions-menu,
.abc3cat-left-pane .abc3cat-category-actions-menu a,
.abc3cat-left-pane .abc3cat-category-actions-menu button {
    pointer-events: auto !important;
}
.abc3cat-left-pane .abc3cat-category-actions {
    flex-shrink: 0 !important;
    z-index: 50 !important;
}
.abc3cat-left-pane .abc3cat-category-actions.open,
.abc3cat-left-pane .abc3cat-category-actions.show {
    z-index: 300110 !important;
}
.abc3cat-left-pane .abc3cat-open-spaces {
    position: relative !important;
    z-index: 1 !important;
}


/* ABC3Cat v40: category action menus are rendered in a body-level portal so deeply nested categories cannot be clipped by the left pane. */
.abc3cat-category-actions.abc3cat-menu-portal-active > .dropdown-menu,
.abc3cat-category-actions.abc3cat-menu-portal-active > .abc3cat-category-actions-menu {
    display: none !important;
}
.abc3cat-category-actions-menu-portal {
    display: block !important;
    position: fixed !important;
    min-width: 210px !important;
    padding: 6px 0 !important;
    z-index: 500200 !important;
    list-style: none !important;
    margin: 0 !important;
    background: #fff !important;
    border: 1px solid rgba(0,0,0,.15) !important;
    border-radius: 4px !important;
    box-shadow: 0 6px 12px rgba(0,0,0,.175) !important;
}
.abc3cat-category-actions-menu-portal > li > a {
    display: block !important;
    padding: 7px 16px !important;
    clear: both !important;
    font-weight: normal !important;
    line-height: 1.42857143 !important;
    color: #333 !important;
    white-space: nowrap !important;
    text-decoration: none !important;
}
.abc3cat-category-actions-menu-portal > li > a:hover,
.abc3cat-category-actions-menu-portal > li > a:focus {
    color: #262626 !important;
    background-color: #f5f5f5 !important;
    text-decoration: none !important;
}
.abc3cat-category-actions-menu-portal .divider {
    height: 1px !important;
    margin: 6px 0 !important;
    overflow: hidden !important;
    background-color: #e5e5e5 !important;
}
.abc3cat-category-actions-menu-portal .abc3cat-category-post-form {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
}
.abc3cat-category-actions-menu-portal .abc3cat-category-post-submit {
    display: block !important;
    width: 100% !important;
    min-width: 210px !important;
    padding: 7px 16px !important;
    font: inherit !important;
    line-height: 1.42857143 !important;
    color: #333 !important;
    white-space: nowrap !important;
    text-align: left !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.abc3cat-category-actions-menu-portal .abc3cat-category-post-submit:hover,
.abc3cat-category-actions-menu-portal .abc3cat-category-post-submit:focus {
    color: #262626 !important;
    background-color: #f5f5f5 !important;
    outline: none !important;
}


/* ABC3Cat v41: keep space-card action links and social share icons pinned to the bottom. */
.abc3cat-space-grid > .abc3cat-space-card,
.abc3cat-space-card.abc3cat-spaces-directory-card,
.card-panel.abc3cat-spaces-directory-card.abc3cat-space-card {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}
.abc3cat-space-card .abc3cat-space-card-inner,
.abc3cat-spaces-directory-card .abc3cat-space-card-inner {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
}
.abc3cat-space-card .abc3cat-space-links,
.abc3cat-spaces-directory-card .abc3cat-space-links {
    margin-top: auto !important;
    margin-bottom: 4px !important;
}
.abc3cat-space-card .abc3cat-space-share-row,
.abc3cat-spaces-directory-card .abc3cat-space-share-row {
    margin-top: 0 !important;
    padding-top: 0 !important;
}
