/*!
 * 星云导航 - 公共设计令牌与基础样式
 * 版本: 3.1.2 Pro
 *
 * 包含: CSS变量设计系统、重置样式、通用工具类、动画关键帧
 * 前台和后台均引入此文件, 确保设计语言统一
 */

/* ========== 设计令牌: 浅色模式 ========== */
:root {
    /* 品牌色 */
    --primary: #4f46e5;
    --secondary: #7c3aed;
    --accent: #ec4899;
    /* RGB版本(供rgba(var(--xxx-rgb), alpha)使用, 可被页面内联注入覆盖) */
    --primary-rgb: 79,70,229;
    --secondary-rgb: 124,58,237;
    --accent-rgb: 236,72,153;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* 文字 */
    --text: #0f172a;
    --text-light: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* 背景 */
    --bg: #f8fafc;
    --bg-gradient: radial-gradient(ellipse 80% 50% at 20% 0%, rgba(var(--secondary-rgb), 0.12) 0%, transparent 50%),
                    radial-gradient(ellipse 60% 40% at 80% 10%, rgba(var(--accent-rgb), 0.08) 0%, transparent 50%),
                    radial-gradient(ellipse 70% 60% at 50% 100%, rgba(var(--primary-rgb), 0.1) 0%, transparent 50%),
                    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 50%, #eef2ff 100%);

    /* 卡片 */
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-bg-solid: #ffffff;
    --card-border: rgba(255, 255, 255, 0.8);
    --card-border-color: rgba(0, 0, 0, 0.06);

    /* 元素 */
    --item-bg: rgba(255, 255, 255, 0.5);
    --item-hover: rgba(255, 255, 255, 0.9);
    --input-bg: rgba(255, 255, 255, 0.8);
    --input-border: rgba(0, 0, 0, 0.08);

    /* 阴影 */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow: 0 8px 32px rgba(var(--primary-rgb), 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 24px 64px rgba(var(--primary-rgb), 0.18), 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 48px rgba(var(--secondary-rgb), 0.2);
    --shadow-primary: 0 4px 16px rgba(var(--primary-rgb), 0.3);

    /* 渐变 */
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-accent: linear-gradient(135deg, var(--secondary), var(--accent));
    --gradient-text: linear-gradient(135deg, var(--primary), var(--accent));
    --gradient-hero: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);

    /* 圆角 */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 999px;

    /* 玻璃拟态 */
    --glass-blur: 20px;
    --glass-border: 1px solid rgba(255, 255, 255, 0.6);

    /* 动画缓动 */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration: 250ms;
    --duration-slow: 400ms;

    /* 排版 */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;

    /* 间距 */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* 布局 */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --max-width: 1200px;
}

/* ========== 设计令牌: 深色模式 ========== */
.dark-mode {
    /* 品牌色: 继承用户配置(由页面内联注入), 此处不硬编码覆盖 */
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;

    --text: #f1f5f9;
    --text-light: #cbd5e1;
    --text-muted: #64748b;

    --bg: #0a0e1a;
    --bg-gradient: radial-gradient(ellipse 80% 50% at 20% 0%, rgba(var(--primary-rgb), 0.15) 0%, transparent 50%),
                    radial-gradient(ellipse 60% 40% at 80% 10%, rgba(var(--accent-rgb), 0.1) 0%, transparent 50%),
                    radial-gradient(ellipse 70% 60% at 50% 100%, rgba(var(--secondary-rgb), 0.12) 0%, transparent 50%),
                    linear-gradient(180deg, #0a0e1a 0%, #0f172a 50%, #0a0e1a 100%);

    --card-bg: rgba(15, 23, 42, 0.6);
    --card-bg-solid: #1e293b;
    --card-border: rgba(var(--primary-rgb), 0.12);
    --card-border-color: rgba(255, 255, 255, 0.06);

    --item-bg: rgba(30, 41, 59, 0.45);
    --item-hover: rgba(49, 46, 129, 0.45);
    --input-bg: rgba(30, 41, 59, 0.6);
    --input-border: rgba(255, 255, 255, 0.08);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 48px rgba(var(--primary-rgb), 0.25);
    --shadow-primary: 0 4px 16px rgba(var(--primary-rgb), 0.3);

    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ========== 基础重置 ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-gradient);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--duration-slow) var(--ease-out), color var(--duration) var(--ease-out);
    overflow-x: hidden;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* ========== 选中文字 ========== */
