/* =========================================================
   HEADER WIDGET
========================================================= */

.yb-live-search,
.yb-live-search * {
    box-sizing: border-box;
}

.yb-live-search {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0;
    padding: 0;
    font-family: Manrope, "Helvetica Neue", Arial, sans-serif;
}

.yb-live-search__trigger {
    width: 38px;
    height: 38px;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #15171b;
    cursor: pointer;
    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.yb-live-search__trigger svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.yb-live-search__trigger:hover,
.yb-live-search__trigger:focus-visible,
.yb-live-search__trigger[aria-expanded="true"] {
    color: #a56f1d;
    background: rgba(199, 150, 60, 0.09);
    outline: none;
}

.yb-live-search__trigger:active {
    transform: scale(0.96);
}

/* =========================================================
   OVERLAY
========================================================= */

body.yb-live-search-lock {
    overflow: hidden !important;
}

.yb-live-search__overlay {
    --yb-live-search-top: 96px;
    --yb-live-search-panel-width: 740px;
    --yb-live-search-gold: #c7963c;
    --yb-live-search-gold-dark: #98681c;
    --yb-live-search-ink: #171714;
    --yb-live-search-muted: #6b675f;
    --yb-live-search-soft: #928c82;
    --yb-live-search-paper: #f8f5ee;
    --yb-live-search-line: rgba(32, 29, 24, 0.12);

    position: fixed;
    inset: 0;
    z-index: 999999;
    display: block;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    font-family: Manrope, "Helvetica Neue", Arial, sans-serif;
    transition:
        opacity 0.22s ease,
        visibility 0.22s ease;
}

.yb-live-search__overlay.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.yb-live-search__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background:
        linear-gradient(
            180deg,
            rgba(4, 6, 8, 0.48),
            rgba(4, 6, 8, 0.73)
        );
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: default;
}

.yb-live-search__panel {
    position: absolute;
    top: var(--yb-live-search-top);
    left: 50%;
    width: min(
        var(--yb-live-search-panel-width),
        calc(100vw - 36px)
    );
    max-height: min(680px, calc(100vh - var(--yb-live-search-top) - 22px));
    margin: 0;
    padding: 26px 28px 17px;
    overflow: hidden auto;
    border: 1px solid rgba(255, 255, 255, 0.66);
    border-radius: 20px;
    background:
        radial-gradient(
            circle at 93% 5%,
            rgba(199, 150, 60, 0.085),
            transparent 31%
        ),
        linear-gradient(
            145deg,
            #fbf9f4,
            var(--yb-live-search-paper)
        );
    color: var(--yb-live-search-ink);
    box-shadow:
        0 28px 80px rgba(0, 0, 0, 0.27);
    transform:
        translate(-50%, -12px)
        scale(0.985);
    transform-origin: top center;
    transition: transform 0.24s ease;
}

.yb-live-search__overlay.is-open
.yb-live-search__panel {
    transform:
        translate(-50%, 0)
        scale(1);
}

.yb-live-search__panel-head {
    margin-bottom: 22px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.yb-live-search__eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--yb-live-search-gold-dark);
    font-size: 8px;
    font-weight: 790;
    line-height: 1.35;
    letter-spacing: 0.17em;
}

.yb-live-search__panel-head h2 {
    margin: 0;
    color: var(--yb-live-search-ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.yb-live-search__close {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    margin: -4px -5px 0 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--yb-live-search-line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.34);
    color: var(--yb-live-search-muted);
    cursor: pointer;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.yb-live-search__close svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
}

.yb-live-search__close:hover,
.yb-live-search__close:focus-visible {
    border-color: var(--yb-live-search-gold);
    background: rgba(199, 150, 60, 0.07);
    color: var(--yb-live-search-gold-dark);
    outline: none;
}

/* =========================================================
   INPUT
========================================================= */

.yb-live-search__form {
    position: relative;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(32, 29, 24, 0.26);
    transition: border-color 0.2s ease;
}

.yb-live-search__form:focus-within {
    border-color: var(--yb-live-search-gold);
}

.yb-live-search__input-icon {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    color: var(--yb-live-search-gold-dark);
}

.yb-live-search__input-icon svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.yb-live-search__input {
    width: 100%;
    min-width: 0;
    height: 58px;
    margin: 0;
    padding: 0 86px 0 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--yb-live-search-ink) !important;
    font-family: Manrope, "Helvetica Neue", Arial, sans-serif !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    appearance: none;
    -webkit-appearance: none;
}

