/**
 * Niankang 统一弹窗样式（layer.js 皮肤覆盖）
 * 作用范围：全站 PC / Mobile / Member 的 layer 弹窗
 *
 * 实现要点（务必保留）：
 * 1. layer 的内部 `r.open()` 不会经过 `layer.open`，所以「包裹 layer.open」无法覆盖
 *    layer.alert / confirm / msg / load / tips，只能用 CSS 覆盖。
 * 2. layer.css 是由 layer.js 动态插入 <head> 的，位置在本文件之后，
 *    因此同优先级下 layer.css 会赢 —— 本文件所有覆盖一律使用 !important。
 * 3. 作用域用 layer 自带的类型类（layui-layer-dialog / -page / -iframe），
 *    并排除 loading(3)、tips(4)、msg 与 photos，避免误伤。
 * 4. 关闭按钮：layer 在「无标题」时使用 layui-layer-close2，其定位是
 *    right:-28px; top:-28px（弹窗外部）。父卡片有圆角裁剪，会把 X 切掉一半，
 *    所以这里统一把关闭按钮拉回卡片内部。
 */

/* ================= 1. 遮罩 ================= */
/* 只改底色，opacity 保留 layer 内联设置（load 的 shade:.01 等不能被放大） */
.layui-layer-shade {
    background-color: #0f172a !important;
}

/* ================= 2. 卡片容器 ================= */
.layui-layer-dialog:not(.layui-layer-msg),
.layui-layer-page:not(.layui-layer-photos),
.layui-layer-iframe:not(.layui-layer-photos) {
    border: none !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    box-shadow: 0 24px 48px -12px rgba(15, 23, 42, .22),
                0 4px 12px -4px rgba(15, 23, 42, .10) !important;
    overflow: hidden !important;
    color: #374151 !important;
    -webkit-font-smoothing: antialiased;
}

/* ================= 3. 标题栏 ================= */
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-title,
.layui-layer-page:not(.layui-layer-photos) .layui-layer-title,
.layui-layer-iframe:not(.layui-layer-photos) .layui-layer-title {
    height: auto !important;
    line-height: 1.5 !important;
    padding: 20px 56px 14px 24px !important; /* 右侧留出关闭按钮位置 */
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    background: transparent !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

/* ================= 4. 内容区 ================= */
/* 4.1 纯文字（无图标）：顶部留足空间避开关闭按钮 */
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content {
    padding: 36px 40px 8px !important;
    margin-left: 0 !important;
    font-size: 16px !important;
    line-height: 1.6 !important;
    color: #374151 !important;
    text-align: center !important;
    word-break: break-word !important;
    overflow-wrap: anywhere;
}

/* 4.2 带图标：图标居中在文字上方 */
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content.layui-layer-padding {
    padding: 28px 40px 6px !important;
    margin-left: 0 !important;
    text-align: center !important;
}

/* 4.3 page / iframe 内容铺满，不做内边距 */
.layui-layer-page:not(.layui-layer-photos) .layui-layer-content,
.layui-layer-iframe:not(.layui-layer-photos) .layui-layer-content {
    padding: 0 !important;
    margin: 0 !important;
    text-align: left !important;
    font-size: 14px !important;
}

/* 4.4 内容里的富文本（图片、链接、表格）兜底 */
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content img {
    max-width: 100%;
    height: auto;
}
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content a {
    color: #0097a7;
    text-decoration: underline;
}

/* ================= 5. 提示图标（覆盖 layer 默认雪碧图） ================= */
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content > .layui-layer-ico {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    float: none !important;
    display: block !important;
    width: 72px !important;
    height: 72px !important;
    margin: 0 auto 16px !important;
    background: none !important;
}

.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content > .layui-layer-ico::before {
    content: '';
    display: block;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 36px 36px;
}

/* icon 1 警告 */
.layui-layer-ico1::before {
    background-color: #fffbeb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
}

/* icon 2 错误 */
.layui-layer-ico2::before {
    background-color: #fef2f2;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M15 9l-6 6M9 9l6 6'/%3E%3C/svg%3E");
}

/* icon 3 询问 */
.layui-layer-ico3::before {
    background-color: #eff6ff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
}

/* icon 4 锁 */
.layui-layer-ico4::before {
    background-color: #f1f5f9;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
}

/* icon 5 哭脸 */
.layui-layer-ico5::before {
    background-color: #fff7ed;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f97316' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M16 16s-1.5-2-4-2-4 2-4 2M9 9h.01M15 9h.01'/%3E%3C/svg%3E");
}

/* icon 6 成功 */
.layui-layer-ico6::before {
    background-color: #ecfdf5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M8.5 12.5l2.5 2.5 4.5-5'/%3E%3C/svg%3E");
}

/* icon 7 提示 */
.layui-layer-ico7::before {
    background-color: #f0f9ff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230ea5e9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-5M12 8h.01'/%3E%3C/svg%3E");
}

/* ================= 6. 关闭按钮（统一拉回卡片内部） ================= */
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-setwin,
.layui-layer-page:not(.layui-layer-photos) .layui-layer-setwin,
.layui-layer-iframe:not(.layui-layer-photos) .layui-layer-setwin {
    top: 8px !important;
    right: 8px !important;
    font-size: 0 !important;
    line-height: 0 !important;
    z-index: 10;
}

.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-setwin a,
.layui-layer-page:not(.layui-layer-photos) .layui-layer-setwin a,
.layui-layer-iframe:not(.layui-layer-photos) .layui-layer-setwin a {
    /* 关键：把 close2 的 right:-28px / top:-28px 绝对定位中和掉 */
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    display: inline-block !important;
    width: 30px !important;
    height: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: transparent !important;
    vertical-align: top !important;
    cursor: pointer;
    opacity: 1 !important;
    transition: background-color .18s ease;
}

.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-setwin a::before,
.layui-layer-page:not(.layui-layer-photos) .layui-layer-setwin a::before,
.layui-layer-iframe:not(.layui-layer-photos) .layui-layer-setwin a::before {
    content: '';
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 13px 13px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
}

.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-setwin a:hover,
.layui-layer-page:not(.layui-layer-photos) .layui-layer-setwin a:hover,
.layui-layer-iframe:not(.layui-layer-photos) .layui-layer-setwin a:hover {
    background-color: #f1f5f9 !important;
    opacity: 1 !important;
}

.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-setwin a:hover::before,
.layui-layer-page:not(.layui-layer-photos) .layui-layer-setwin a:hover::before,
.layui-layer-iframe:not(.layui-layer-photos) .layui-layer-setwin a:hover::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f172a' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
}

