/* ============================================================================
 * 全站「登录 / 注册」弹窗
 * ----------------------------------------------------------------------------
 * ★ 尺寸一律 px，不用 vw：弹层挂在 body 下，不参与 1920 设计稿的等比缩放。
 *   照抄 vw 的话，390 宽手机上整个弹窗只有 25px 宽（这个坑本项目踩过多次）。
 * ★ 必须自己写 box-sizing：各页 CSS 的 `*{box-sizing:border-box}` 都被 scope 在
 *   .yf-home / .yf-about / .yf-prod / .yf-news / .yf-mem 之内，弹层在作用域外。
 * ========================================================================== */

.yfa,
.yfa *,
.yfa *::before,
.yfa *::after {
    box-sizing: border-box;
}

.yfa {
    position: fixed;
    inset: 0;
    z-index: 99990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

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

.yfa__mask {
    position: absolute;
    inset: 0;
    background-color: rgba(8, 10, 14, .62);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: yfa-fade .22s ease both;
}

.yfa__panel {
    position: relative;
    width: 440px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 34px 36px 28px;
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(8, 12, 22, .28);
    animation: yfa-rise .26s cubic-bezier(.22, .85, .28, 1) both;
}

@keyframes yfa-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes yfa-rise {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to { opacity: 1; transform: none; }
}

/* 关闭 */
.yfa__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color .2s ease;
}

.yfa__close:hover {
    background-color: #f2f4f8;
}

.yfa__close span,
.yfa__close span::after {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 15px;
    height: 1.5px;
    background-color: #8b93a1;
    content: "";
    border-radius: 2px;
}

.yfa__close span {
    transform: translate(-50%, -50%) rotate(45deg);
}

.yfa__close span::after {
    left: 0;
    top: 0;
    transform: rotate(90deg);
}

/* 顶部 tab */
.yfa__tabs {
    display: flex;
    align-items: center;
    gap: 26px;
    margin-bottom: 26px;
    border-bottom: 1px solid #eef1f6;
}

.yfa__tab {
    position: relative;
    padding: 0 2px 13px;
    border: 0;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    color: #9aa2b1;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    transition: color .2s ease;
}

.yfa__tab:hover {
    color: #4b5563;
}

.yfa__tab.is-active {
    color: #1c1f26;
}

.yfa__tab::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 2px;
    background-color: #db2131;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .24s cubic-bezier(.22, .85, .28, 1);
}

.yfa__tab.is-active::after {
    transform: scaleX(1);
}

/* 表单 */
.yfa__form {
    display: none;
}

.yfa__form.is-active {
    display: block;
    animation: yfa-fade .22s ease both;
}

.yfa__field {
    display: block;
    margin-bottom: 14px;
}

.yfa__label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    line-height: 1;
    color: #6b7280;
}

.yfa__field input {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #e3e7ee;
    border-radius: 9px;
    background-color: #fafbfd;
    font-size: 14px;
    color: #1c1f26;
    outline: none;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.yfa__field input::placeholder {
    color: #b3bac6;
}

.yfa__field input:focus {
    border-color: #db2131;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(219, 33, 49, .1);
}

.yfa__field.has-error input {
    border-color: #db2131;
    background-color: #fff7f7;
}

/* 验证码一行 */
.yfa__code {
    display: flex;
    gap: 10px;
}

.yfa__code input {
    flex: 1 1 auto;
    min-width: 0;
}

.yfa__code-btn {
    flex: 0 0 116px;
    height: 46px;
    padding: 0;
    border: 1px solid #db2131;
    border-radius: 9px;
    background-color: #fff;
    font-size: 13px;
    color: #db2131;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

.yfa__code-btn:hover:not(:disabled) {
    background-color: #fdf2f3;
}

.yfa__code-btn:disabled {
    border-color: #e3e7ee;
    background-color: #f5f6f9;
    color: #a6adba;
    cursor: default;
}

/* 记住我 / 忘记密码 */
.yfa__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 18px;
}

.yfa__check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}

.yfa__check input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.yfa__check i {
    position: relative;
    display: block;
    width: 15px;
    height: 15px;
    border: 1px solid #cfd5df;
    border-radius: 3px;
    background-color: #fff;
    transition: background-color .16s ease, border-color .16s ease;
}

.yfa__check input:checked + i {
    border-color: #db2131;
    background-color: #db2131;
}

