/* ==================== 运动历史页面专用样式 - 2025-10-01更新 ==================== */

/* 运动历史页面容器 */
.history-page {
    min-height: 100vh;
    background: var(--gray-50);
    padding: var(--space-6);
}

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

/* 页面头部 */
.history-header {
    background: var(--primary-gradient);
    color: white;
    padding: var(--space-8);
    border-radius: var(--radius-xl);
    text-align: center;
    margin-bottom: var(--space-6);
    position: relative;
    overflow: hidden;
}

.history-header::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    opacity: 0.3;
}

.history-header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    opacity: 0.2;
}

.history-header h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    position: relative;
    z-index: 1;
}

.history-header p {
    opacity: 0.9;
    font-size: var(--font-size-lg);
    position: relative;
    z-index: 1;
}

/* 筛选器区域 */
.history-filters {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
    border: 1px solid var(--gray-200);
}

.history-filters h3 {
    color: var(--gray-700);
    margin-bottom: var(--space-4);
    font-size: var(--font-size-xl);
    font-weight: 700;
}

/* 日期筛选器容器 - 年份和月份在同一行 */
.history-date-filter {
    display: flex;
    align-items: flex-end;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.history-filter-group {
    position: relative;
    flex: 1;
    min-width: 120px;
}

.history-filter-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
}

.history-filter-group select {
    width: 100%;
    padding: var(--space-3);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: all var(--duration-normal) var(--ease-out);
    background: white;
    cursor: pointer;
}

.history-filter-group select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.history-filter-group select:hover {
    border-color: var(--primary-300);
}

/* 快速日期选择 */
.history-quick-filters {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.history-quick-btn {
    padding: var(--space-2) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-full);
    background: white;
    color: var(--gray-600);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.history-quick-btn:hover {
    border-color: var(--primary-300);
    color: var(--primary-600);
}

.history-quick-btn.active {
    background: var(--primary-gradient);
    border-color: var(--primary-500);
    color: white;
}

/* 查询按钮 */
.history-query-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.history-query-btn:hover {
    background: var(--primary-gradient-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

/* 总览统计区域 - 单个大卡片 */
.history-overview {
    margin-bottom: var(--space-6);
}

.history-overview-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.history-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.history-stat-item {
    text-align: center;
    padding: var(--space-3);
    border-radius: var(--radius-md);
    transition: all var(--duration-normal) var(--ease-out);
}

.history-stat-item:hover {
    background: var(--gray-50);
}

.history-stat-icon {
    width: 48px;  /* 从60px缩小到48px */
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-2);
    font-size: var(--font-size-lg);  /* 从xl缩小到lg */
    color: white;
}

.history-stat-icon.steps {
    background: var(--primary-gradient);
}

.history-stat-icon.distance {
    background: var(--success-gradient);
    color: var(--gray-700);
}

.history-stat-icon.calories {
    background: var(--warning-gradient);
    color: var(--gray-700);
}

.history-stat-icon.duration {
    background: var(--info-gradient);
    color: var(--gray-700);
}

.history-stat-value {
    font-size: var(--font-size-xl);  /* 从2xl缩小到xl */
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: var(--space-1);
}

.history-stat-label {
    font-size: var(--font-size-xs);  /* 从sm缩小到xs */
    color: var(--gray-500);
    font-weight: 500;
}

.history-stat-change {
    font-size: var(--font-size-xs);
    margin-top: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.history-stat-change.positive {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-600);
}

.history-stat-change.negative {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-600);
}

.history-stat-change.neutral {
    background: rgba(156, 163, 175, 0.1);
    color: var(--gray-600);
}

/* 图表区域 */
.history-chart-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-6);
    border: 1px solid var(--gray-200);
}

.history-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.history-chart-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--gray-700);
    margin: 0;
}

.history-chart-controls {
    display: flex;
    gap: var(--space-2);
}

.history-chart-btn {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: white;
    color: var(--gray-600);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.history-chart-btn:hover {
    border-color: var(--primary-300);
    color: var(--primary-600);
}

.history-chart-btn.active {
    background: var(--primary-gradient);
    border-color: var(--primary-500);
    color: white;
}

.history-chart-container {
    position: relative;
    height: 300px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    overflow: hidden;
}

.history-chart-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: var(--gray-500);
    font-size: var(--font-size-lg);
    text-align: center;
    padding: var(--space-8);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--gray-300);
}

/* 自定义柱状图 */
.history-bar-chart {
    display: flex;
    align-items: flex-end;
    height: 100%;
    gap: 2px;
    padding: var(--space-2);
}

.history-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.history-bar-item:hover {
    transform: scale(1.05);
}

.history-bar {
    width: 100%;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
}

.history-bar:hover {
    background: var(--primary-gradient-hover);
    box-shadow: var(--shadow-sm);
}

.history-bar-label {
    margin-top: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--gray-600);
    font-weight: 500;
}

.history-bar-value {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    margin-top: var(--space-1);
}

/* 折线图 */
.history-line-chart {
    position: relative;
    height: 100%;
    padding: var(--space-4);
}

