.c-table-search {
    width: 400px;
    max-width: 100%;
    min-width: 0;
    height: 32px;
    flex: 1 1 400px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 6px;
    background: var(--color-surface-primary);
    position: relative;
}

.c-table-search:focus-within {
    outline: 2px solid var(--color-brand-primary);
    outline-offset: 2px;
}

.c-table-search__icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-primary);
    color: var(--color-icon-muted);
    border: 1px solid var(--color-border-primary);
    border-right: 1px solid transparent;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.c-table-search__icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.c-table-search__icon path {
    fill: currentColor;
}

.c-table-search__scope-wrapper {
    flex: 0 0 auto;
    min-width: fit-content;
    position: relative;
}

.c-table-search__scope {
    width: fit-content;
    max-width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 0;
    background: var(--color-surface-hover);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1;
    border: 1px solid var(--color-border-primary);
}

.c-table-search__scope:hover {
    background: var(--color-surface-secondary);
}

.c-table-search__scope:focus-visible,
.c-table-search__option:focus-visible,
.c-table-search__input:focus-visible {
    outline: none;
}

.c-table-search__scope-label,
.c-table-search__option-label {
    display: block;
    white-space: nowrap;
}

.c-table-search__scope-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transform: rotate(90deg);
    transition: transform linear 0.2s;
}

.c-table-search__scope-icon svg {
    display: block;
}

.c-table-search__scope-icon path {
    fill: currentColor;
}

.c-table-search.is-open .c-table-search__scope-icon {
    transform: rotate(-90deg);
}

.c-table-search__input {
    width: 100%;
    min-width: 0;
    height: 32px;
    flex: 1 1 auto;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1;
    border: 1px solid var(--color-border-primary);
    border-left: 1px solid transparent;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.c-table-search__input::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
}

.c-table-search__input::-webkit-search-decoration,
.c-table-search__input::-webkit-search-cancel-button,
.c-table-search__input::-webkit-search-results-button,
.c-table-search__input::-webkit-search-results-decoration {
    display: none;
    -webkit-appearance: none;
}

.c-table-search__input::-ms-clear,
.c-table-search__input::-ms-reveal {
    display: none;
    width: 0;
    height: 0;
}

.c-table-search__dropdown {
    min-width: max(100%, 180px);
    max-width: min(280px, calc(100vw - 32px));
    padding: 8px;
    border: 1px solid var(--color-border-primary);
    border-radius: 12px;
    background: var(--color-surface-primary);
    box-shadow: var(--shadow-elevation-card);
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 95;
}

.c-table-search__dropdown[hidden] {
    display: none;
}

.c-table-search__option {
    width: 100%;
    min-height: 36px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    display: flex;
    align-items: center;
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}

.c-table-search__option:hover {
    background: var(--color-surface-secondary);
}

.c-table-search__option.is-selected {
    background: var(--color-surface-hover);
}

.c-table-search__visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 768px) {
    .c-table-search {
        width: auto;
        max-width: none;
        flex: 1 1 auto;
    }

    .c-table-search__scope-wrapper {
        max-width: 100%;
    }

    .c-table-search__dropdown {
        max-width: min(280px, calc(100vw - 48px));
    }
}