.yb-live-search__input::placeholder {
    color: #999187;
    opacity: 1;
}

.yb-live-search__input::-webkit-search-cancel-button {
    display: none;
}

.yb-live-search__clear {
    position: absolute;
    top: 50%;
    right: 0;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #999287;
    cursor: pointer;
    transform: translateY(-50%);
}

.yb-live-search__clear[hidden] {
    display: none !important;
}

.yb-live-search__clear svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.45;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.yb-live-search__clear:hover,
.yb-live-search__clear:focus-visible {
    color: var(--yb-live-search-gold-dark);
    outline: none;
}

.yb-live-search__loader {
    position: absolute;
    top: 50%;
    right: 43px;
    width: 18px;
    height: 18px;
    display: none;
    border: 1.5px solid rgba(152, 104, 28, 0.18);
    border-top-color: var(--yb-live-search-gold-dark);
    border-radius: 50%;
    transform: translateY(-50%);
    animation:
        yb-live-search-spin 0.72s linear infinite;
}

.yb-live-search__loader.is-active {
    display: block;
}

/* =========================================================
   STATUS
========================================================= */

.yb-live-search__status {
    min-height: 38px;
    padding: 12px 0 9px;
    color: var(--yb-live-search-soft);
    font-size: 11.5px;
    line-height: 1.5;
}

/* =========================================================
   RESULTS
========================================================= */

.yb-live-search__results {
    border-top: 1px solid var(--yb-live-search-line);
}

.yb-live-search__result {
    position: relative;
    min-height: 78px;
    padding: 15px 9px 15px 0;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) 24px;
    gap: 18px;
    align-items: center;
    border-bottom: 1px solid var(--yb-live-search-line);
    color: var(--yb-live-search-ink);
    text-decoration: none;
    transition:
        padding-left 0.2s ease,
        color 0.2s ease,
        background-color 0.2s ease;
}

.yb-live-search__result::before {
    content: "";
    position: absolute;
    top: 13px;
    bottom: 13px;
    left: -30px;
    width: 2px;
    background: var(--yb-live-search-gold);
    opacity: 0;
    transition:
        opacity 0.2s ease,
        left 0.2s ease;
}

.yb-live-search__result-type {
    color: var(--yb-live-search-gold-dark);
    font-size: 8px;
    font-weight: 790;
    line-height: 1.35;
    letter-spacing: 0.14em;
}

.yb-live-search__result-copy {
    min-width: 0;
}

