/* ============================================================
 * next-chrome 兼容补丁样式
 * 作用：让移植过来的 next-alpha 头尾（site-chrome / n6-*）与旧项目
 * 既有 DOM 钩子（购物车 #cart-block、artTemplate #cartTemplete、
 * [name="mycart_count"] 等）共存。只做展示层适配，不涉及业务逻辑。
 * ============================================================ */

/* ---- 头部：旧购物车组件在新头部中的外观适配（保留全部旧类名/钩子） ---- */
body .site-chrome-header .n6-cart-widget {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0;
    border-radius: 0;
    background: none;
}

body .site-chrome-header .n6-utility.n6-cart-widget:hover {
    background: none;
}

body .site-chrome-header .n6-cart-widget .n_c_h_c_cart_content {
    height: auto;
    padding: 0;
    margin: 0;
    background: transparent;
    border-radius: 0;
    color: inherit;
    line-height: normal;
}

body .site-chrome-header .n6-cart-widget .n_c_h_c_cart_content a {
    color: inherit;
}

body .site-chrome-header .n6-cart-widget .cart-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 13px;
    border-radius: 999px;
    color: #4a4460;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

body .site-chrome-header .n6-cart-widget .cart-link:hover {
    color: var(--site-chrome-purple);
    background: #f3eff7;
}

body .site-chrome-header .n6-cart-widget .n6-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

body .site-chrome-header .n6-cart-widget .n6-icon svg {
    width: 20px;
    height: 20px;
}

/* 徽标沿用 site-chrome 的 .n6-badge，内部数值节点保持 [name="mycart_count"] */
body .site-chrome-header .n6-cart-widget .n6-badge {
    font-style: normal;
}

body .site-chrome-header .n6-cart-widget .cart_number {
    display: none;
}

/* 旧空面板（.cart_content）保持隐藏，避免与新头部冲突 */
body .site-chrome-header .n6-cart-widget .cart_content {
    display: none !important;
}

/* artTemplate 渲染容器 #div_mycart（.cart-block）：悬停时展示购物车清单。
   右对齐（right:-1px）而非居中：居中形态下 380px 面板会在 ≤1420 视口越出
   视口右缘（T10 记录的 @1366 全站 69px 横向溢出）；右对齐后任意分辨率均不溢出 */
body .site-chrome-header .n6-cart-widget .cart-block {
    top: 100%;
    right: -1px;
    width: 380px;
    border: 1px solid var(--site-chrome-line);
    border-radius: 12px;
    box-shadow: var(--site-chrome-shadow);
}

/* 总计行：金额大位数也不换行（支持几十万级金额） */
body .site-chrome-header .n6-cart-widget .cart-block .toal-cart {
    display: flex;
    gap: 10px;
    align-items: baseline;
    justify-content: space-between;
    white-space: nowrap;
}

body .site-chrome-header .n6-cart-widget .cart-block .toal-cart b.pull-right {
    float: none;
    margin-left: auto;
}

/* 商品多时仅清单区内部滚动，总额行与「去购物车结算」固定钉在浮窗底部 */
body .site-chrome-header .n6-cart-widget .cart-block {
    display: flex;
    flex-direction: column;
    max-height: 520px;
    overflow: hidden;
}

body .site-chrome-header .n6-cart-widget .cart-block .cart-block-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    padding: 0 0 18px;
    overflow: hidden;
}

/* 清单区自带左右留白：滚动条贴住浮窗右缘，而不是隔着一圈 padding */
body .site-chrome-header .n6-cart-widget .cart-block .cart-block-list {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 14px 0 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d9d2e3 transparent;
}

body .site-chrome-header .n6-cart-widget .cart-block .cart-block-list::-webkit-scrollbar {
    width: 6px;
}

body .site-chrome-header .n6-cart-widget .cart-block .cart-block-list::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: #d9d2e3;
}

body .site-chrome-header .n6-cart-widget .cart-block .cart-block-list::-webkit-scrollbar-track {
    background: transparent;
}