.yfa__check input:checked + i::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border-right: 1.5px solid #fff;
    border-bottom: 1.5px solid #fff;
    transform: rotate(42deg);
}

.yfa__link {
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 13px;
    color: #db2131;
    cursor: pointer;
    transition: opacity .2s ease;
}

.yfa__link:hover {
    opacity: .76;
}

/* 提示 */
.yfa__tip {
    margin: 0 0 14px;
    padding: 9px 12px;
    border-radius: 8px;
    background-color: #fff2f2;
    font-size: 12.5px;
    line-height: 1.6;
    color: #b02a2a;
    word-break: break-all;
}

.yfa__tip.is-ok {
    background-color: #effaf3;
    color: #12794a;
}

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

/* 提交 */
.yfa__submit {
    display: block;
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 9px;
    background-image: linear-gradient(120deg, #e8354a 0%, #c8182b 100%);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .16em;
    color: #fff;
    cursor: pointer;
    transition: box-shadow .22s ease, transform .22s ease, opacity .22s ease;
}

.yfa__submit:hover:not(:disabled) {
    box-shadow: 0 8px 20px rgba(200, 24, 43, .28);
    transform: translateY(-1px);
}

.yfa__submit:disabled {
    opacity: .66;
    cursor: default;
}

.yfa__switch {
    margin: 16px 0 0;
    font-size: 13px;
    color: #8b93a1;
    text-align: center;
}

/* 打开弹窗时锁滚动（JS 加类） */
body.yfa-open {
    overflow: hidden;
}

/* 小屏 */
@media (max-width: 640px) {
    .yfa {
        padding: 14px;
        align-items: flex-start;
        padding-top: 8vh;
    }

    .yfa__panel {
        width: 100%;
        padding: 26px 20px 22px;
        border-radius: 14px;
    }

    .yfa__tab {
        font-size: 16.5px;
    }

    .yfa__code-btn {
        flex: 0 0 104px;
        font-size: 12.5px;
    }
}

/* 尊重「减少动效」 */
@media (prefers-reduced-motion: reduce) {
    .yfa__mask,
    .yfa__panel,
    .yfa__form.is-active {
        animation: none;
    }

    .yfa__tab::after,
    .yfa__submit,
    .yfa__field input {
        transition: none;
    }
}

/* ============================================================================
 * 页头账号区（2026-11-11 重做）
 * ----------------------------------------------------------------------------
 * 未登录：「登录 | 注册」。原来的 <span role="button"> 没有 cursor:pointer，
 *   鼠标划过是**文本光标（一条竖线）**，客户描述成「显示一个竖条、没有按钮」。
 *   现在统一挂 .yf-auth-link 修掉，并补 hover 色与键盘焦点环。
 *   中间那条竖线改成 CSS 画（.yf-auth-sep）：原先用切图，其中两张在主题里根本
 *   不存在，缺图时浏览器渲染出的正是「一个竖条」（破图占位）。
 *
 * 登录后：白底胶囊 + 头像 + 用户名 + ⌄，点开下拉「用户中心 / 修改密码 / 退出登录」。
 *   为什么用固定白底：这行要出现在三种底色上 —— 首页 hero（深色图）、
 *   悬浮条（#999ca3 灰）、内页页头（浅色图）。白底 + 深字在三种底上都清晰，
 *   不必按页再写一套配色（之前那版白色文字压在灰底上几乎看不见，就是反例）。
 *
 * 各页原本的定宽药丸容器（text_2 / image_2 / section_1 / group_2 / block_3）
 * 在登录态下用 :has() 让位：只保留 margin 定位，外观交给下面的胶囊。
 * ========================================================================== */

.yf-auth-entry,
.yf-auth-entry * {
    box-sizing: border-box;
}

.text_2:has(.yf-auth-entry),
.image_2:has(.yf-auth-entry),
.section_1:has(.yf-auth-entry),
.group_2:has(.yf-auth-entry),
.block_3:has(.yf-auth-entry) {
    width: auto !important;
    min-width: 0;
    height: auto;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: visible;
}

.yf-auth-entry {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: clamp(26px, 1.5vw, 34px);
    padding: 0;
    /* ★ 2026-11-11 客户要求：登录后导航上的白色背景去掉、手机号改红色。
       去掉白底后是「头像 + 红字 + 箭头」直接浮在 banner 上，比一块白胶囊轻得多；
       红色同时解决深色 banner 与浅色 banner 两种底色的可读性。
       下拉菜单本身仍是白底（浮层需要实底），只是这一行不再有底。 */
    background-color: transparent;
    border: 0;
    border-radius: clamp(14px, .9vw, 20px);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: clamp(12px, .83vw, 15px);
    line-height: 1;
    color: #db2131;
    white-space: nowrap;
    box-shadow: none;
    -webkit-font-smoothing: antialiased;
}

/* ── 触发区（头像 + 名字 + 箭头） ── */
.yf-auth-entry__trigger {
    display: inline-flex;
    align-items: center;
    gap: clamp(5px, .42vw, 8px);
    height: 100%;
    padding: 0 clamp(2px, .2vw, 4px);
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    border-radius: inherit;
    transition: color .18s ease;
}

/* 触发区本身就是红色，hover 走深一档（否则 hover 没反馈） */
.yf-auth-entry__trigger:hover { color: #b81b28; }

.yf-auth-entry__trigger:focus-visible {
    outline: 2px solid rgba(219, 33, 49, .5);
    outline-offset: 2px;
    border-radius: 999px;
}

/* ── 头像 ── */
.yf-auth-entry__avatar {
    display: block;
    flex: 0 0 auto;
    width: clamp(18px, 1.16vw, 24px);
    height: clamp(18px, 1.16vw, 24px);
    border-radius: 50%;
    object-fit: cover;
    background-color: #eef1f6;
}

/* 没上传头像时的默认卡通头像：内联 SVG，不额外发一次图片请求。
   ★ 2026-11-11 客户要求「头像改为彩色」——原先是一整块灰（#eef1f6 + #b7bfcc），
     和页面里的白色胶囊叠在一起像没加载出来。改成橙金渐变圆底 + 奶白人物，
     与站点 logo 的红橙心形同一色系。 */
.yf-auth-entry__avatar--default {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23ffc46b'/%3E%3Cstop offset='1' stop-color='%23f2864a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='48' height='48' rx='24' fill='url(%23a)'/%3E%3Ccircle cx='24' cy='18.6' r='7.2' fill='%23fff6ea'/%3E%3Cpath d='M37.2 40.4a13.2 13.2 0 0 0-26.4 0z' fill='%23fff6ea'/%3E%3C/svg%3E");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ── 用户名（过长省略，不撑破页头） ──
   ★ 2026-11-11 客户要求「不悬浮时手机号码加粗」：500 → 700。
     没有白底之后这一行只剩「头像 + 号码 + 箭头」，号码不加粗会显得飘。 */
.yf-auth-entry__name {
    display: block;
    max-width: clamp(64px, 7vw, 132px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    letter-spacing: .01em;
}

/* ── 下拉箭头 ── */
.yf-auth-entry__caret {
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    margin-left: 1px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-1px, -1px);
    transition: transform .22s ease;
}

.yf-auth-entry.is-open .yf-auth-entry__caret {
    transform: rotate(-135deg) translate(-2px, -2px);
}

/* ── 下拉菜单 ── */
.yf-auth-entry__menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 80;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: clamp(132px, 9.2vw, 172px);
    padding: 6px;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, .07);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(20, 26, 38, .16);
}

/* display:flex 会盖掉 hidden 自带的 display:none，必须显式压回 */
.yf-auth-entry__menu[hidden] {
    display: none;
}

.yf-auth-entry__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background-color: transparent;
    color: #3a3c43;
    font-family: inherit;
    font-size: clamp(12px, .78vw, 14px);
    line-height: 1.3;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .16s ease, color .16s ease;
}

