/* Klaas Suche – Overlay. Formensprache wie der Kontakt-Assistent:
   weiße Karte, 18px Radius, weicher Schatten, Pill-Buttons. */

.klaas-suche-overlay[hidden] {
    display: none;
}

.klaas-suche-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 1rem 2rem;
    opacity: 0;
    transition: opacity .18s ease;
}

.klaas-suche-overlay.is-open {
    opacity: 1;
}

.klaas-suche-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 18, 22, .55);
    backdrop-filter: blur(2px);
}

.klaas-suche-dialog {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
    padding: 1.25rem;
    transform: translateY(-8px);
    transition: transform .18s ease;
}

.klaas-suche-overlay.is-open .klaas-suche-dialog {
    transform: translateY(0);
}

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

/* Suchzeile ------------------------------------------------------- */

.klaas-suche-form {
    display: flex;
    align-items: center;
    gap: .6rem;
    border: 1px solid #e5e5e5;
    border-radius: 999px;
    padding: .4rem .4rem .4rem .9rem;
    background: #fff;
}

.klaas-suche-form:focus-within {
    border-color: #999;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .06);
}

.klaas-suche-form-icon {
    display: inline-flex;
    color: #777;
    flex: 0 0 auto;
}

.klaas-suche-input,
.klaas-suche-input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 1.05rem;
    padding: .55rem 0;
    color: inherit;
    box-shadow: none;
}

.klaas-suche-input::-webkit-search-cancel-button {
    cursor: pointer;
}

.klaas-suche-submit,
.klaas-suche-trigger {
    appearance: none;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: #fff;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    padding: .6rem 1.1rem;
    flex: 0 0 auto;
    transition: transform .15s ease, box-shadow .15s ease;
}

.klaas-suche-submit:hover,
.klaas-suche-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}

.klaas-suche-close {
    appearance: none;
    border: 0;
    background: #f6f7f8;
    color: #333;
    cursor: pointer;
    border-radius: 999px;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.4rem;
    line-height: 1;
    flex: 0 0 auto;
}

.klaas-suche-close:hover {
    background: #ebedef;
}

.klaas-suche-status {
    margin: .75rem .25rem .25rem;
    color: #555;
    font-size: .9rem;
    min-height: 1.2em;
}

.klaas-suche-overlay.is-busy .klaas-suche-results {
    opacity: .55;
}

/* Ergebnisse ------------------------------------------------------ */

.klaas-suche-results {
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: opacity .15s ease;
    margin-top: .25rem;
}

.klaas-suche-group + .klaas-suche-group {
    margin-top: 1.25rem;
}

.klaas-suche-group-title {
    margin: 0 0 .5rem;
    font-size: .8rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #777;
}

.klaas-suche-hits {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .35rem;
}

.klaas-suche-hit-item {
    margin: 0;
    padding: 0;
}

.klaas-suche-hit {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .6rem;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: background-color .12s ease;
}

.klaas-suche-hit:hover,
.klaas-suche-hit:focus {
    background: #f6f7f8;
    outline: none;
}

.klaas-suche-hit:focus-visible {
    box-shadow: 0 0 0 2px #333;
}

.klaas-suche-hit-media {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: #f6f7f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.klaas-suche-hit-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.klaas-suche-hit-placeholder {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #dfe3e6;
}

.klaas-suche-hit-text {
    display: grid;
    gap: .15rem;
    min-width: 0;
}

.klaas-suche-hit-title {
    font-weight: 700;
    line-height: 1.35;
}

.klaas-suche-hit-excerpt {
    color: #555;
    font-size: .9rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.klaas-suche-hit-type {
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #888;
}

.klaas-suche-hit mark {
    background: #ffe9a8;
    color: inherit;
    padding: 0 .1em;
    border-radius: 3px;
}

.klaas-suche-group-more,
.klaas-suche-all {
    margin: .5rem 0 0;
    font-size: .9rem;
}

.klaas-suche-all {
    border-top: 1px solid #eee;
    padding-top: .85rem;
    margin-top: 1.25rem;
}

/* Startzustand & Leerzustand -------------------------------------- */

.klaas-suche-quick h3,
.klaas-suche-empty-title {
    margin: 0 0 .6rem;
    font-size: .8rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #777;
}

.klaas-suche-quick-links {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.klaas-suche-quick-link,
.klaas-suche-empty-link {
    display: inline-flex;
    align-items: center;
    border: 1px solid currentColor;
    border-radius: 999px;
    padding: .55rem 1rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    color: inherit;
    transition: transform .15s ease, box-shadow .15s ease;
}

.klaas-suche-quick-link:hover,
.klaas-suche-quick-link:focus,
.klaas-suche-empty-link:hover,
.klaas-suche-empty-link:focus {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}

.klaas-suche-empty {
    padding: .5rem .25rem 1rem;
}

.klaas-suche-empty-title {
    text-transform: none;
    letter-spacing: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: inherit;
}

.klaas-suche-empty-hint {
    margin: 0 0 .85rem;
    color: #555;
    line-height: 1.55;
}

/* Seitenzustand --------------------------------------------------- */

body.klaas-suche-locked {
    overflow: hidden;
}

@media (max-width: 680px) {
    .klaas-suche-overlay {
        padding: 0;
    }

    .klaas-suche-dialog {
        max-width: none;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
        border: 0;
        padding: 1rem;
    }

    .klaas-suche-submit {
        display: none;
    }

    .klaas-suche-hit-media {
        width: 44px;
        height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .klaas-suche-overlay,
    .klaas-suche-dialog,
    .klaas-suche-hit,
    .klaas-suche-quick-link,
    .klaas-suche-empty-link,
    .klaas-suche-submit,
    .klaas-suche-trigger {
        transition: none;
    }
}
