/*
   Header search icon and panel (header_search switch, off by default).
   Loaded only while the switch is on; every selector is .hzhs* or
   .hz-hsearch, which exist nowhere else. Logical properties throughout, so
   the Arabic (dir="rtl") document mirrors without a separate sheet.
*/

.hz-header .hz-hicon.hz-hsearch svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.hzhs[hidden] {
    display: none !important;
}

.hzhs {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.hzhs__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 26, 0.45);
}

.hzhs__panel {
    position: relative;
    box-sizing: border-box;
    width: min(680px, calc(100% - 32px));
    margin: 84px auto 0;
    padding: 16px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(17, 17, 26, 0.22);
}

.hzhs__form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hzhs__input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid #d6d3e0;
    border-radius: 10px;
    font: inherit;
    font-size: 16px;
    color: inherit;
    background: #fff;
}

.hzhs__input:focus-visible {
    outline: 2px solid var(--hagzi-primary, #5b2bd9);
    outline-offset: 1px;
}

.hzhs__submit {
    min-height: 48px;
    padding: 0 18px;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: var(--hagzi-primary, #5b2bd9);
    cursor: pointer;
}

.hzhs__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.hzhs__close svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.hzhs__submit:focus-visible,
.hzhs__close:focus-visible {
    outline: 2px solid var(--hagzi-primary, #5b2bd9);
    outline-offset: 2px;
}

.hzhs__list {
    max-height: min(60vh, 420px);
    margin: 10px 0 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

.hzhs__option {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-align: start;
}

.hzhs__option--active {
    background: #f1edfb;
}

.hzhs__option--keyword .hzhs__option-label {
    font-weight: 600;
}

.hzhs__option-meta {
    flex: none;
    font-size: 13px;
    color: #6b6880;
}

.hzhs__hint {
    margin: 10px 0 0;
    font-size: 13px;
    color: #6b6880;
}

html.hzhs-open,
html.hzhs-open body {
    overflow: hidden;
}

@media (max-width: 720px) {
    /* The phone top row hides .hz-hicon; the search icon stays in it. */
    .hz-header .hz-hicon.hz-hsearch {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }
}

@media (max-width: 720px) {
    .hzhs__backdrop {
        display: none;
    }

    .hzhs__panel {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
        overflow-y: auto;
    }

    .hzhs__list {
        max-height: none;
    }

    .hzhs__submit {
        padding: 0 14px;
    }
}