.yf-auth-entry__item svg {
    flex: 0 0 auto;
    opacity: .6;
    transition: opacity .16s ease;
}

.yf-auth-entry__item:hover {
    background-color: #f4f6f9;
    color: #db2131;
}

.yf-auth-entry__item:hover svg { opacity: 1; }

/* 三项的 padding 完全一致（8px 10px），分隔线交给上面的 .yf-auth-entry__sep。
   之前给这一项单独 padding-top:10px + border-top，会把「退出登录」整体往下推 2px，
   图标基线就跟上面两项错开 —— 客户一眼看出来的「没对齐」就是这个。 */
.yf-auth-entry__item--out { margin: 0; }

/* ★★ 为什么单独再写一条 padding / border：
   全局有 `.yf-root button { padding: 0; border: 1px solid transparent; }`，
   特异性 (0,1,1) 高于 `.yf-auth-entry__item` (0,1,0) ——
   结果前两项是 <a>（有 10px 内边距），第三项是 <button> 被压成 0 内边距 + 1px 边框，
   图标和文字整体左移 9px。这正是客户说的「退出登录和上面两项没对齐」。
   用 .yf-auth-entry__menu 前缀把特异性提到 (0,2,0)，压过全局按钮重置。 */
.yf-auth-entry__menu .yf-auth-entry__item {
    padding: 8px 10px;
    border: 0;
    background-color: transparent;
    font-family: inherit;
    text-align: left;
}

