/* KL Search overlay */

/* ── Overlay shell ──
   z-index: 999 keeps the sticky .site-header (z-index: 1000) naturally on top.
   padding-top is set via JS to match the actual rendered header height. */
.kl-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding-top: 108px; /* fallback; JS overwrites with real header height */
}

.kl-search-overlay[hidden] {
    display: none !important;
}

/* Backdrop — dark translucent, click to close */
.kl-search-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(14, 57, 87, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.25s ease;
    cursor: pointer;
}

.kl-search-overlay.is-open .kl-search-overlay__backdrop {
    opacity: 1;
}

/* Panel — navy, slides down from top */
.kl-search-overlay__panel {
    position: relative;
    z-index: 1;
    background: #0E3957;
    padding: 28px 32px 32px;
    width: 100%;
    max-height: calc(100vh - 108px); /* fallback; JS sets inline padding-top on overlay */
    overflow-y: auto;
    transform: translateY(-110%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
}

.kl-search-overlay.is-open .kl-search-overlay__panel {
    transform: translateY(0);
}

/* ── Panel top row ── */
.kl-search-overlay__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.kl-search-overlay__prompt {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
}

.kl-search-overlay__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.kl-search-overlay__close:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
}

/* ── Search field ── */
.kl-search-overlay__field {
    position: relative;
    max-width: 720px;
    margin: 0 auto;
}

.kl-search-overlay__field-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #89C9B2;
    pointer-events: none;
}

.kl-search-overlay__input {
    width: 100%;
    height: 60px;
    padding: 0 54px 0 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: #fff;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 500;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
    -webkit-appearance: none;
}

.kl-search-overlay__input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.kl-search-overlay__input:focus {
    border-color: #89C9B2;
    background: rgba(255, 255, 255, 0.14);
}

/* Hide browser's native × in search inputs */
.kl-search-overlay__input::-webkit-search-cancel-button,
.kl-search-overlay__input::-webkit-search-decoration {
    -webkit-appearance: none;
}

/* ── Results list ── */
.kl-search-results {
    max-width: 720px;
    margin: 16px auto 0;
}

.kl-search-results:empty {
    display: none;
}

/* Status messages (loading / no results) */
.kl-search-results__status {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    text-align: center;
    padding: 20px 0 8px;
}

/* Individual result */
.kl-search-result {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 10px;
    text-decoration: none !important;
    color: #fff !important;
    transition: background 0.12s;
    cursor: pointer;
    outline: none;
}

.kl-search-result:hover,
.kl-search-result:focus,
.kl-search-result.is-active {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    text-decoration: none !important;
}

.kl-search-result + .kl-search-result {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* Badge */
.kl-search-result__badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 50px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 3px;
}

.kl-search-result__badge--page      { background: rgba(137, 201, 178, 0.25); color: #89C9B2; }
.kl-search-result__badge--news      { background: rgba(252, 238, 33, 0.2);   color: #FCEE21; }
.kl-search-result__badge--vacancy   { background: rgba(238, 114, 3, 0.25);   color: #EE7203; }
.kl-search-result__badge--volunteer { background: rgba(238, 114, 3, 0.2);    color: #f59a4f; }
.kl-search-result__badge--event     { background: rgba(137, 201, 178, 0.2);  color: #89C9B2; }

/* Text block */
.kl-search-result__body {
    flex: 1;
    min-width: 0;
}

.kl-search-result__title {
    font-size: 0.975rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kl-search-result__excerpt {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 3px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Arrow icon */
.kl-search-result__arrow {
    color: rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
    margin-top: 4px;
    transition: color 0.12s, transform 0.12s;
}

.kl-search-result:hover .kl-search-result__arrow,
.kl-search-result.is-active .kl-search-result__arrow {
    color: #89C9B2;
    transform: translateX(3px);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .kl-search-overlay__panel {
        padding: 20px 16px 24px;
    }

    .kl-search-overlay__input {
        height: 52px;
        font-size: 1rem;
    }

    .kl-search-result__title {
        font-size: 0.9rem;
    }
}
