:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --accent-color: #d97706;
  --accent-gradient: linear-gradient(45deg, #d97706, #f59e0b);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --glass-bg: rgba(255,255,255,0.8);
  --glass-border: rgba(0,0,0,0.08);
  --chart-grid: rgba(0,0,0,0.08);
  --chart-text: rgba(0,0,0,0.6);
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --accent-color: #f59e0b;
  --accent-gradient: linear-gradient(45deg, #ffd700, #ff6b35);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
  --glass-bg: rgba(255,255,255,0.05);
  --glass-border: rgba(255,255,255,0.1);
  --chart-grid: rgba(255,255,255,0.1);
  --chart-text: rgba(255,255,255,0.7);
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 标题样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 仪表盘样式 */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    animation: none;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
}

/* 卡片特定样式 */
.bank-price::before { background: linear-gradient(90deg, #d97706, #f59e0b); }
.recycle-price::before { background: linear-gradient(90deg, #16a34a, #4ade80); }
.brand-price::before { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.stats-card::before { background: linear-gradient(90deg, #9333ea, #a855f7); }

.card-icon {
    font-size: 2rem;
    margin-bottom: 15px;
    text-align: center;
}

.card-content h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-weight: 500;
}

.price-display {
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--text-primary);
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background: none;
    margin-bottom: 5px;
}

.price-unit {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 统计卡片样式 */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

/* 迷你走势图 */
.card-sparkline {
    height: 40px;
    margin-top: 15px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.dashboard-card:hover .card-sparkline {
    opacity: 1;
}

/* 图表容器 */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text-primary);
}

.chart-buttons {
    display: flex;
    gap: 10px;
}

.chart-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.chart-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.chart-btn.active {
    background: var(--accent-gradient);
    color: #000000;
    border-color: transparent;
    font-weight: 600;
}

#priceChart {
    width: 100% !important;
    height: 400px !important;
}

/* 加载和错误状态 */
.loading, .error {
    text-align: center;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    margin: 20px 0;
}

.loading {
    color: var(--accent-color);
}

.error {
    color: #ef4444;
}

/* 刷新按钮 */
#refreshBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .price-display {
        font-size: 1.8rem;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .chart-buttons {
        width: 100%;
        justify-content: center;
    }
}

/* 使用说明样式 */
.usage-guide {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    margin-top: 40px;
}

.usage-guide h3 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--accent-color);
    font-size: 1.5rem;
}

.guide-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.guide-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.guide-item:hover {
    transform: translateY(-3px);
    border-color: var(--accent-color);
}

.guide-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.guide-text h4 {
    color: var(--text-primary);
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.guide-text p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .guide-content {
        grid-template-columns: 1fr;
    }
    
    .guide-item {
        flex-direction: column;
        text-align: center;
    }
    
    .usage-guide h3 {
        font-size: 1.3rem;
    }
}

/* Theme toggle button */
#themeToggle {
    transition: all 0.3s ease;
}
#themeToggle:hover {
    transform: scale(1.1);
}