/* iframe / page 弹窗：关闭按钮下垫一层白底，避免压在内容上看不清 */
.layui-layer-iframe:not(.layui-layer-photos) .layui-layer-setwin a,
.layui-layer-page:not(.layui-layer-photos) .layui-layer-setwin a {
    background-color: #ffffff !important;
    box-shadow: 0 1px 6px rgba(15, 23, 42, .16) !important;
}

/* 隐藏 layer 默认关闭雪碧图 */
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-close,
.layui-layer-page .layui-layer-close,
.layui-layer-iframe .layui-layer-close {
    background-image: none !important;
}

/* ================= 7. 按钮区 ================= */
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-btn,
.layui-layer-page:not(.layui-layer-photos) .layui-layer-btn,
.layui-layer-iframe:not(.layui-layer-photos) .layui-layer-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 24px 26px !important;
    margin: 0 !important;
    border-top: none !important;
    background: transparent !important;
    text-align: center !important;
}

/* btn:[] 时 layer 仍会输出一个空按钮容器，这里消掉它的上内边距 */
.layui-layer-btn:empty {
    padding: 0 0 24px !important;
}

.layui-layer-btn a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 108px;
    height: 42px;
    padding: 0 22px !important;
    margin: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    font-weight: 500 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.layui-layer-btn a:focus-visible {
    outline: 2px solid #0097a7;
    outline-offset: 2px;
}

/* 主按钮 */
.layui-layer-btn a.layui-layer-btn0 {
    background-color: #0097a7 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px -2px rgba(0, 151, 167, .32) !important;
}

.layui-layer-btn a.layui-layer-btn0:hover {
    background-color: #007c8a !important;
    box-shadow: 0 6px 16px -4px rgba(0, 151, 167, .42) !important;
    transform: translateY(-1px);
}

.layui-layer-btn a.layui-layer-btn0:active {
    transform: translateY(0);
}

/* 次按钮（含第三个按钮） */
.layui-layer-btn a.layui-layer-btn1,
.layui-layer-btn a.layui-layer-btn2 {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
}

.layui-layer-btn a.layui-layer-btn1:hover,
.layui-layer-btn a.layui-layer-btn2:hover {
    background-color: #e2e8f0 !important;
    color: #0f172a !important;
}

/* ================= 8. 纯文字 msg 提示（toast） ================= */
.layui-layer-msg {
    min-width: 140px !important;
    border: none !important;
    border-radius: 10px !important;
    background-color: rgba(15, 23, 42, .9) !important;
    box-shadow: 0 12px 28px -8px rgba(15, 23, 42, .5) !important;
    overflow: hidden !important;
}