::selection {
    background: var(--primary);
    color: #fff;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
    opacity: 0.5;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

/* ========== 通用工具类 ========== */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--text-sm);
    transition: all var(--duration) var(--ease-out);
    white-space: nowrap;
    user-select: none;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--item-bg);
    color: var(--text);
    border: 1px solid var(--card-border-color);
}
.btn-secondary:hover {
    background: var(--item-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* 输入框 */
.input, .select, .textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: var(--text-sm);
    transition: all var(--duration) var(--ease-out);
    outline: none;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}
.textarea {
    resize: vertical;
    min-height: 100px;
}

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.5;
}
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }

/* 骨架屏 */
.skeleton {
    background: linear-gradient(90deg, var(--item-bg) 25%, var(--item-hover) 50%, var(--item-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ========== 动画关键帧 ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

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

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(var(--secondary-rgb), 0.2); }
    50% { box-shadow: 0 0 40px rgba(var(--secondary-rgb), 0.4); }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 入场动画类 */
.animate-fade-in { animation: fadeIn var(--duration) var(--ease-out) both; }
.animate-fade-in-up { animation: fadeInUp var(--duration-slow) var(--ease-out) both; }
.animate-fade-in-down { animation: fadeInDown var(--duration-slow) var(--ease-out) both; }
.animate-scale-in { animation: scaleIn var(--duration) var(--ease-out) both; }
.animate-float { animation: float 3s ease-in-out infinite; }

/* 交错入场延迟 */
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.3s; }
.delay-7 { animation-delay: 0.35s; }
.delay-8 { animation-delay: 0.4s; }

/* ========== 无障碍 ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* 键盘焦点可见性 */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* 屏幕阅读器专用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   v3.2.0 高端化增强层 — 设计令牌升级
   目标: 付费级质感、主题深度融合、沉浸感、无突兀
   ============================================================ */

:root {
    /* 高级渐变体系 */
    --gradient-premium: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    --gradient-soft: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1), rgba(var(--secondary-rgb), 0.06), rgba(var(--accent-rgb), 0.04));
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.5), rgba(255,255,255,0.25));
    --gradient-border: linear-gradient(135deg, rgba(var(--primary-rgb), 0.5), rgba(var(--secondary-rgb), 0.3), rgba(var(--accent-rgb), 0.4));

    /* 高级阴影体系 — 更柔和、更有层次 */
    --shadow-premium-sm: 0 2px 12px rgba(var(--primary-rgb), 0.08), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-premium: 0 8px 32px rgba(var(--primary-rgb), 0.12), 0 2px 8px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.6);
    --shadow-premium-lg: 0 24px 64px rgba(var(--primary-rgb), 0.18), 0 8px 24px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.5);
    --shadow-glow-primary: 0 0 32px rgba(var(--primary-rgb), 0.25), 0 0 64px rgba(var(--secondary-rgb), 0.12);
    --shadow-glow-accent: 0 0 32px rgba(var(--accent-rgb), 0.25), 0 0 64px rgba(var(--accent-rgb), 0.1);
    --shadow-inset: inset 0 2px 8px rgba(0,0,0,0.06), inset 0 -1px 0 rgba(255,255,255,0.6);

    /* 玻璃拟态升级 */
    --glass-blur-premium: 24px;
    --glass-saturate: 180%;
    --glass-border-premium: 1px solid rgba(255,255,255,0.35);
    --glass-bg-premium: rgba(255,255,255,0.38);

    /* 高级动画缓动 */
    --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-premium: 350ms;

    /* 高级间距 */
    --space-premium-xs: 0.375rem;
    --space-premium-sm: 0.625rem;
    --space-premium-md: 1rem;
    --space-premium-lg: 1.5rem;
    --space-premium-xl: 2rem;

    /* 高级圆角 */
    --radius-premium-xs: 6px;
    --radius-premium-sm: 10px;
    --radius-premium-md: 14px;
    --radius-premium-lg: 20px;
    --radius-premium-xl: 28px;
    --radius-premium-2xl: 36px;
}

