/* ==========================================================================
   统一提示插件样式 (Notify Plugin)
   全项目通用：Toast 通知 + Alert 弹窗 + Confirm 确认框 + Loading 加载提示
   ========================================================================== */

/* ---------- CSS 变量（可被项目覆盖） ---------- */
:root {
    --notify-success: #43e97b;
    --notify-error: #fa709a;
    --notify-warning: #fccb90;
    --notify-info: #667eea;
    --notify-loading: #4facfe;
    --notify-text: #333;
    --notify-text-light: #666;
    --notify-bg: #ffffff;
    --notify-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --notify-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.2);
    --notify-radius: 8px;
    --notify-z-index: 99999;
    --notify-overlay-bg: rgba(0, 0, 0, 0.45);
    --notify-font-size: 13px;
    --notify-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* ==========================================================================
   Toast 通知容器
   ========================================================================== */
.notify-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--notify-z-index);
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 420px;
    pointer-events: none;
}

.notify-container .notify-toast {
    pointer-events: auto;
}

/* ==========================================================================
   单条 Toast
   ========================================================================== */
.notify-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 280px;
    max-width: 420px;
    padding: 12px 16px;
    background: var(--notify-bg);
    border-radius: var(--notify-radius);
    box-shadow: var(--notify-shadow);
    font-family: var(--notify-font-family);
    font-size: var(--notify-font-size);
    color: var(--notify-text);
    line-height: 1.5;
    border-left: 4px solid var(--notify-info);
    animation: notifySlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: box-shadow 0.2s, opacity 0.3s, transform 0.3s;
    cursor: default;
    word-break: break-word;
}

.notify-toast:hover {
    box-shadow: var(--notify-shadow-hover);
}

/* Toast 类型 */
.notify-toast--success {
    border-left-color: var(--notify-success);
}
.notify-toast--error {
    border-left-color: var(--notify-error);
}
.notify-toast--warning {
    border-left-color: var(--notify-warning);
}
.notify-toast--info {
    border-left-color: var(--notify-info);
}
.notify-toast--loading {
    border-left-color: var(--notify-loading);
}

/* Toast 图标 */
.notify-toast__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
}

.notify-toast--success .notify-toast__icon {
    color: var(--notify-success);
}
.notify-toast--error .notify-toast__icon {
    color: var(--notify-error);
}
.notify-toast--warning .notify-toast__icon {
    color: var(--notify-warning);
}
.notify-toast--info .notify-toast__icon {
    color: var(--notify-info);
}
.notify-toast--loading .notify-toast__icon {
    color: var(--notify-loading);
    animation: notifySpin 0.8s linear infinite;
}

/* Toast 内容 */
.notify-toast__content {
    flex: 1;
    min-width: 0;
}

.notify-toast__title {
    font-weight: 600;
    font-size: var(--notify-font-size);
    margin-bottom: 2px;
}

.notify-toast__message {
    font-size: var(--notify-font-size);
    color: var(--notify-text-light);
    white-space: pre-wrap;
}

/* Toast 关闭按钮 */
.notify-toast__close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: #999;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.notify-toast__close:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.06);
}

/* Toast 进度条（自动消失倒计时） */
.notify-toast__progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 0 var(--notify-radius);
    animation: notifyProgress linear forwards;
    pointer-events: none;
}

.notify-toast--success .notify-toast__progress {
    background: var(--notify-success);
}
.notify-toast--error .notify-toast__progress {
    background: var(--notify-error);
}
.notify-toast--warning .notify-toast__progress {
    background: var(--notify-warning);
}
.notify-toast--info .notify-toast__progress {
    background: var(--notify-info);
}

/* Toast 退出动画 */
.notify-toast--leaving {
    opacity: 0;
    transform: translateX(120%);
}

/* Toast 相对定位（用于内联模式） */
.notify-toast--inline {
    position: relative;
    animation: notifyFadeIn 0.3s ease;
}

/* ==========================================================================
   模态框遮罩（Alert / Confirm 共用）
   ========================================================================== */
.notify-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--notify-overlay-bg);
    z-index: var(--notify-z-index);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    backdrop-filter: blur(2px);
}

.notify-overlay--active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   模态框对话框
   ========================================================================== */
.notify-modal {
    background: var(--notify-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 440px;
    max-height: 85vh;
    overflow: hidden;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--notify-font-family);
    display: flex;
    flex-direction: column;
}

.notify-overlay--active .notify-modal {
    transform: scale(1) translateY(0);
}

/* 模态框头部 */
.notify-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 12px;
}

.notify-modal__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.notify-modal__header--info .notify-modal__icon {
    background: rgba(102, 126, 234, 0.12);
    color: var(--notify-info);
}
.notify-modal__header--success .notify-modal__icon {
    background: rgba(67, 233, 123, 0.12);
    color: var(--notify-success);
}
.notify-modal__header--error .notify-modal__icon {
    background: rgba(250, 112, 154, 0.12);
    color: var(--notify-error);
}
.notify-modal__header--warning .notify-modal__icon {
    background: rgba(252, 203, 144, 0.12);
    color: var(--notify-warning);
}

.notify-modal__title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: var(--notify-text);
    margin: 0;
}

/* 模态框主体 */
.notify-modal__body {
    padding: 4px 20px 20px;
    overflow-y: auto;
    flex: 1;
}

.notify-modal__message {
    font-size: var(--notify-font-size);
    color: var(--notify-text);
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 模态框底部（按钮区） */
.notify-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px 18px;
    border-top: 1px solid #f0f0f0;
}

/* 模态框按钮 */
.notify-btn {
    padding: 8px 22px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--notify-font-family);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    line-height: 1.4;
}

.notify-btn:active {
    transform: scale(0.97);
}

.notify-btn--secondary {
    background: #f0f0f0;
    color: #555;
}

.notify-btn--secondary:hover {
    background: #e0e0e0;
}

.notify-btn--primary {
    background: var(--notify-info);
    color: #fff;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.notify-btn--primary:hover {
    background: #5a6fd6;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.notify-btn--danger {
    background: var(--notify-error);
    color: #fff;
    box-shadow: 0 2px 8px rgba(250, 112, 154, 0.3);
}

.notify-btn--danger:hover {
    background: #e65a8a;
    box-shadow: 0 4px 12px rgba(250, 112, 154, 0.4);
}

.notify-btn--success {
    background: var(--notify-success);
    color: #fff;
    box-shadow: 0 2px 8px rgba(67, 233, 123, 0.3);
}

.notify-btn--success:hover {
    background: #38d66a;
}

/* ==========================================================================
   动画
   ========================================================================== */
@keyframes notifySlideIn {
    from {
        opacity: 0;
        transform: translateX(120%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes notifyFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes notifySpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes notifyProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* ==========================================================================
   响应式适配
   ========================================================================== */
@media (max-width: 480px) {
    .notify-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .notify-toast {
        min-width: 0;
        max-width: none;
    }

    .notify-modal {
        max-width: 95%;
    }
}
