/* 现代数据可视化仪表盘设计 */

:root {
    /* 现代数据可视化配色方案 */
    --primary: #2563eb;           /* 主蓝色 */
    --primary-light: #3b82f6;     
    --primary-dark: #1d4ed8;      
    
    /* 功能状态色 */
    --success: #10b981;           /* 成功绿 */
    --success-light: #34d399;     
    --warning: #f59e0b;           /* 警告橙 */
    --warning-light: #fbbf24;     
    --danger: #ef4444;            /* 危险红 */
    --danger-light: #f87171;      
    --info: #06b6d4;              /* 信息青 */
    --info-light: #22d3ee;        
    
    /* 现代中性色系 */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* 数据可视化渐变 */
    --gradient-primary: linear-gradient(135deg, #2563eb, #3b82f6);
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #fbbf24);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f87171);
    --gradient-info: linear-gradient(135deg, #06b6d4, #22d3ee);
    
    /* 背景系统 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-accent: rgba(37, 99, 235, 0.04);
    
    /* 现代阴影系统 */
    --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-metric: 0 4px 12px rgba(37, 99, 235, 0.08);
    
    /* 圆角系统 */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* 基础重置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--gray-700);
    background: var(--bg-secondary);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px;
}

/* 现代页头设计 */
header {
    margin-bottom: 50px;
    padding: 40px;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
}

.header-main {
    flex: 1;
}

header h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 16px;
    color: var(--gray-500);
    font-weight: 400;
}

.header-stats {
    display: flex;
    gap: 32px;
}

.quick-stat {
    text-align: center;
    padding: 16px 24px;
    background: var(--bg-accent);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    min-width: 100px;
}

.quick-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}

.quick-stat-label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 现代章节标题 */
.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    margin: 60px 0 40px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
}

/* 数据仪表盘网格 - 宽松布局 */
.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 32px;
    margin-bottom: 60px;
}

/* 现代卡片设计 */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--gray-300);
    transform: translateY(-2px);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 16px;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 20px;
}

/* 现代数据指标网格 - 舒适布局 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-item {
    position: relative;
    padding: 16px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    text-align: center;
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-metric);
    border-color: var(--primary);
}

.stat-item:hover::before {
    transform: scaleX(1);
}

.stat-title {
    font-size: 10px;
    color: var(--gray-500);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1.2;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 2px;
    transition: all 0.3s ease;
}

/* 数据状态色彩系统 */
.stat-primary { 
    color: var(--primary);
}

.stat-primary .stat-item:hover::before {
    background: var(--gradient-primary);
}

.stat-success { 
    color: var(--success);
}

.stat-success .stat-item:hover::before {
    background: var(--gradient-success);
}

.stat-warning { 
    color: var(--warning);
}

.stat-warning .stat-item:hover::before {
    background: var(--gradient-warning);
}

.stat-danger {
    color: var(--danger);
}

.stat-danger .stat-item:hover::before {
    background: var(--gradient-danger);
}

.stat-info { 
    color: var(--info);
}

.stat-info .stat-item:hover::before {
    background: var(--gradient-info);
}

/* 详细数据指标 - 舒适布局 */
.detailed-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.detailed-stat {
    position: relative;
    text-align: center;
    padding: 24px 16px;
    background: var(--bg-accent);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.detailed-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

.detailed-stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    transition: transform 0.3s ease;
    line-height: 1;
}

.detailed-stat:hover .detailed-stat-value {
    transform: scale(1.05);
}

.detailed-stat-label {
    font-size: 12px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

/* 现代进度条系统 */
.progress-container {
    margin: 24px 0;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 500;
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: var(--radius-sm);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255,255,255,0.5), 
        transparent);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.fill-primary { background: var(--gradient-primary); }
.fill-success { background: var(--gradient-success); }
.fill-warning { background: var(--gradient-warning); }
.fill-danger { background: var(--gradient-danger); }
.fill-info { background: var(--gradient-info); }

/* 数据排行榜 */
.top-month-card {
    margin: 16px 0;
}

.top-month-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.top-month-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.rank-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: white;
    background: var(--gradient-primary);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.top-month-info {
    flex: 1;
}

.top-month-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.top-month-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.top-month-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.top-month-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    transition: width 0.8s ease;
}