.dark-mode {
    --gradient-soft: linear-gradient(135deg, rgba(var(--primary-rgb), 0.12), rgba(var(--secondary-rgb), 0.08), rgba(var(--accent-rgb), 0.06));
    --gradient-glass: linear-gradient(135deg, rgba(30,41,59,0.6), rgba(15,23,42,0.4));
    --gradient-border: linear-gradient(135deg, rgba(var(--primary-rgb), 0.4), rgba(var(--secondary-rgb), 0.25), rgba(var(--accent-rgb), 0.35));
    --shadow-premium-sm: 0 2px 12px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
    --shadow-premium: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.06);
    --shadow-premium-lg: 0 24px 64px rgba(0,0,0,0.5), 0 8px 24px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
    --shadow-glow-primary: 0 0 32px rgba(var(--primary-rgb), 0.3), 0 0 64px rgba(var(--secondary-rgb), 0.15);
    --shadow-glow-accent: 0 0 32px rgba(var(--accent-rgb), 0.3), 0 0 64px rgba(var(--accent-rgb), 0.12);
    --shadow-inset: inset 0 2px 8px rgba(0,0,0,0.3), inset 0 -1px 0 rgba(255,255,255,0.04);
    --glass-border-premium: 1px solid rgba(255,255,255,0.1);
    --glass-bg-premium: rgba(15,23,42,0.65);
}

/* 高级工具类 */
.glass-premium {
    background: var(--glass-bg-premium);
    backdrop-filter: blur(var(--glass-blur-premium)) saturate(var(--glass-saturate));
    -webkit-backdrop-filter: blur(var(--glass-blur-premium)) saturate(var(--glass-saturate));
    border: var(--glass-border-premium);
    box-shadow: var(--shadow-premium);
}

.gradient-border-premium {
    position: relative;
    background-clip: padding-box;
}
.gradient-border-premium::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: var(--gradient-border);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* 高级入场动画 */
@keyframes premiumFadeInUp {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes premiumFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes premiumScaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes premiumSlideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes premiumSlideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes premiumGlowPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(var(--secondary-rgb), 0.15); }
    50% { box-shadow: 0 0 40px rgba(var(--secondary-rgb), 0.3), 0 0 60px rgba(var(--accent-rgb), 0.1); }
}
@keyframes premiumShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes premiumFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes premiumGradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animate-premium-fade-in-up { animation: premiumFadeInUp var(--duration-premium) var(--ease-premium) both; }
.animate-premium-fade-in { animation: premiumFadeIn var(--duration-premium) var(--ease-premium) both; }
.animate-premium-scale-in { animation: premiumScaleIn var(--duration-premium) var(--ease-bounce) both; }
.animate-premium-glow-pulse { animation: premiumGlowPulse 3s ease-in-out infinite; }
.animate-premium-float { animation: premiumFloat 4s ease-in-out infinite; }

/* 高级交错延迟 */
.premium-delay-1 { animation-delay: 0.08s; }
.premium-delay-2 { animation-delay: 0.16s; }
.premium-delay-3 { animation-delay: 0.24s; }
.premium-delay-4 { animation-delay: 0.32s; }
.premium-delay-5 { animation-delay: 0.40s; }
.premium-delay-6 { animation-delay: 0.48s; }
.premium-delay-7 { animation-delay: 0.56s; }
.premium-delay-8 { animation-delay: 0.64s; }

/* 高级文字渐变 */
.text-gradient-premium {
    background: var(--gradient-premium);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: premiumGradientShift 6s ease-in-out infinite;
}

/* 高级按钮基础 */
.btn-premium {
    position: relative;
    overflow: hidden;
    transition: all var(--duration-premium) var(--ease-premium);
}
.btn-premium::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.6s var(--ease-premium);
}
.btn-premium:hover::after { left: 100%; }
.btn-premium:hover { transform: translateY(-2px); }
.btn-premium:active { transform: translateY(0) scale(0.98); }

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    .animate-premium-fade-in-up,
    .animate-premium-fade-in,
    .animate-premium-scale-in,
    .animate-premium-glow-pulse,
    .animate-premium-float,
    .text-gradient-premium {
        animation: none !important;
    }
}
