﻿.app-combo {
    position: relative;
    display: inline-flex;
    min-width: 0;
}

.app-combo-pop[hidden],
.app-combo-clear[hidden] {
    display: none !important;
}

.app-combo-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 0 30px 0 12px;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface);
    color: var(--app-text);
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

    .app-combo-trigger:hover {
        border-color: #b9c4d3;
    }

    .app-combo-trigger:focus {
        outline: none;
    }

    .app-combo-trigger:focus-visible,
    .app-combo.is-open .app-combo-trigger {
        border-color: var(--app-primary);
        box-shadow: 0 0 0 3px rgba(59, 142, 243, .15);
    }

.app-combo.has-value .app-combo-trigger {
    padding-right: 54px;
    border-color: var(--app-primary);
    background: #f5f9ff;
}

.app-combo-icon {
    flex: none;
    color: var(--app-muted);
}

.app-combo.has-value .app-combo-icon {
    color: var(--app-accent);
}

.app-combo-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

    .app-combo-text.is-placeholder {
        color: #3f4a59;
    }

.app-combo-caret {
    position: absolute;
    right: 11px;
    top: 50%;
    color: var(--app-muted);
    font-size: 11px;
    transform: translateY(-50%);
    transition: transform .15s ease;
    pointer-events: none;
}

.app-combo.is-open .app-combo-caret {
    transform: translateY(-50%) rotate(180deg);
}

.app-combo-clear {
    position: absolute;
    right: 28px;
    top: 50%;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--app-muted);
    font-size: 12px;
    transform: translateY(-50%);
}

    .app-combo-clear:hover {
        background: var(--app-danger-soft);
        color: var(--app-danger);
    }

    .app-combo-clear:focus {
        outline: none;
    }

    .app-combo-clear:focus-visible {
        box-shadow: 0 0 0 2px rgba(198, 40, 40, .35);
    }

.app-combo-pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    width: max(100%, 320px);
    max-width: min(420px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid var(--app-line);
    border-radius: 12px;
    background: var(--app-surface);
    box-shadow: 0 16px 40px rgba(16, 48, 72, .16), 0 2px 6px rgba(16, 48, 72, .08);
    animation: app-combo-in .14s ease-out;
}

    .app-combo-pop.is-right {
        left: auto;
        right: 0;
    }

    .app-combo-pop.is-up {
        top: auto;
        bottom: calc(100% + 6px);
    }

@keyframes app-combo-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.app-combo-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px;
    padding: 0 10px;
    height: 36px;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-muted);
    color: var(--app-muted);
}

    .app-combo-search:focus-within {
        border-color: var(--app-primary);
        background: var(--app-surface);
    }

    .app-combo-search input {
        flex: 1;
        min-width: 0;
        height: 100%;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--app-text);
        font-size: 13px;
        outline: none;
    }

.app-combo-list {
    max-height: 300px;
    margin: 0;
    padding: 0 6px 6px;
    overflow-y: auto;
    list-style: none;
    overscroll-behavior: contain;
}

.app-combo-group {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 8px 8px 4px;
    background: var(--app-surface);
    color: var(--app-muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.app-combo-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    color: var(--app-text);
    font-size: 13px;
    cursor: pointer;
}

    .app-combo-option.is-active {
        background: #eef4fd;
    }

    .app-combo-option.is-all {
        color: var(--app-muted);
        font-style: italic;
    }

    .app-combo-option.is-selected {
        color: var(--app-accent);
        font-weight: 600;
    }

.app-combo-option-text {
    flex: 1;
    min-width: 0;
}

    .app-combo-option-text small {
        margin-left: 6px;
        color: #8a94a3;
        font-size: 11.5px;
        font-weight: 400;
    }

    .app-combo-option-text mark {
        padding: 0;
        border-radius: 2px;
        background: #ffe8a3;
        color: inherit;
    }

.app-combo-check {
    flex: none;
    color: var(--app-accent);
    font-size: 11px;
    visibility: hidden;
}

.app-combo-option.is-selected .app-combo-check {
    visibility: visible;
}

.app-combo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 10px;
    color: #8a94a3;
    font-size: 13px;
}

.app-combo-foot {
    padding: 6px 12px;
    border-top: 1px solid var(--app-line-soft);
    background: var(--app-surface-alt);
    color: #8a94a3;
    font-size: 11.5px;
    text-align: right;
}

