/*
 * 操作提示条与确认框（替代上游的 SweetAlert 中间页和弹窗），后台与登录页共用。
 * 规则都限定在 .cx-notices / .cx-modal-mask 内，并重置按钮样式，不受 Tabler 和登录页主题影响。
 * 视觉与后台控制台一致：#1677ff 主色、白底浮层、8px 圆角、2px 按钮圆角。
 */

.cx-notices {
    position: fixed;
    top: 16px;
    left: 50%;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: max-content;
    max-width: calc(100vw - 32px);
    transform: translateX(-50%);
    pointer-events: none;
}

.cx-notices .cx-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 16px 0 rgba(0, 0, 0, .08), 0 3px 6px -4px rgba(0, 0, 0, .12), 0 9px 28px 8px rgba(0, 0, 0, .05);
    color: rgba(0, 0, 0, .88);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 22px;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
    pointer-events: auto;
}

/* 登录页主题加载时用 !important 停掉全部动画、加载完再恢复，会让提示条重新淡入一次，这里固定住 */
body .cx-notices .cx-notice {
    animation: cx-notice-in .2s ease-out !important;
}

body .cx-notices .cx-notice.is-leaving {
    animation: cx-notice-out .2s ease-in forwards !important;
}

.cx-notices .cx-notice-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.cx-notice-icon,
.cx-modal-icon {
    flex: none;
    background: no-repeat center / contain;
}

.cx-notices .cx-notice-icon {
    width: 16px;
    height: 16px;
    margin-top: 3px;
}

.cx-notices .cx-notice-close {
    all: unset;
    flex: none;
    width: 16px;
    height: 16px;
    margin: 3px 0 0 4px;
    border-radius: 2px;
    color: rgba(0, 0, 0, .45);
    font-size: 16px;
    line-height: 16px;
    text-align: center;
    cursor: pointer;
}

.cx-notices .cx-notice-close:hover {
    color: rgba(0, 0, 0, .88);
}

.cx-notices .cx-notice-close:focus-visible {
    outline: 2px solid #91caff;
    outline-offset: 1px;
}

/* 图标：实心圆 + 白色符号，内联 SVG，不依赖图标字体 */
.cx-notice-success .cx-notice-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%2352c41a'/%3E%3Cpath d='M4.6 8.3l2.3 2.2 4.5-4.7' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.cx-notice-error .cx-notice-icon {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23ff4d4f'/%3E%3Cpath d='M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.cx-notice-warning .cx-notice-icon,
.cx-modal-icon.is-warning {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23faad14'/%3E%3Cpath d='M8 4.2v4.9' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='11.6' r='1' fill='%23fff'/%3E%3C/svg%3E");
}

.cx-notice-info .cx-notice-icon,
.cx-modal-icon.is-info {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%231677ff'/%3E%3Cpath d='M8 6.9v4.9' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='4.4' r='1' fill='%23fff'/%3E%3C/svg%3E");
}

/* 确认框 */
.cx-notices,
.cx-notices *,
.cx-modal-mask,
.cx-modal-mask * {
    box-sizing: border-box;
}

.cx-modal-mask {
    position: fixed;
    inset: 0;
    z-index: 1990;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 100px 16px 16px;
    overflow-y: auto;
    background: rgba(0, 0, 0, .45);
    animation: cx-fade-in .2s ease-out;
}

.cx-modal-mask .cx-modal {
    width: 416px;
    max-width: 100%;
    padding: 32px 32px 24px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 6px 16px 0 rgba(0, 0, 0, .08), 0 3px 6px -4px rgba(0, 0, 0, .12), 0 9px 28px 8px rgba(0, 0, 0, .05);
    color: rgba(0, 0, 0, .88);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.5715;
    text-align: left;
    animation: cx-modal-in .2s ease-out;
}

.cx-modal-mask .cx-modal-body {
    display: flex;
    gap: 12px;
}

.cx-modal-mask .cx-modal-icon {
    width: 22px;
    height: 22px;
}

.cx-modal-mask .cx-modal-main {
    min-width: 0;
    flex: 1;
}

.cx-modal-mask .cx-modal-title {
    margin: 0;
    color: rgba(0, 0, 0, .88);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.cx-modal-mask .cx-modal-text {
    margin-top: 8px;
    color: rgba(0, 0, 0, .65);
    overflow-wrap: anywhere;
}

.cx-modal-mask .cx-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

.cx-modal-mask .cx-modal-btn {
    all: unset;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 4px 15px;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .02);
    color: rgba(0, 0, 0, .88);
    font-size: 14px;
    line-height: 22px;
    white-space: nowrap;
    cursor: pointer;
    transition: color .2s, background-color .2s, border-color .2s;
}

.cx-modal-mask .cx-modal-btn:hover {
    border-color: #4096ff;
    color: #4096ff;
}

.cx-modal-mask .cx-modal-btn:focus-visible {
    outline: 2px solid #91caff;
    outline-offset: 1px;
}

.cx-modal-mask .cx-modal-btn.is-primary {
    border-color: #1677ff;
    background: #1677ff;
    box-shadow: 0 2px 0 rgba(5, 145, 255, .1);
    color: #fff;
}

.cx-modal-mask .cx-modal-btn.is-primary:hover {
    border-color: #4096ff;
    background: #4096ff;
    color: #fff;
}

.cx-modal-mask .cx-modal-btn.is-danger {
    border-color: #ff4d4f;
    background: #ff4d4f;
    box-shadow: 0 2px 0 rgba(255, 38, 5, .06);
    color: #fff;
}

.cx-modal-mask .cx-modal-btn.is-danger:hover {
    border-color: #ff7875;
    background: #ff7875;
    color: #fff;
}

@keyframes cx-notice-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

@keyframes cx-notice-out {
    to { opacity: 0; transform: translateY(-8px); }
}

@keyframes cx-fade-in {
    from { opacity: 0; }
}

@keyframes cx-modal-in {
    from { opacity: 0; transform: scale(.96); }
}

@media (max-width: 575px) {
    .cx-modal-mask {
        padding-top: 64px;
    }

    .cx-modal-mask .cx-modal {
        padding: 24px 20px 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body .cx-notices .cx-notice,
    body .cx-notices .cx-notice.is-leaving {
        animation-duration: 1ms !important;
    }

    .cx-modal-mask,
    .cx-modal-mask .cx-modal {
        animation-duration: 1ms;
    }
}