/* 菜单内分隔线：线本身占 1px + 上下 5px 间距，不参与任何一项的内边距 */
.yf-auth-entry__sep {
    flex: 0 0 auto;
    height: 1px;
    margin: 5px 8px;
    background-color: #f0f2f6;
}

.yf-auth-entry__item--out:hover { color: #d92d20; }

/* ── 未登录：登录 / 注册（2026-11-11 第三轮：白底黑字）───────────────
   客户最终口径：不管悬浮与否，**两个都是白底、黑字**，并且靠中间竖线更近。
   （上一版是「登录透明文字 + 注册红色实心」，被否掉了）

   为什么白底：这一行要出现在三种底色上 —— 首页 hero（深色图）、悬浮条（#999ca3 灰）、
   内页页头（浅色图）。白胶囊 + 黑字在三种底上都清晰，且不需要按页写三套配色。
   容器（各页原有的白色胶囊 text_2 / image_2 …）在未登录时透明化，避免胶囊套胶囊。 */
.text_2:has(.yf-auth-link),
.image_2:has(.yf-auth-link),
.section_1:has(.yf-auth-link),
.group_2:has(.yf-auth-link),
.block_3:has(.yf-auth-link) {
    width: auto !important;
    height: auto;
    gap: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    overflow: visible;
}

.yf-auth-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 各页原 class 带定宽定高与 margin，必须压掉，否则两段之间会莫名留白 */
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    /* 左右内边距收窄：客户要求「两个按钮靠近中间竖线」，
       竖线两侧的间距 = 左右 padding + .yf-auth-sep 的 margin，两处都收 */
    padding: clamp(5px, .42vw, 7px) clamp(9px, .72vw, 12px) !important;
    border: 0;
    border-radius: 999px;
    background-color: #fff;
    color: #262b33 !important;
    font-family: inherit;
    font-size: clamp(12px, .83vw, 15px);
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(20, 26, 38, .12);
    transition: color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.yf-auth-link:hover {
    color: #db2131 !important;
    box-shadow: 0 2px 8px rgba(20, 26, 38, .18);
}

.yf-auth-link:focus-visible {
    outline: 2px solid rgba(219, 33, 49, .55);
    outline-offset: 2px;
}

/* 注册保持与登录完全一致的白底黑字（客户要求「两个都是白底黑字」，
   不再用红色实心区分 —— 区分交给中间那道竖线） */
.yf-auth-link[data-yf-auth-open="register"] {
    background-color: #fff;
    color: #262b33 !important;
    font-weight: 500;
}

.yf-auth-link[data-yf-auth-open="register"]:hover {
    background-color: #fff;
    color: #db2131 !important;
}

/* 分隔竖线：只在线两侧留一点距离，高度跟文字走 */
.yf-auth-sep {
    display: inline-block;
    flex: 0 0 auto;
    width: 1px;
    height: .9em;
    /* 客户要求「两个按钮靠近中间竖线」：两侧间距 7~11px → 3~5px */
    margin: 0 clamp(3px, .26vw, 5px) !important;
    /* 固定中性灰：白胶囊左右夹着，在深色 banner 与灰色悬浮条上都能看见 */
    background-color: #9aa1ad;
    opacity: .75;
    vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════════════════════
   找回密码（2026-11-12）
   --------------------------------------------------------------------------
   第三个页签「找回密码」定位成**次要入口**：字号小一档、靠右站，
   不跟「登录 / 注册」抢视觉重量（这两个才是弹窗的主任务）；
   被激活时用品牌红标识当前位置。
   ══════════════════════════════════════════════════════════════════════════ */
.yfa__tab--minor {
    margin-left: auto;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0;
}

.yfa__tab--minor.is-active { color: #db2131; }

/* 找回密码页签顶部的一句说明：讲清「填手机号、验证码发到邮箱」，
   否则用户会以为这里要填邮箱地址 */
.yfa__lead {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.7;
    color: #6b7280;
}
