/* ── Search Modal — RB Design System tokens ── */

/* ─ Overlay ─ */
.search-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(1, 25, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8vh;
    animation: searchFadeIn .18s cubic-bezier(.4,0,.2,1);
}

@keyframes searchFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ─ Panel ─ */
.search-modal-inner {
    background: #fff;
    border-radius: 1.25rem;
    width: 100%;
    max-width: 660px;
    max-height: 76vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 32px 80px rgba(1, 25, 42, .18),
        0 8px 24px rgba(1, 25, 42, .08),
        0 0 0 1px rgba(1, 88, 255, .08);
    overflow: hidden;
    border: 1px solid var(--color-neutral-300, #d4d4d4);
    animation: searchSlideIn .2s cubic-bezier(.22,.61,.36,1);
}

@keyframes searchSlideIn {
    from { transform: translateY(-12px) scale(.98); opacity: 0; }
    to   { transform: translateY(0) scale(1);       opacity: 1; }
}

/* ─ Input row ─ */
.search-modal-header {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: 1rem 1.25rem;
    border-bottom: 1.5px solid var(--color-neutral-300, #d4d4d4);
    background: white;
}

.search-modal-input-wrap {
    flex: 1;
    min-width: 0;
}

.search-modal-input {
    width: 100%;
}

.search-modal-input input {
    font-size: 1.0625rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-brand-800, #01192a);
    caret-color: var(--color-blue-500, #0158ff);
}

.search-modal-input input::placeholder {
    color: var(--color-neutral-700, #404040);
    font-weight: 400;
}

.search-modal-close {
    flex-shrink: 0;
}

/* ─ Results list ─ */
.search-modal-results {
    overflow-y: auto;
    flex: 1;
    padding: .5rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--color-neutral-200) transparent;
}

.search-modal-results::-webkit-scrollbar {
    width: 4px;
}
.search-modal-results::-webkit-scrollbar-track { background: transparent; }
.search-modal-results::-webkit-scrollbar-thumb {
    background: var(--color-neutral-200, #eaeaea);
    border-radius: 2px;
}

/* ─ Result item ─ */
.search-result-item {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .625rem 1.25rem;
    text-decoration: none;
    color: var(--color-brand-800, #01192a);
    transition: background .1s;
    cursor: pointer;
    border-radius: 0;
    position: relative;
}

.search-result-item::before {
    content: '';
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 0;
    background: var(--color-blue-500, #0158ff);
    border-radius: 1px;
    transition: height .12s;
}

.search-result-item:hover {
    background: var(--color-neutral-100, #f5f5f5);
    text-decoration: none;
    color: var(--color-brand-800, #01192a);
}

.search-result-item.active {
    background: var(--color-blue-200, #edf3fe);
    text-decoration: none;
    color: var(--color-brand-800, #01192a);
}

.search-result-item.active::before {
    height: 60%;
}

/* ─ Logo ─ */
.search-result-logo {
    width: 38px;
    height: 38px;
    border-radius: .625rem;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
    background-color: white;
    border: 1.5px solid var(--color-neutral-300, #d4d4d4);
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ─ Text info ─ */
.search-result-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    gap: .15rem;
}

.search-result-name {
    font-weight: 600;
    font-size: .875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-brand-800, #01192a);
    line-height: 1.3;
}

.search-result-meta {
    font-size: .72rem;
    color: var(--color-neutral-700, #404040);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: .375rem;
}

.search-result-meta strong {
    font-weight: 700;
    color: var(--color-brand-800, #01192a);
    font-family: var(--font-caption, monospace);
    font-size: .7rem;
    letter-spacing: .02em;
}

/* ─ ADR badge ─ */
.search-result-badge {
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: var(--color-warning-100, #fff8ed);
    color: var(--color-warning-600, #b45309);
    border: 1px solid var(--color-warning-200, #fde68a);
    padding: .15rem .45rem;
    border-radius: .375rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.search-empty-state {
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─ Footer ─ */
.search-modal-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .625rem 1.25rem;
    border-top: 1px solid var(--color-neutral-300, #d4d4d4);
    background: var(--color-neutral-50, #fafafa);
    font-size: .7rem;
    color: var(--color-neutral-700, #404040);
    flex-shrink: 0;
}

.search-modal-footer span {
    display: flex;
    align-items: center;
    gap: .3rem;
}

.search-modal-footer kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .1rem .375rem;
    background: white;
    border: 1px solid var(--color-neutral-300, #d4d4d4);
    border-bottom-width: 2px;
    border-radius: .3rem;
    font-size: .65rem;
    font-family: inherit;
    color: var(--color-neutral-700, #404040);
    line-height: 1.5;
}

.search-footer-advanced {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    color: var(--color-blue-500, #0158ff);
    text-decoration: none;
    font-size: .75rem;
    font-weight: 600;
    padding: .25rem .625rem;
    border-radius: .5rem;
    background: var(--color-blue-200, #edf3fe);
    transition: background .12s, color .12s;
    white-space: nowrap;
}

.search-footer-advanced:hover {
    background: var(--color-blue-300, #dde8fe);
    color: var(--color-blue-700, #0042cc);
    text-decoration: none;
}

/* ─ Mobile ─ */
@media (max-width: 640px) {
    .search-modal-overlay {
        padding: 0;
        align-items: flex-end;
        justify-content: stretch;
    }

    .search-modal-inner {
        border-radius: 1.25rem 1.25rem 0 0;
        max-height: 88svh;
        width: 100%;
        max-width: 100%;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .search-modal-footer {
        display: none;
    }
}
