/* ==========================================================================
   商业级设计系统增强 - Design System Enhancement
   --------------------------------------------------------------------------
   目标：将系统提升到商业级SaaS产品水准

   改进重点：
   1. 更专业的配色方案
   2. 更细腻的阴影系统
   3. 更流畅的动效
   4. 更友好的交互反馈
   5. 更统一的视觉语言
   ========================================================================== */

:root {
    /* ===== 增强的阴影系统 ===== */
    /* 商业级产品需要细腻的层次感 */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

    /* 品牌色阴影 - 用于强调元素 */
    --shadow-accent: 0 4px 14px 0 rgba(37, 99, 235, 0.15);
    --shadow-accent-lg: 0 10px 30px -5px rgba(37, 99, 235, 0.25);

    /* ===== 增强的动效系统 ===== */
    --motion-instant: 50ms;
    --motion-fast: 120ms;
    --motion-base: 180ms;
    --motion-slow: 280ms;
    --motion-slower: 400ms;

    /* 专业的缓动函数 */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out-circ: cubic-bezier(0.85, 0, 0.15, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

    /* ===== 增强的色彩系统 ===== */
    /* 更丰富的品牌色阶梯 */
    --accent-50: #eff6ff;
    --accent-100: #dbeafe;
    --accent-200: #bfdbfe;
    --accent-300: #93c5fd;
    --accent-400: #60a5fa;
    --accent-500: #3b82f6;
    --accent-600: #2563eb; /* 主品牌色 */
    --accent-700: #1d4ed8;
    --accent-800: #1e40af;
    --accent-900: #1e3a8a;

    /* 成功色阶梯 */
    --success-50: #ecfdf5;
    --success-500: #10b981;
    --success-600: #059669;
    --success-700: #047857;

    /* 警告色阶梯 */
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;

    /* 危险色阶梯 */
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger-700: #b91c1c;

    /* ===== 增强的间距系统 ===== */
    --space-0: 0;
    --space-px: 1px;
    --space-0-5: 2px;
    --space-7: 28px;
    --space-8: 40px;
    --space-9: 48px;
    --space-10: 56px;
    --space-12: 64px;
    --space-16: 80px;

    /* ===== 圆角系统补充 ===== */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-3xl: 24px;
    --radius-full: 9999px;

    /* ===== 模糊效果 ===== */
    --blur-sm: blur(4px);
    --blur-md: blur(8px);
    --blur-lg: blur(16px);
    --blur-xl: blur(24px);

    /* ===== 新增：玻璃态效果 ===== */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

/* ==========================================================================
   商业级组件增强
   ========================================================================== */

/* ===== Loading 状态 ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: var(--blur-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-overlay);
    animation: fadeIn var(--motion-base) var(--ease-smooth);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--accent-100);
    border-top-color: var(--accent);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 骨架屏 - 商业级加载体验 */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-muted) 0%,
        var(--surface-soft) 50%,
        var(--surface-muted) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
    width: 70%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-button {
    height: 36px;
    width: 100px;
    border-radius: var(--radius-md);
}

/* ===== 空状态组件 ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10) var(--space-6);
    text-align: center;
    min-height: 320px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-5);
    border-radius: var(--radius-2xl);
    background: var(--accent-50);
    color: var(--accent);
    font-size: 2rem;
    box-shadow: var(--shadow-sm);
}

.empty-state-title {
    font-size: var(--fs-xl);
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--fs-base);
    color: var(--text-muted);
    max-width: 480px;
    line-height: var(--lh-relaxed);
    margin-bottom: var(--space-5);
}

.empty-state-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    justify-content: center;
}

/* ===== 改进的卡片样式 ===== */
.card-elevated {
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--motion-base) var(--ease-smooth);
}

.card-elevated:hover {
    box-shadow: var(--shadow-lg);
}

.card-interactive {
    cursor: pointer;
    transition: all var(--motion-base) var(--ease-smooth);
}

.card-interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-interactive:active {
    transform: translateY(0);
}

/* ===== 改进的按钮样式 ===== */
.btn {
    position: relative;
    overflow: hidden;
    transition: all var(--motion-base) var(--ease-smooth);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    transform: translateX(-100%);
    transition: transform var(--motion-slow) var(--ease-smooth);
}

.btn:hover::before {
    transform: translateX(100%);
}

.btn-primary {
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    box-shadow: var(--shadow-accent-lg);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ===== 改进的表单元素 ===== */
.form-control,
.form-select {
    transition: all var(--motion-base) var(--ease-smooth);
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 3px var(--accent-100),
                var(--shadow-sm);
}

/* ===== Toast 通知 ===== */
.toast-container {
    position: fixed;
    top: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 420px;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    animation: slideInRight var(--motion-base) var(--ease-out-expo);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-success .toast-icon { color: var(--success); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info .toast-icon { color: var(--accent); }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: var(--fs-sm);
    color: var(--text-main);
    margin-bottom: 2px;
}

.toast-message {
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    line-height: var(--lh-base);
}

.toast-close {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--motion-fast) var(--ease-smooth);
}

.toast-close:hover {
    background: var(--surface-muted);
    color: var(--text-main);
}

/* ===== 徽标增强 ===== */
.badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--fs-xs);
    font-weight: 500;
    line-height: 1;
}

.badge-modern.badge-success {
    background: var(--success-50);
    color: var(--success-700);
}

.badge-modern.badge-warning {
    background: var(--warning-50);
    color: var(--warning-700);
}

.badge-modern.badge-danger {
    background: var(--danger-50);
    color: var(--danger-700);
}

.badge-modern.badge-info {
    background: var(--accent-50);
    color: var(--accent-700);
}

/* ===== 数据表格增强 ===== */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead th {
    background: var(--surface-soft);
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-3) var(--space-4);
    border-bottom: 2px solid var(--surface-border);
}

.table-modern tbody tr {
    transition: background var(--motion-fast) var(--ease-smooth);
}

.table-modern tbody tr:hover {
    background: var(--surface-soft);
}

.table-modern tbody td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--surface-border);
    color: var(--text-main);
    font-size: var(--fs-base);
}

/* ===== 进度条增强 ===== */
.progress-modern {
    height: 8px;
    background: var(--surface-muted);
    border-radius: var(--radius-full);
    overflow: hidden;
    box-shadow: var(--shadow-inner);
}

.progress-bar-modern {
    height: 100%;
    background: var(--brand-gradient);
    border-radius: var(--radius-full);
    transition: width var(--motion-slow) var(--ease-out-expo);
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}

/* ===== 响应式改进 ===== */
@media (max-width: 768px) {
    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
        max-width: none;
    }

    .empty-state {
        padding: var(--space-8) var(--space-4);
        min-height: 240px;
    }

    .empty-state-icon {
        width: 64px;
        height: 64px;
        font-size: 1.5rem;
    }
}

/* ===== 微交互增强 ===== */
.hover-lift {
    transition: transform var(--motion-base) var(--ease-smooth);
}

.hover-lift:hover {
    transform: translateY(-2px);
}

.hover-glow {
    transition: box-shadow var(--motion-base) var(--ease-smooth);
}

.hover-glow:hover {
    box-shadow: var(--shadow-accent-lg);
}

/* ===== 焦点状态增强 ===== */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

button:focus-visible,
.btn:focus-visible {
    outline-offset: 3px;
}