/* 清单内长文本（商品名/商品编号等长串）超出宽度时自动换行，不溢出裁切 */
body .site-chrome-header .n6-cart-widget .cart-block .cart-block-list .product-info .p-name,
body .site-chrome-header .n6-cart-widget .cart-block .cart-block-list .product-info .p-right {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

body .site-chrome-header .n6-cart-widget .cart-block .toal-cart,
body .site-chrome-header .n6-cart-widget .cart-block .cart-buttons {
    flex: 0 0 auto;
    width: auto; /* 旧样式 width:100% + 左右外边距会溢出被裁切，改为自动收缩 */
    margin-right: 20px;
    margin-left: 20px;
}

/* 空购物车占位文案：容器去 padding 后由它自己撑出留白 */
body .site-chrome-header .n6-cart-widget .cart-block .cart_no {
    padding: 20px;
}

body .site-chrome-header .n6-cart-widget:hover .cart-block,
body .site-chrome-header .n6-cart-widget .cart-block:hover {
    opacity: 1;
    visibility: visible;
    transform: translate(0, 0);
}

/* 悬浮面板「去购物车结算」按钮：紫色主题（覆盖旧 style.css 绿色） */
body .site-chrome-header .n6-cart-widget .cart-block .cart-buttons a.btn-check-out {
    border-radius: 10px;
    background: var(--site-chrome-purple);
}

body .site-chrome-header .n6-cart-widget .cart-block .cart-buttons a.btn-check-out:hover {
    opacity: 1;
    background: #5a2e85;
}

/* 登录后用户下拉中的未读红点沿用旧样式钩子（重置旧样式的 relative 偏移，随 flex 垂直居中） */
body .site-chrome-header .n6-user-dropdown .unread_message {
    position: static;
    top: auto;
    left: auto;
    display: inline-block;
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-left: 4px;
    border-radius: 50%;
    background: #ff2033;
    vertical-align: middle;
}

/* ---- 头部：搜索按钮沿用 site-chrome 基础样式（紫色渐变底、白色底光效）；
   图标描边为金色渐变（见模板内 svg linearGradient#n6-search-gold），
   此处不再覆盖其背景与尺寸 ---- */

/* ---- 暂时隐藏夜间/日间模式切换入口（头部按钮 + 抽屉入口），后续需要时移除本段即可 ---- */
body .site-chrome-header .yys-theme-toggle,
body .site-chrome-drawer .n6-mobile-theme-toggle {
    display: none !important;
}

/* ---- 旧头部遗留的占位元素不再使用（.new_affixed 悬浮工具条恢复展示，样式同正式版） ---- */
.placeholder_box,
.new_common_header,
.new_common_footer {
    display: none !important;
}

/* ---- 个人中心布局（ucenter2_new）底部为绝对定位，规范化新页脚外观 ---- */
#new_member .site-chrome-footer {
    width: 100%;
    margin: 22px 0 0;
    border-radius: 0;
}

#new_member .n6-footer-custom {
    padding-bottom: 12px;
}

/* ============================================================
 * 头部夜间模式按钮基础样式
 * 新站该按钮样式位于 yys-theme.css（未整体引入），此处按原样补齐，
 * 供头部/抽屉共用；缺失时按钮会呈浏览器默认外观并造成错位。
 * ============================================================ */
body .site-chrome-header .yys-theme-toggle,
body .site-chrome-drawer .yys-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid rgba(74, 35, 117, .16);
    border-radius: 999px;
    color: #4a4460;
    background: rgba(255, 255, 255, .78);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: color .2s, background-color .2s, border-color .2s;
}

body .site-chrome-header .yys-theme-toggle:hover,
body .site-chrome-header .yys-theme-toggle:focus-visible,
body .site-chrome-drawer .yys-theme-toggle:hover,
body .site-chrome-drawer .yys-theme-toggle:focus-visible {
    border-color: rgba(74, 35, 117, .34);
    color: #3d1e58;
    background: #f3eff7;
    outline: 0;
}

body .site-chrome-header .yys-theme-toggle-icon,
body .site-chrome-drawer .yys-theme-toggle-icon {
    display: inline-grid;
    width: 16px;
    height: 16px;
    place-items: center;
    font-size: 15px;
    line-height: 1;
}

body .site-chrome-header .yys-theme-toggle-icon::before,
body .site-chrome-drawer .yys-theme-toggle-icon::before {
    content: "\2600";
}

html[data-yys-theme="dark"] body .site-chrome-header .yys-theme-toggle,
html[data-yys-theme="dark"] body .site-chrome-drawer .yys-theme-toggle {
    border-color: rgba(234, 220, 185, .22);
    color: #f3dfb1;
    background: rgba(54, 49, 43, .82);
}