.app-combo-copy {
    display: grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--app-muted);
    font-size: 12px;
    opacity: 0;
    cursor: copy;
    transition: opacity .12s ease, background-color .12s ease, color .12s ease;
}

.app-combo-option:hover .app-combo-copy,
.app-combo-option.is-active .app-combo-copy,
.app-combo-copy.is-copied {
    opacity: 1;
}

.app-combo-copy:hover {
    background: var(--app-surface);
    color: var(--app-accent);
    box-shadow: var(--app-shadow-xs);
}

.app-combo-copy.is-copied {
    color: var(--app-success);
}

.app-combo-foot.is-flash {
    background: var(--app-success-soft);
    color: var(--app-success);
    font-weight: 600;
}

.app-combo-foot.is-flash.is-error {
    background: var(--app-danger-soft);
    color: var(--app-danger);
}

.app-combo-detail-foot {
    padding: 8px 14px;
    border-top: 1px solid var(--app-line-soft);
    border-radius: 0 0 12px 12px;
    background: var(--app-surface-alt);
    color: var(--app-muted);
    font-size: 11px;
}

    .app-combo-detail-foot kbd {
        display: inline-block;
        min-width: 20px;
        padding: 1px 5px;
        border: 1px solid var(--app-line);
        border-bottom-width: 2px;
        border-radius: 4px;
        background: var(--app-surface);
        color: var(--app-text-soft);
        font-family: var(--app-mono);
        font-size: 10.5px;
        text-align: center;
        box-shadow: none;
    }

.app-combo-detail {
    position: fixed;
    z-index: 96;
    width: 300px;
    max-width: calc(100vw - 16px);
    border: 1px solid var(--app-line);
    border-radius: 12px;
    background: var(--app-surface);
    box-shadow: 0 18px 44px rgba(16, 48, 72, .18), 0 2px 6px rgba(16, 48, 72, .08);
    color: var(--app-text);
    font-size: 12.5px;
    pointer-events: none;
    animation: app-combo-in .12s ease-out;
}

    .app-combo-detail[hidden] {
        display: none;
    }

    .app-combo-detail::after {
        content: "";
        position: absolute;
        top: 50%;
        right: -6px;
        width: 10px;
        height: 10px;
        border-top: 1px solid var(--app-line);
        border-right: 1px solid var(--app-line);
        background: var(--app-surface);
        transform: translateY(-50%) rotate(45deg);
    }

    .app-combo-detail.is-right::after {
        right: auto;
        left: -6px;
        transform: translateY(-50%) rotate(-135deg);
    }

.app-combo-detail-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--app-line-soft);
}

.app-combo-detail-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--app-primary-soft);
    color: var(--app-primary-strong);
    font-size: 14px;
}

.app-combo-detail-title {
    display: block;
    font-family: var(--app-mono);
    font-size: 12.5px;
    font-weight: 700;
}

.app-combo-detail-sub {
    display: block;
    color: var(--app-muted);
    font-size: 11.5px;
}

.app-combo-detail-badge {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--app-neutral-soft);
    color: var(--app-text-soft);
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}

    .app-combo-detail-badge.is-current {
        background: var(--app-success-soft);
        color: var(--app-success);
    }

    .app-combo-detail-badge.is-closed {
        background: var(--app-neutral-soft);
        color: var(--app-muted);
    }

.app-combo-detail-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 10px 14px 12px;
}

.app-combo-detail-row {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
}

    .app-combo-detail-row > i {
        margin-top: 2px;
        color: var(--app-faint);
        font-size: 12px;
        text-align: center;
    }

    .app-combo-detail-row small {
        display: block;
        color: var(--app-muted);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: .04em;
        text-transform: uppercase;
    }

    .app-combo-detail-row span {
        display: block;
        font-weight: 500;
        overflow-wrap: anywhere;
    }

.app-combo-detail-note {
    margin: 0 14px 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--app-surface-muted);
    color: var(--app-text-soft);
    font-size: 12px;
    line-height: 1.4;
}

    .app-combo-detail-note small {
        display: block;
        margin-bottom: 2px;
        color: var(--app-muted);
        font-size: 10.5px;
        font-weight: 600;
        letter-spacing: .04em;
        text-transform: uppercase;
    }

@media (prefers-reduced-motion: reduce) {
    .app-combo-pop,
    .app-combo-detail {
        animation: none;
    }

    .app-combo-caret {
        transition: none;
    }
}
