.topbar-search-toggle {
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
}

.topbar-search-toggle:hover,
.topbar-search-toggle:focus-visible {
    background: #f1f5f9;
    outline: none;
}

.kdo-search-modal[hidden] {
    display: none;
}

.kdo-search-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: start center;
    padding: clamp(5rem, 12vh, 8rem) 1rem 2rem;
}

.kdo-search-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.48);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    cursor: default;
}

.kdo-search-dialog {
    position: relative;
    width: min(920px, 100%);
    max-height: calc(100vh - clamp(7rem, 16vh, 11rem));
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.3);
    animation: kdo-search-enter 180ms ease-out;
}

.kdo-search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 0.75rem;
}

.kdo-search-title {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    font-weight: 800;
}

.kdo-search-close {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #334155;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
}

.kdo-search-form {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem 1.25rem;
}

.kdo-search-input-wrap {
    position: relative;
    flex: 1;
}

.kdo-search-input-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 1rem;
    width: 20px;
    height: 20px;
    color: #64748b;
    transform: translateY(-50%);
    pointer-events: none;
}

.kdo-search-input {
    width: 100%;
    height: 56px;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 0 3rem 0 1rem;
    background: #f8fafc;
    color: #0f172a;
    font: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

[dir="ltr"] .kdo-search-input {
    padding: 0 1rem 0 3rem;
}

.kdo-search-input:focus {
    border-color: #e8a620;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(232, 166, 32, 0.14);
}

.kdo-search-submit {
    min-width: 112px;
    height: 56px;
    border: 0;
    border-radius: 14px;
    padding: 0 1.25rem;
    background: #e8a620;
    color: #111827;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.kdo-search-submit:disabled {
    cursor: wait;
    opacity: 0.65;
}

.kdo-search-results {
    max-height: calc(100vh - 270px);
    overflow-y: auto;
    border-top: 1px solid #e2e8f0;
    padding: 1.25rem 1.5rem 1.5rem;
    overscroll-behavior: contain;
}

.kdo-search-status {
    padding: 2.5rem 1rem;
    color: #64748b;
    text-align: center;
}

.kdo-search-group + .kdo-search-group {
    margin-top: 1.75rem;
}

.kdo-search-group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 0.75rem;
    color: #334155;
    font-size: 0.95rem;
    font-weight: 800;
}

.kdo-search-group-count {
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    background: #fff7e6;
    color: #9a6700;
    font-size: 0.75rem;
}

.kdo-search-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.kdo-search-result {
    display: flex;
    min-width: 0;
    gap: 0.85rem;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.8rem;
    color: inherit;
    text-decoration: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.kdo-search-result:hover,
.kdo-search-result:focus-visible {
    border-color: #e8a620;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
    outline: none;
}

.kdo-search-thumb,
.kdo-search-thumb-placeholder {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    border-radius: 10px;
    object-fit: cover;
}

.kdo-search-thumb-placeholder {
    display: grid;
    place-items: center;
    background: #f1f5f9;
    color: #94a3b8;
}

.kdo-search-result-copy {
    min-width: 0;
}

.kdo-search-result-title {
    margin: 0 0 0.3rem;
    overflow: hidden;
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kdo-search-result-excerpt {
    display: -webkit-box;
    margin: 0 0 0.35rem;
    overflow: hidden;
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.kdo-search-result-date {
    color: #94a3b8;
    font-size: 0.72rem;
}

body.kdo-search-open {
    overflow: hidden;
}

@keyframes kdo-search-enter {
    from { opacity: 0; transform: translateY(-10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 700px) {
    .kdo-search-modal {
        padding: 4.5rem 0.65rem 0.65rem;
    }

    .kdo-search-dialog {
        max-height: calc(100vh - 5.25rem);
        border-radius: 18px;
    }

    .kdo-search-form {
        flex-direction: column;
    }

    .kdo-search-submit {
        width: 100%;
    }

    .kdo-search-results {
        max-height: calc(100vh - 300px);
        padding-inline: 1rem;
    }

    .kdo-search-list {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kdo-search-dialog {
        animation: none;
    }
}