.history-line-chart svg {
    width: 100%;
    height: calc(100% - 40px);
    display: block;
}

.history-line-point {
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.history-line-point:hover {
    r: 1.2;
    fill: var(--primary-700);
}

.history-line-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 var(--space-2);
    margin-top: var(--space-2);
}

.history-line-label {
    font-size: var(--font-size-xs);
    color: var(--gray-600);
    font-weight: 500;
    text-align: center;
}

/* 详细记录区域 */
.history-details-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

.history-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.history-details-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--gray-700);
    margin: 0;
}

.history-export-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--success-gradient);
    color: var(--gray-700);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.history-export-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* 记录列表 - 紧凑横向布局 */
.history-records-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);  /* 从space-3缩小到space-2 */
}

.history-record-item-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    transition: all var(--duration-normal) var(--ease-out);
    font-size: var(--font-size-sm);
}

.history-record-item-compact:hover {
    background: white;
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-200);
}

.history-record-date-compact {
    color: var(--gray-700);
    font-weight: 600;
    min-width: 100px;
}

.history-record-divider {
    color: var(--gray-300);
    margin: 0 var(--space-2);
}

.history-record-steps-compact {
    color: var(--primary-600);
    font-weight: 500;
    min-width: 80px;
}

.history-record-distance-compact {
    color: var(--success-600);
    font-weight: 500;
    min-width: 70px;
}

/* 分页控件 */
.history-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-4);
    padding: var(--space-3);
}

.history-page-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.history-page-btn:hover:not(:disabled) {
    background: var(--primary-gradient-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.history-page-btn:disabled {
    background: var(--gray-300);
    color: var(--gray-500);
    cursor: not-allowed;
    transform: none;
}

.history-page-info {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    font-weight: 500;
    min-width: 120px;
    text-align: center;
}

/* 空状态 */
.history-empty-state {
    text-align: center;
    padding: var(--space-12);
    color: var(--gray-500);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--gray-300);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.history-empty-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.3;
    color: var(--gray-400);
}

.history-empty-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--space-2);
    color: var(--gray-600);
}

.history-empty-description {
    font-size: var(--font-size-base);
    margin-bottom: var(--space-4);
    color: var(--gray-500);
}

/* 加载状态 */
.history-loading {
    text-align: center;
    padding: var(--space-8);
}

.history-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary-500);
    border-radius: 50%;
    animation: history-spin 1s linear infinite;
    margin: 0 auto var(--space-3);
}

@keyframes history-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.history-loading-text {
    color: var(--gray-500);
    font-size: var(--font-size-sm);
}

/* 错误状态 */
.history-error-state {
    text-align: center;
    padding: var(--space-8);
    color: var(--danger-600);
}

.history-error-icon {
    font-size: 3rem;
    margin-bottom: var(--space-3);
    opacity: 0.7;
}

.history-error-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--space-2);
}

.history-error-description {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
}

.history-retry-btn {
    padding: var(--space-2) var(--space-4);
    background: var(--danger-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
}

.history-retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .history-page {
        padding: var(--space-4);
    }
    
    .history-header {
        padding: var(--space-6);
    }
    
    .history-header h1 {
        font-size: var(--font-size-2xl);
    }
    
    .history-date-filter {
        flex-direction: column;
        align-items: stretch;
    }
    
    .history-quick-filters {
        justify-content: center;
    }
    
    /* 统计网格在移动端保持2×2 */
    .history-stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }
    
    .history-chart-container {
        height: 250px;
    }
    
    /* 紧凑记录在移动端调整 */
    .history-record-item-compact {
        flex-wrap: wrap;
        font-size: var(--font-size-xs);
    }
    
    .history-record-date-compact {
        min-width: auto;
        flex: 1 1 100%;
        margin-bottom: var(--space-1);
    }
    
    .history-record-divider {
        margin: 0 var(--space-1);
    }
}

@media (max-width: 480px) {
    .history-page {
        padding: var(--space-3);
    }
    
    .history-header {
        padding: var(--space-4);
    }
    
    .history-filters,
    .history-chart-section,
    .history-details-section {
        padding: var(--space-4);
    }
    
    /* 小屏幕统计网格仍保持2×2 */
    .history-stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
    }
    
    .history-chart-container {
        height: 200px;
    }
    
    /* 分页按钮文字缩小 */
    .history-page-btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-xs);
    }
    
    .history-page-info {
        font-size: var(--font-size-xs);
        min-width: 100px;
    }
}

/* 动画效果 */
.history-stat-item {
    animation: history-fadeInUp 0.3s var(--ease-out);
}

.history-record-item-compact {
    animation: history-fadeInUp 0.3s var(--ease-out);
}

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

/* 图表动画 - 柱状图使用内联height，不需要keyframes动画 */

/* 工具提示 */
.history-tooltip {
    position: absolute;
    background: var(--gray-800);
    color: white;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-out);
}

.history-tooltip.show {
    opacity: 1;
}

