/* 全局样式 */
body {
    font-family: 'Segoe UI', 'Microsoft YaHei', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255,255,255,0.15) 0%, transparent 50%);
    pointer-events: none;
}

header h1 {
    font-weight: 800;
    margin-bottom: 0.8rem;
    color: white;
    font-size: 2.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

header p {
    font-size: 1.2rem;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

/* 卡片样式 */
.card {
    border-radius: 12px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    overflow: hidden;
    position: relative;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.card-header {
    border-radius: 12px 12px 0 0;
    font-weight: 700;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: none;
    padding: 1.25rem;
    color: #2c3e50;
    font-size: 1.25rem;
}

.card-body {
    padding: 1.8rem;
}

/* 表单样式 */
.form-label {
    font-weight: 600;
    color: #555;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    padding: 0.9rem 1.2rem;
    transition: all 0.3s ease;
    font-size: 1rem;
    background: #fff;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    outline: none;
    background: #fafdff;
    transform: translateY(-1px);
}

.form-control::placeholder {
    color: #aaa;
    font-size: 0.9rem;
}

/* 按钮样式 */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    border-radius: 10px;
    padding: 0.9rem 1.8rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #764ba2;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* 结果展示样式 */
.result-item {
    text-align: center;
    padding: 1.8rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid #f0f0f0;
    margin-bottom: 1rem;
}

.result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}

.result-item:hover {
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.result-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.result-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #667eea;
    margin-bottom: 0.3rem;
    transition: color 0.3s ease;
}

.result-item:hover .result-value {
    color: #764ba2;
}

.result-unit {
    font-size: 0.8rem;
    color: #999;
}

/* 表格样式 */
.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    background: white;
    position: relative;
}

.table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 700;
    text-align: center;
    padding: 1.2rem;
    border-bottom: none;
    position: relative;
    user-select: none;
    cursor: pointer;
    transition: background 0.3s ease;
}

.table th:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.table th::after {
    content: '↓';
    position: absolute;
    right: 1rem;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.table th.sorted::after {
    opacity: 1;
}

.table th.sorted.asc::after {
    content: '↑';
}

.table td {
    vertical-align: middle;
    text-align: center;
    padding: 1.2rem;
    border-bottom: 1px solid #f1f1f1;
    transition: all 0.3s ease;
    position: relative;
}

.table td::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background 0.3s ease;
}

.table-hover tbody tr:hover {
    background-color: #f8f9ff;
}

.table-hover tbody tr:hover td::before {
    background: linear-gradient(to bottom, #667eea, #764ba2);
}

.table-hover tbody tr:last-child td {
    border-bottom: none;
}

/* 图表容器样式 */
.chart-container {
    height: 450px;
    margin: 2rem 0;
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* 图表控制按钮组 */
.chart-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.chart-controls .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
    background: rgba(255,255,255,0.95);
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.chart-controls .btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 搜索框样式 */
.table-search {
    margin-bottom: 1.5rem;
    position: relative;
}

.table-search .form-control {
    padding-left: 3rem;
    border-radius: 8px;
}

.table-search::before {
    content: '🔍';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: #999;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        padding: 2.5rem 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .container {
        padding: 1rem;
    }
    
    .card {
        margin-bottom: 1.5rem !important;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .row {
        flex-direction: column;
    }
    
    .col-md-6 {
        width: 100%;
        margin-bottom: 1.5rem;
    }
    
    .result-value {
        font-size: 1.4rem;
    }
    
    .table {
        font-size: 0.9rem;
    }
    
    .table td, .table th {
        padding: 0.75rem 0.5rem;
    }
    
    .chart-container {
        height: 350px;
        padding: 1rem;
    }
    
    .chart-controls {
        position: relative;
        top: auto;
        right: auto;
        margin-bottom: 1rem;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .btn-primary {
        width: 100%;
        padding: 1rem;
    }
    
    .result-item {
        padding: 1.2rem;
    }
    
    .result-value {
        font-size: 1.2rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

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

.card {
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.result-item {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.result-item:nth-child(1) { animation-delay: 0.1s; }
.result-item:nth-child(2) { animation-delay: 0.2s; }
.result-item:nth-child(3) { animation-delay: 0.3s; }
.result-item:nth-child(4) { animation-delay: 0.4s; }
.result-item:nth-child(5) { animation-delay: 0.5s; }

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #764ba2 0%, #667eea 100%);
}

/* 辅助类 */
.text-center {
    text-align: center;
}

.mt-5 {
    margin-top: 3rem !important;
}

.mb-5 {
    margin-bottom: 3rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

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

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #333;
    }
    
    .form-control, .form-select {
        border: 2px solid #333;
    }
}