/* CSS变量定义 - 支持浅色和深色主题 */
:root {
    /* 浅色主题 */
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f8fafc;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-color-rgb: 37, 99, 235;
    --accent-bg: rgba(37, 99, 235, 0.1);
    --accent-shadow: rgba(37, 99, 235, 0.2);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --navbar-shadow: rgba(0, 0, 0, 0.1);
    --card-bg: #ffffff;
    --code-bg: #f1f5f9;
    --code-border: #e2e8f0;
    --input-bg: #ffffff;
    --primary-color: #2563eb;
    --primary-color-dark: #1d4ed8;
    --primary-color-alpha: rgba(37, 99, 235, 0.1);
}

/* 深色主题 */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #475569;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-color-rgb: 59, 130, 246;
    --accent-bg: rgba(59, 130, 246, 0.15);
    --accent-shadow: rgba(59, 130, 246, 0.3);
    --success-color: #22c55e;
    --warning-color: #fbbf24;
    --error-color: #f87171;
    --navbar-bg: rgba(30, 41, 59, 0.95);
    --navbar-shadow: rgba(0, 0, 0, 0.3);
    --card-bg: #1e293b;
    --code-bg: #334155;
    --code-border: #475569;
    --input-bg: #334155;
    --primary-color: #3b82f6;
    --primary-color-dark: #2563eb;
    --primary-color-alpha: rgba(59, 130, 246, 0.1);
}

/* 跟随系统主题 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;
        --border-color: #475569;
        --shadow-color: rgba(0, 0, 0, 0.3);
        --accent-color: #3b82f6;
        --accent-hover: #60a5fa;
        --accent-color-rgb: 59, 130, 246;
        --accent-bg: rgba(59, 130, 246, 0.15);
        --accent-shadow: rgba(59, 130, 246, 0.3);
        --success-color: #22c55e;
        --warning-color: #fbbf24;
        --error-color: #f87171;
        --navbar-bg: rgba(30, 41, 59, 0.95);
        --navbar-shadow: rgba(0, 0, 0, 0.3);
        --card-bg: #1e293b;
        --code-bg: #334155;
        --code-border: #475569;
        --input-bg: #334155;
        --primary-color: #3b82f6;
        --primary-color-dark: #2563eb;
        --primary-color-alpha: rgba(59, 130, 246, 0.1);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    scroll-behavior: smooth;
}

/* 加载动画 */
.loading {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

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

/* 主题切换按钮样式 */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px var(--shadow-color);
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--shadow-color);
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-toggle .icon {
    transition: transform 0.3s ease;
}

.theme-toggle:hover .icon {
    transform: rotate(180deg);
}

/* 主题切换动画 */
.theme-transition {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .theme-toggle {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .theme-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}