html[data-yys-theme="dark"] body .site-chrome-header .yys-theme-toggle:hover,
html[data-yys-theme="dark"] body .site-chrome-header .yys-theme-toggle:focus-visible,
html[data-yys-theme="dark"] body .site-chrome-drawer .yys-theme-toggle:hover,
html[data-yys-theme="dark"] body .site-chrome-drawer .yys-theme-toggle:focus-visible {
    border-color: rgba(234, 220, 185, .42);
    color: #fff1c9;
    background: rgba(73, 64, 53, .94);
}

html[data-yys-theme="dark"] body .site-chrome-header .yys-theme-toggle-icon::before,
html[data-yys-theme="dark"] body .site-chrome-drawer .yys-theme-toggle-icon::before {
    content: "\263E";
}

/* ============================================================
 * 响应式断点修正（≤1600px）
 * 要求：右侧功能入口收成纯图标；左侧配置入口收进「快捷入口」下拉；
 * 不允许在 821–1600px 区间退化为「仅搜索栏 + 抽屉按钮」的单行模式。
 * ============================================================ */
@media (max-width: 1600px) {
    /* 左侧：导航链接隐藏，快捷入口下拉常驻 */
    body .site-chrome-header .n6-nav-link {
        display: none;
    }

    body .site-chrome-header .n6-guide-menu {
        display: block;
    }

    /* 右侧：统一为等宽图标按钮，去掉文字与分隔线，避免挤压错位 */
    body .site-chrome-header .n6-utilities {
        gap: 2px;
        flex: 0 0 auto;
    }

    body .site-chrome-header .n6-utility {
        flex: 0 0 auto;
        justify-content: center;
        gap: 0;
        min-width: 40px;
        min-height: 40px;
        padding: 8px 10px;
    }

    /* 文字标签隐藏（图标/角标保留） */
    body .site-chrome-header .n6-utility > span:not(.n6-icon):not(.n6-badge-wrap) {
        display: none;
    }

    body .site-chrome-header .n6-user-menu > .n6-utility > span:last-child {
        display: none;
    }

    /* 相邻项分隔线在图标态下取消，统一内边距 */
    body .site-chrome-header .n6-utility + .n6-utility,
    body .site-chrome-header .n6-user-menu > .n6-utility {
        border-left: 0;
        padding-left: 10px;
    }

    /* 角标内收，防止压到相邻图标 */
    body .site-chrome-header .n6-badge {
        top: -6px;
        right: -4px;
        min-width: 16px;
        height: 16px;
        font-size: 9px;
        line-height: 16px;
    }

    /* 夜间模式按钮：图标态固定为正圆按钮 */
    body .site-chrome-header .yys-theme-toggle {
        gap: 0;
        width: 40px;
        min-height: 40px;
        padding: 8px 0;
    }

    body .site-chrome-header .yys-theme-toggle-label {
        display: none;
    }

    /* 购物车组件：图标态隐藏「购物车」文字并消除双层内边距，与其他图标等宽对齐 */
    body .site-chrome-header .n6-cart-widget {
        min-width: 40px;
        min-height: 40px;
        padding: 0;
    }

    body .site-chrome-header .n6-cart-widget .cart-link {
        gap: 0;
        width: 40px;
        min-width: 40px;
        min-height: 40px;
        justify-content: center;
        padding: 8px 0;
    }

    body .site-chrome-header .n6-cart-widget .cart-link > span:not(.n6-badge-wrap):not(.n6-icon) {
        display: none;
    }
}

/* ============================================================
 * 宽屏页固定缩放垫片（vp-scale.js）配套定点修正
 * 垫片激活时 html[data-vp-zoom] 成立、整页固定 88% 缩放
 * （有效视口 = 视口宽 / 0.88）；仅修正依赖 100vw（含滚动条宽度，
 * 缩放态下计算偏窄）的宽度，定宽值取原设计值 1332px，
 * 各分辨率一致。未激活时本段不生效。
 * ============================================================ */
html[data-vp-zoom] body.home .nh-submenu {
    width: 1332px;
}

/* ---- 字号规范（缩放垫片激活页生效，2026-10-30 起全站统一缩放即全站生效）：悬浮工具条文字 12px → 14px ---- */
html[data-vp-zoom] .new_affixed ul li.new_affixed_scan .new_code p {
    font-size: 14px;
}