/* 趋势指示器 */
.stat-trend {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trend-stable {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* 独立卡片样式 */
.standalone-card {
    margin-bottom: 32px;
    max-width: none;
}

/* API教程现代化设计 */
.api-tutorial {
    display: grid;
    gap: 32px;
    margin-bottom: 60px;
}

.tutorial-card {
    background: var(--bg-primary);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.tutorial-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.tutorial-header {
    padding: 20px 24px;
    background: var(--bg-accent);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 12px;
}

.tutorial-icon {
    font-size: 20px;
}

.tutorial-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.tutorial-content {
    padding: 24px;
}

.method-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.method-success { background: var(--success); }
.method-info { background: var(--info); }

.endpoint {
    display: block;
    background: var(--gray-100);
    color: var(--gray-800);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid var(--gray-200);
    word-break: break-all;
}

.tutorial-description {
    margin: 20px 0;
}

.tutorial-description p {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-600);
}

.tutorial-description strong {
    color: var(--gray-800);
    font-weight: 600;
}

.code-example {
    margin-top: 20px;
}

.code-example h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.code-example pre {
    background: var(--gray-900);
    border: 1px solid var(--gray-700);
    border-radius: var(--radius);
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 16px;
}

.code-example code {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    color: var(--gray-100);
    line-height: 1.6;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 24px 0;
    margin-top: 48px;
    border-top: 1px solid var(--gray-200);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    font-size: 13px;
    color: var(--gray-500);
}

.service-status {
    color: var(--success);
    font-weight: 600;
}

/* 数据动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.5s ease-out;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }

/* 数据数字计数动画 */
@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stat-value {
    animation: countUp 0.6s ease-out;
}

.detailed-stat-value {
    animation: countUp 0.6s ease-out;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .detailed-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    header {
        padding: 20px 16px;
        margin-bottom: 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .header-main {
        flex: none;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    .header-stats {
        justify-content: center;
        gap: 16px;
        flex-wrap: wrap;
    }
    
    .quick-stat {
        padding: 12px 16px;
        min-width: 80px;
    }
    
    .quick-stat-value {
        font-size: 20px;
    }
    
    .top-month-stats {
        flex-direction: column;
        gap: 4px;
    }
    
    .stat-item {
        padding: 12px 8px;
        min-height: 70px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .detailed-stat {
        padding: 12px 8px;
        min-height: 60px;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .detailed-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .detailed-stat-value {
        font-size: 18px;
    }
    
    .tutorial-content {
        padding: 16px;
    }
    
    .tutorial-header {
        padding: 16px;
    }
    
    header h1 {
        font-size: 20px;
        line-height: 1.3;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .header-stats {
        gap: 12px;
    }
    
    .quick-stat {
        padding: 10px 12px;
        min-width: 70px;
    }
    
    .quick-stat-value {
        font-size: 18px;
    }
    
    .quick-stat-label {
        font-size: 10px;
    }
}

/* 今日请求分布样式 */
.distribution-stats {
    display: grid;
    gap: 20px;
}

.distribution-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-200);
}

.distribution-item:last-child {
    border-bottom: none;
}

.distribution-time {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    min-width: 100px;
}

.distribution-bar {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.distribution-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    transition: width 0.8s ease;
}

.distribution-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    min-width: 50px;
    text-align: right;
}

/* 月度数据分析样式 */
.monthly-stats {
    display: grid;
    gap: 24px;
}

.monthly-item {
    padding: 24px;
    background: var(--bg-accent);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
}

.monthly-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.monthly-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.monthly-date {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
}

.monthly-trend {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.trend-up {
    background: var(--gradient-success);
    color: white;
}

.trend-down {
    background: var(--gradient-danger);
    color: white;
}

.monthly-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.monthly-metric {
    text-align: center;
}

.metric-label {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}

.metric-value.success {
    color: var(--success);
}

.metric-value.info {
    color: var(--info);
}

/* 每日数据样式 */
.daily-stats {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 16px;
}

.daily-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 12px;
    background: var(--bg-accent);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    text-align: center;
}

.daily-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.daily-date {
    margin-bottom: 8px;
}

.date-text {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
}

.date-day {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 2px;
}

.daily-metrics {
    margin-bottom: 12px;
}

.daily-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.daily-label {
    font-size: 10px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.daily-chart {
    width: 100%;
    height: 40px;
    position: relative;
    display: flex;
    align-items: end;
}

.chart-bar {
    width: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    transition: height 0.8s ease;
    min-height: 4px;
}

/* 新增组件响应式调整 */
@media (max-width: 768px) {
    .daily-stats {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .distribution-item {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .distribution-time {
        min-width: auto;
    }
    
    .distribution-count {
        min-width: auto;
        text-align: center;
    }
    
    .monthly-metrics {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .daily-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .daily-item {
        padding: 12px 6px;
    }
    
    .daily-count {
        font-size: 16px;
    }
    
    .daily-chart {
        height: 30px;
    }
}

/* 焦点和选择状态 */
.tutorial-card:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

::selection {
    background: var(--primary);
    color: white;
}

/* 加载状态 */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading .stat-value,
.loading .detailed-stat-value {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}