/* Shared filter dropdown component. The menu is absolutely positioned so it
   never changes the height or position of the existing filter bars. */
[data-custom-dropdown] {
    position: relative;
    z-index: 1;
    width: 100%;
    min-width: 0;
}

[data-custom-dropdown].is-open {
    z-index: 100;
}

[data-custom-dropdown] > input[type="hidden"] {
    display: none !important;
}

.custom-dropdown-toggle {
    width: 100%;
    min-height: 48px;
    padding: 0 13px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    outline: none;
    background: #f9fafb;
    color: #111827;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.custom-dropdown-toggle:hover,
[data-custom-dropdown].is-open .custom-dropdown-toggle,
.custom-dropdown-toggle:focus-visible {
    border-color: #9ca3af;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(17, 24, 39, .08);
}

.custom-dropdown-toggle:hover {
    transform: translateY(-1px);
}

.custom-dropdown-toggle:focus-visible {
    outline: 2px solid #2e7d32;
    outline-offset: 2px;
}

.custom-dropdown-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-dropdown-chevron {
    flex: 0 0 auto;
    color: #6b7280;
    font-size: 12px;
    transition: transform .18s ease;
}

[data-custom-dropdown].is-open .custom-dropdown-chevron {
    transform: rotate(180deg);
}

.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    max-height: min(280px, calc(100vh - 24px));
    padding: 7px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .16), 0 2px 8px rgba(15, 23, 42, .06);
}

.custom-dropdown-menu[hidden] {
    display: none !important;
}

.custom-dropdown-option {
    width: 100%;
    min-height: 38px;
    padding: 8px 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #374151;
    font: inherit;
    font-size: 13px;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.custom-dropdown-option:hover,
.custom-dropdown-option:focus-visible,
.custom-dropdown-option[aria-selected="true"] {
    background: #eef7f1;
    color: #166534;
}

.custom-dropdown-option:focus-visible {
    outline: 2px solid #86b99b;
    outline-offset: -2px;
}

.custom-dropdown-option[aria-selected="true"]::after {
    content: "✓";
    flex: 0 0 auto;
    color: #2e7d32;
    font-weight: 800;
}

/* Existing pages use slightly different filter bar shapes. Keep their
   original geometry while sharing the menu behavior and visual language. */
.home-page .custom-dropdown-toggle {
    min-height: 50px;
    border-radius: 999px;
    padding-right: 18px;
    padding-left: 18px;
    background: rgba(255, 255, 255, .94);
    font-size: 14px;
}

.home-page .custom-dropdown-menu {
    border-radius: 14px;
}

.search-card .custom-dropdown-toggle {
    min-height: 48px;
}

@media (max-width: 760px) {
    .custom-dropdown-menu {
        max-height: min(240px, calc(100vh - 18px));
    }
}

@media (hover: none) {
    .custom-dropdown-toggle:hover {
        transform: none;
    }
}

/* Shared marketplace-style search/filter toolbar.  The toolbar is transparent;
   only its search control is a capsule and each filter is text-led. */
.filter-toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1.8fr) repeat(4, max-content);
    align-items: center;
    gap: clamp(16px, 2.4vw, 34px);
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.filter-toolbar:hover {
    transform: none !important;
}

.filter-toolbar .search-box-group {
    min-width: 0;
    height: 56px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 999px;
    background: #e4e5e8;
}

.filter-toolbar .search-box-group .search-input-group {
    min-width: 0;
    height: 100%;
    display: block !important;
}

.filter-toolbar .search-box-group .search-input-group input {
    width: 100%;
    height: 100%;
    padding: 0 18px;
    border: 0;
    outline: 0;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    color: #111827;
    font-size: 14px;
}

.filter-toolbar .search-box-group .search-input-group input:focus,
.filter-toolbar .search-box-group .search-input-group input:focus-visible {
    border: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
}

.filter-toolbar .search-box-group .search-input-group i {
    display: none;
}

.filter-toolbar .search-box-group #search-btn,
.filter-toolbar .search-box-group .search-circle-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #238329;
    color: #fff;
    box-shadow: none;
    cursor: pointer;
}

.filter-toolbar .search-box-group #search-btn span,
.filter-toolbar .search-box-group .search-circle-button span {
    display: none;
}

.filter-toolbar .search-box-group #search-btn:hover,
.filter-toolbar .search-box-group .search-circle-button:hover {
    background: #175f1b;
    transform: scale(1.04);
}

.filter-toolbar > .custom-dropdown {
    width: auto;
    min-width: 0;
    display: block !important;
}

.filter-toolbar > .custom-dropdown .custom-dropdown-toggle {
    width: auto;
    min-width: 0;
    min-height: 42px;
    padding: 7px 0;
    justify-content: flex-start;
    gap: 8px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.filter-toolbar > .custom-dropdown .custom-dropdown-toggle:hover,
.filter-toolbar > .custom-dropdown .custom-dropdown-toggle:focus-visible,
.filter-toolbar > .custom-dropdown .custom-dropdown-toggle[aria-expanded="true"] {
    color: #08752a;
    transform: none;
}

.filter-toolbar > .custom-dropdown .custom-dropdown-toggle:hover .custom-dropdown-chevron,
.filter-toolbar > .custom-dropdown .custom-dropdown-toggle:focus-visible .custom-dropdown-chevron,
.filter-toolbar > .custom-dropdown .custom-dropdown-toggle[aria-expanded="true"] .custom-dropdown-chevron {
    color: #08752a;
}

.filter-toolbar > .custom-dropdown .custom-dropdown-menu {
    min-width: 190px;
}

.sort-bar .custom-dropdown {
    width: auto;
    min-width: 0;
}

.sort-bar .custom-dropdown .custom-dropdown-toggle {
    width: auto;
    min-height: 42px;
    padding: 7px 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #374151;
}

.sort-bar .custom-dropdown .custom-dropdown-toggle:hover,
.sort-bar .custom-dropdown .custom-dropdown-toggle:focus-visible,
.sort-bar .custom-dropdown .custom-dropdown-toggle[aria-expanded="true"] {
    color: #08752a;
    transform: none;
}

@media (max-width: 1100px) {
    .filter-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px 22px;
    }

    .filter-toolbar .search-box-group {
        grid-column: 1 / -1;
    }

    .filter-toolbar > .custom-dropdown .custom-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 9px 4px;
    }
}

@media (max-width: 700px) {
    .filter-toolbar {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .filter-toolbar .search-box-group {
        height: 56px;
        grid-column: auto;
    }

    .filter-toolbar > .custom-dropdown .custom-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
        padding: 10px 2px;
    }

    .filter-toolbar > .custom-dropdown .custom-dropdown-menu {
        right: 0;
        left: 0;
        min-width: 0;
        max-width: calc(100vw - 24px);
    }
}