/* ===== 全局 UI 组件（ui-ux-pro-max 表单体系 + 反馈闭环） ===== */

/* Toast */
.ui-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.ui-toast {
    min-width: 240px;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: var(--radius-sm, 10px);
    color: white;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    box-shadow: var(--shadow-lg, 0 10px 30px rgba(0,0,0,0.15));
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: toastIn 0.3s var(--ease-out, cubic-bezier(0.22,1,0.36,1));
    pointer-events: auto;
    word-break: break-word;
}
.ui-toast-success { background: #1b4332; }
.ui-toast-error   { background: var(--danger-text, #c0492b); }
.ui-toast-info    { background: var(--primary, #2d6a4f); }
.ui-toast-warning { background: #7c4a15; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}
.ui-toast.leaving { animation: toastOut 0.2s ease forwards; }

/* 按钮 loading 状态 */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn-loading::after {
    content: '';
    position: absolute;
    left: 50%; top: 50%;
    width: 18px; height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
}
.btn-ghost.btn-loading::after,
.btn-outline.btn-loading::after {
    border-color: rgba(45,106,79,0.25);
    border-top-color: var(--primary, #2d6a4f);
}

@keyframes btnSpin { to { transform: rotate(360deg); } }

/* 内联错误（表单字段） */
.field-error {
    color: var(--danger-text, #c0492b);
    font-size: 13px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: fieldErrIn 0.2s var(--ease-out);
}
@keyframes fieldErrIn {
    from { opacity: 0; transform: translateY(-2px); }
    to   { opacity: 1; transform: translateY(0); }
}
.input-error { border-color: var(--danger-text, #c0492b) !important; }
.input-ok    { border-color: var(--success, #52b788) !important; }

/* 表单字段容器（label + input + error） */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text, #1a1a2e);
}
.form-group label .req {
    color: var(--danger-text, #c0492b);
    margin-left: 2px;
}
.form-group .hint {
    font-size: 12px;
    color: var(--text-secondary, #5b6472);
    margin-top: 4px;
}

/* 骨架屏 */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0%,
        #f8f8f8 50%,
        #f0f0f0 100%
    );
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes skeletonPulse {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; opacity: 0.6; }
    .ui-toast { animation: none; }
    .btn-loading::after { animation-duration: 2s; }
}