.yb-live-search__result-title {
    display: block;
    margin-bottom: 5px;
    overflow: hidden;
    color: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.42;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.yb-live-search__result-path {
    display: block;
    overflow: hidden;
    color: var(--yb-live-search-soft);
    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;
    font-size: 9.5px;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.yb-live-search__result-arrow {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--yb-live-search-soft);
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition:
        stroke 0.2s ease,
        transform 0.2s ease;
}

.yb-live-search__result:hover,
.yb-live-search__result:focus-visible,
.yb-live-search__result.is-active {
    padding-left: 8px;
    color: var(--yb-live-search-gold-dark);
    background: rgba(199, 150, 60, 0.035);
    outline: none;
}

.yb-live-search__result:hover::before,
.yb-live-search__result:focus-visible::before,
.yb-live-search__result.is-active::before {
    left: 0;
    opacity: 1;
}

.yb-live-search__result:hover
.yb-live-search__result-arrow,
.yb-live-search__result:focus-visible
.yb-live-search__result-arrow,
.yb-live-search__result.is-active
.yb-live-search__result-arrow {
    stroke: var(--yb-live-search-gold-dark);
    transform: translateX(3px);
}

/* =========================================================
   EMPTY / ERROR STATE
========================================================= */

.yb-live-search__empty {
    padding: 26px 0 19px;
    text-align: left;
}

.yb-live-search__empty-mark {
    width: 42px;
    height: 42px;
    margin-bottom: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(199, 150, 60, 0.30);
    border-radius: 50%;
    color: var(--yb-live-search-gold-dark);
}

.yb-live-search__empty-mark svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.yb-live-search__empty h3 {
    margin: 0 0 8px;
    color: var(--yb-live-search-ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 23px;
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.yb-live-search__empty p {
    max-width: 560px;
    margin: 0;
    color: var(--yb-live-search-muted);
    font-size: 12.5px;
    line-height: 1.68;
}

.yb-live-search__quick-links {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.yb-live-search__quick-links a {
    min-height: 36px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(32, 29, 24, 0.15);
    border-radius: 19px;
    background: rgba(255, 255, 255, 0.30);
    color: var(--yb-live-search-ink);
    font-size: 10.5px;
    font-weight: 680;
    text-decoration: none;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.yb-live-search__quick-links a:hover,
.yb-live-search__quick-links a:focus-visible {
    border-color: var(--yb-live-search-gold);
    background: rgba(199, 150, 60, 0.07);
    color: var(--yb-live-search-gold-dark);
    outline: none;
}

/* =========================================================
   FOOTER
========================================================= */

.yb-live-search__footer {
    padding-top: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    color: #9f988f;
    font-size: 9px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.01em;
}

.yb-live-search__keys {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    color: #a39c92;
    font-size: 8.5px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
}

.yb-live-search__footer kbd {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid rgba(32, 29, 24, 0.13);
    border-radius: 5px;

    background: rgba(255, 255, 255, 0.46);
    color: #736d65;

    font-family: Manrope, "Helvetica Neue", Arial, sans-serif;
    font-size: 8px;
    font-weight: 650;
    line-height: 1;

    box-shadow:
        0 1px 0 rgba(32, 29, 24, 0.05);
}

.yb-live-search__footer > span:first-child {
    color: #aaa39a;
    font-size: 9px;
    font-weight: 500;
    white-space: nowrap;
}

/* =========================================================
   ANIMATION
========================================================= */

@keyframes yb-live-search-spin {
    to {
        transform:
            translateY(-50%)
            rotate(360deg);
    }
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 900px) {
    .yb-live-search__keys {
        display: none;
    }
}


@media (max-width: 820px) {
    .yb-live-search__panel {
        width: min(720px, calc(100vw - 28px));
        padding-right: 24px;
        padding-left: 24px;
    }

    .yb-live-search__result {
        grid-template-columns: 78px minmax(0, 1fr) 20px;
        gap: 14px;
    }

    .yb-live-search__footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {
    .yb-live-search__trigger {
        width: 36px;
        height: 36px;
    }

    .yb-live-search__overlay {
        background: var(--yb-live-search-paper);
    }

    .yb-live-search__backdrop {
        display: none;
    }

    .yb-live-search__panel,
    .yb-live-search__overlay.is-open
    .yb-live-search__panel {
        position: absolute;
        inset: 0;
        width: 100%;
        max-height: none;
        padding: 26px 19px 20px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        transform: none;
    }

    .yb-live-search__panel-head {
        margin-bottom: 20px;
    }

    .yb-live-search__panel-head h2 {
        font-size: 28px;
    }

    .yb-live-search__input {
        height: 56px;
        padding-right: 76px !important;
        font-size: 15px !important;
    }

    .yb-live-search__result {
        min-height: 91px;
        grid-template-columns: 1fr 20px;
        gap: 10px;
    }

    .yb-live-search__result-type {
        grid-column: 1 / -1;
        margin-bottom: -5px;
    }

    .yb-live-search__result-copy {
        grid-column: 1;
    }

    .yb-live-search__result-arrow {
        grid-column: 2;
        grid-row: 2;
    }

    .yb-live-search__footer {
        display: none;
    }

    .yb-live-search__quick-links {
        align-items: stretch;
        flex-direction: column;
    }

    .yb-live-search__quick-links a {
        width: 100%;
    }
}

/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
    .yb-live-search__overlay,
    .yb-live-search__panel,
    .yb-live-search__trigger,
    .yb-live-search__result,
    .yb-live-search__result::before,
    .yb-live-search__result-arrow {
        transition: none !important;
    }

    .yb-live-search__loader {
        animation-duration: 1.5s;
    }
}

/* =========================================================
   YUBEEN BRAND COLOR OVERRIDE
   Red = interaction
   Gold = premium information hierarchy
========================================================= */

.yb-live-search__overlay {
    /*
     * 将这里的红色换成 Header 中
     * Become a Partner 按钮的实际背景色，
     * 即可完全统一品牌色。
     */
    --yb-live-search-red: #e31b2d;
    --yb-live-search-red-dark: #b80f20;
    --yb-live-search-red-soft: rgba(227, 27, 45, 0.065);

    --yb-live-search-gold: #c7963c;
    --yb-live-search-gold-dark: #98681c;
}

/* Header 放大镜：默认黑色，交互时使用品牌红 */
.yb-live-search__trigger:hover,
.yb-live-search__trigger:focus-visible,
.yb-live-search__trigger[aria-expanded="true"] {
    color: var(--yb-live-search-red);
    background: rgba(227, 27, 45, 0.075);
}

/* 遮罩加入非常轻微的暗红品牌气氛 */
.yb-live-search__backdrop {
    background:
        linear-gradient(
            180deg,
            rgba(21, 5, 8, 0.47),
            rgba(4, 6, 8, 0.76)
        );
}

/* 搜索面板：米白主体 + 微弱红色和金色环境光 */
.yb-live-search__panel {
    border-color: rgba(227, 27, 45, 0.13);

    background:
        radial-gradient(
            circle at 94% 4%,
            rgba(227, 27, 45, 0.072),
            transparent 29%
        ),
        radial-gradient(
            circle at 7% 100%,
            rgba(199, 150, 60, 0.045),
            transparent 27%
        ),
        linear-gradient(
            145deg,
            #fbf9f4,
            #f8f5ee
        );

    box-shadow:
        0 28px 80px rgba(28, 4, 8, 0.26);
}

/* 面板顶部增加红金渐变短线 */
.yb-live-search__panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 41px;
    width: 62px;
    height: 2px;

    background:
        linear-gradient(
            90deg,
            var(--yb-live-search-red) 0%,
            var(--yb-live-search-gold) 100%
        );
}

/*
 * SITE SEARCH 保留金色。
 * 这是高级光学和精密感的辅助色。
 */
.yb-live-search__eyebrow {
    color: var(--yb-live-search-gold-dark);
}

/* 关闭按钮使用红色交互反馈 */
.yb-live-search__close:hover,
.yb-live-search__close:focus-visible {
    border-color: var(--yb-live-search-red);
    background: var(--yb-live-search-red-soft);
    color: var(--yb-live-search-red-dark);
}

/* 输入框放大镜改为红色 */
.yb-live-search__input-icon {
    color: var(--yb-live-search-red);
}

/* 输入框聚焦线使用品牌红 */
.yb-live-search__form:focus-within {
    border-color: var(--yb-live-search-red);
}

/* 清除按钮悬停 */
.yb-live-search__clear:hover,
.yb-live-search__clear:focus-visible {
    color: var(--yb-live-search-red-dark);
}

/* 加载动画使用红色 */
.yb-live-search__loader {
    border-color: rgba(227, 27, 45, 0.17);
    border-top-color: var(--yb-live-search-red);
}

/*
 * 搜索结果类型继续使用金色：
 * PRODUCT / TECHNOLOGY / SUPPORT 等
 */
.yb-live-search__result-type {
    color: var(--yb-live-search-gold-dark);
}

/* 结果选中左侧标线改为红色 */
.yb-live-search__result::before {
    background: var(--yb-live-search-red);
}

/* 搜索结果悬停、键盘选择状态 */
.yb-live-search__result:hover,
.yb-live-search__result:focus-visible,
.yb-live-search__result.is-active {
    color: var(--yb-live-search-red-dark);
    background: var(--yb-live-search-red-soft);
}

/* 搜索结果箭头 */
.yb-live-search__result:hover
.yb-live-search__result-arrow,
.yb-live-search__result:focus-visible
.yb-live-search__result-arrow,
.yb-live-search__result.is-active
.yb-live-search__result-arrow {
    stroke: var(--yb-live-search-red);
}

/* 无结果状态图标改为红色 */
.yb-live-search__empty-mark {
    border-color: rgba(227, 27, 45, 0.27);
    color: var(--yb-live-search-red);
    background: rgba(227, 27, 45, 0.035);
}

/* 无结果快速入口使用红色交互 */
.yb-live-search__quick-links a:hover,
.yb-live-search__quick-links a:focus-visible {
    border-color: var(--yb-live-search-red);
    background: var(--yb-live-search-red-soft);
    color: var(--yb-live-search-red-dark);
}

/* 手机端顶部装饰线位置 */
@media (max-width: 600px) {
    .yb-live-search__panel::before {
        left: 19px;
        width: 52px;
    }
}