.layui-layer-msg .layui-layer-content {
    padding: 13px 24px !important;
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
    color: #ffffff !important;
    text-align: center !important;
}

.layui-layer-msg .layui-layer-content > .layui-layer-ico {
    position: static !important;
    display: inline-block !important;
    vertical-align: -4px !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 8px 0 0 !important;
    background: none !important;
}

.layui-layer-msg .layui-layer-content > .layui-layer-ico::before {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
}

.layui-layer-msg .layui-layer-ico1::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fbbf24' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
}

.layui-layer-msg .layui-layer-ico2::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f87171' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M15 9l-6 6M9 9l6 6'/%3E%3C/svg%3E");
}

.layui-layer-msg .layui-layer-ico6::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M8.5 12.5l2.5 2.5 4.5-5'/%3E%3C/svg%3E");
}

.layui-layer-msg .layui-layer-ico7::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-5M12 8h.01'/%3E%3C/svg%3E");
}

/* ================= 9. 输入 / prompt 弹窗 ================= */
.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-input {
    width: 100% !important;
    height: 42px !important;
    margin-top: 14px !important;
    padding: 8px 14px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    color: #334155 !important;
    background-color: #fff !important;
    outline: none !important;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.layui-layer-dialog:not(.layui-layer-msg) .layui-layer-input:focus {
    border-color: #0097a7 !important;
    box-shadow: 0 0 0 3px rgba(0, 151, 167, .12) !important;
}

/* ================= 10. 入场 / 退场动画 ================= */
.layui-layer-dialog:not(.layer-anim-close).layer-anim,
.layui-layer-page:not(.layer-anim-close).layer-anim,
.layui-layer-iframe:not(.layer-anim-close).layer-anim,
.layui-layer-msg:not(.layer-anim-close).layer-anim {
    animation: nk-dialog-in .26s cubic-bezier(.16, 1, .3, 1) both !important;
}

@keyframes nk-dialog-in {
    from {
        opacity: 0;
        transform: scale(.94) translateY(-8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .layui-layer-dialog.layer-anim,
    .layui-layer-page.layer-anim,
    .layui-layer-iframe.layer-anim,
    .layui-layer-msg.layer-anim {
        animation: none !important;
    }
}

/* ================= 11. 移动端适配 ================= */
@media (max-width: 768px) {
    /* 只限制宽度，水平居中仍交给 layer 的 offset()（它按最终外宽计算，不会被破坏） */
    .layui-layer-dialog:not(.layui-layer-msg) {
        width: 86% !important;
        max-width: 360px !important;
        min-width: 0 !important;
        border-radius: 14px !important;
    }

    .layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content {
        padding: 32px 22px 6px !important;
        font-size: 15px !important;
    }

    .layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content.layui-layer-padding {
        padding: 26px 22px 4px !important;
    }

    .layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content > .layui-layer-ico {
        width: 60px !important;
        height: 60px !important;
        margin-bottom: 14px !important;
    }

    .layui-layer-dialog:not(.layui-layer-msg) .layui-layer-content > .layui-layer-ico::before {
        width: 60px;
        height: 60px;
        background-size: 30px 30px;
    }

    .layui-layer-dialog:not(.layui-layer-msg) .layui-layer-btn {
        padding: 14px 18px 22px !important;
        gap: 10px;
    }

    .layui-layer-dialog:not(.layui-layer-msg) .layui-layer-btn a {
        min-width: 92px;
        height: 40px;
        font-size: 14px !important;
    }

    .layui-layer-msg .layui-layer-content {
        padding: 12px 18px !important;
    }
}

/* ================= 12. RTL 适配 ================= */
[dir="rtl"] .layui-layer-dialog:not(.layui-layer-msg) .layui-layer-setwin,
[dir="rtl"] .layui-layer-page:not(.layui-layer-photos) .layui-layer-setwin,
[dir="rtl"] .layui-layer-iframe:not(.layui-layer-photos) .layui-layer-setwin {
    right: auto !important;
    left: 8px !important;
}

[dir="rtl"] .layui-layer-dialog:not(.layui-layer-msg) .layui-layer-title,
[dir="rtl"] .layui-layer-page:not(.layui-layer-photos) .layui-layer-title,
[dir="rtl"] .layui-layer-iframe:not(.layui-layer-photos) .layui-layer-title {
    padding: 20px 24px 14px 56px !important;
}

[dir="rtl"] .layui-layer-btn {
    direction: rtl;
}

[dir="rtl"] .layui-layer-msg .layui-layer-content > .layui-layer-ico {
    margin: 0 0 0 8px !important;
}
