:root {
    --primary-color: #4f6ef7;
    --primary-dark: #3b54d4;
    --secondary-color: #7c8cf8;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f0f3fa;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding-top: 120px;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 20px 30px;
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.85;
}

.filter-section {
    max-width: 1400px;
    margin: 0 auto 24px;
    padding: 0 20px;
}

.filter-row {
    display: flex;
    gap: 20px;
    align-items: center;
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 150px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 500;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 150px;
}

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

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 110, 247, 0.1);
}

.refresh-btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}

.refresh-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.stats-overview {
    max-width: 1400px;
    margin: 0 auto 24px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    border-left: 3px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card.total-score { border-left-color: var(--primary-color); }
.stat-card.high-score { border-left-color: var(--success-color); }
.stat-card.low-score { border-left-color: var(--danger-color); }
.stat-card.avg-deduction { border-left-color: var(--warning-color); }

.stat-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: linear-gradient(135deg, rgba(79, 110, 247, 0.1) 0%, rgba(124, 140, 248, 0.1) 100%);
    border-radius: var(--radius-sm);
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.charts-container {
    max-width: 1400px;
    margin: 0 auto 24px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.chart-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.chart-placeholder {
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-placeholder canvas {
    width: 100% !important;
    height: 100% !important;
}

.table-section {
    max-width: 1400px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

#data-table {
    width: 100%;
    border-collapse: collapse;
}

#data-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

#data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
}

#data-table tbody tr:hover {
    background: rgba(79, 110, 247, 0.03);
}

#data-table tbody tr:last-child td {
    border-bottom: none;
}

.rank-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

.rank-badge.gold {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
}

.rank-badge.silver {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #4b5563;
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #92400e;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: 16px;
}

.loading-overlay p {
    color: var(--text-secondary);
    font-size: 16px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@media (max-width: 768px) {
    body { padding-top: 100px; }
    .header { padding: 16px 20px; }
    .header h1 { font-size: 22px; }
    .filter-row { padding: 16px; gap: 12px; }
    .filter-group { min-width: 120px; }
    .filter-group select { min-width: 120px; padding: 10px 12px; font-size: 14px; }
    .refresh-btn { margin-left: 0; padding: 10px 20px; font-size: 14px; }
    .stats-overview { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-icon { width: 40px; height: 40px; font-size: 22px; }
    .stat-value { font-size: 22px; }
    .table-container { overflow-x: auto; }
    #data-table { min-width: 800px; }
}

@media (max-width: 480px) {
    .stats-overview { grid-template-columns: 1fr; }
    .filter-row { flex-direction: column; align-items: stretch; }
    .refresh-btn { width: 100%; }
}
/* 数据完整度样式 */
.data-completeness {
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 16px 24px;
    margin: 20px 30px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.complete {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.partial {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-badge.incomplete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* 详情按钮样式 */
.detail-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
}

.detail-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* 弹窗样式 */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 70px);
}

.detail-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-category h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 16px;
    border-left: 3px solid var(--primary-color);
    padding-left: 12px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.detail-table thead {
    background: var(--bg-color);
}

.detail-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}

.detail-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.detail-table tbody tr:hover {
    background: var(--bg-color);
}

/* 表格区域头部 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.export-buttons {
    display: flex;
    gap: 12px;
}

.export-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.export-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* 预警区域样式 */
.warning-section {
    background: white;
    border-radius: var(--radius-sm);
    margin: 0 30px 16px 30px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border-left: 4px solid var(--danger-color);
}

.warning-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    background: rgba(239, 68, 68, 0.05);
    border-bottom: 1px solid var(--border-color);
}

.warning-icon {
    font-size: 20px;
}

.warning-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--danger-color);
}

.warning-list {
    padding: 16px 24px;
}

.warning-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.05);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.warning-item:last-child {
    margin-bottom: 0;
}

.warning-badge {
    background: var(--danger-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.warning-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.warning-class {
    font-weight: 600;
    color: var(--text-primary);
}

.warning-detail {
    color: var(--text-secondary);
    font-size: 13px;
}

/* 进步榜区域样式 */
.progress-section {
    background: white;
    border-radius: var(--radius-sm);
    margin: 0 30px 16px 30px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.progress-icon {
    font-size: 20px;
}

.progress-title {
    font-size: 16px;
    font-weight: 600;
}

.progress-note {
    font-size: 13px;
    opacity: 0.8;
}

.progress-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px 24px;
}

.progress-card {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-color);
}

.progress-card.improvement {
    border-left: 4px solid var(--success-color);
}

.progress-card.decline {
    border-left: 4px solid var(--danger-color);
}

.progress-card h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    color: var(--text-primary);
}

.progress-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.progress-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.progress-rank.gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.progress-rank.silver {
    background: linear-gradient(135deg, #94a3b8, #64748b);
}

.progress-rank.bronze {
    background: linear-gradient(135deg, #b45309, #92400e);
}

.progress-rank.normal {
    background: var(--text-secondary);
}

.progress-info {
    flex: 1;
}

.progress-class {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.progress-grade {
    color: var(--text-secondary);
    font-size: 12px;
}

.progress-change {
    font-weight: 600;
    font-size: 14px;
}

.progress-change.up {
    color: var(--success-color);
}

.progress-change.down {
    color: var(--danger-color);
}

.progress-detail {
    font-size: 12px;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .progress-container {
        grid-template-columns: 1fr;
    }
}

/* 智能建议区域样式 */
.suggestion-section {
    background: white;
    border-radius: var(--radius-sm);
    margin: 0 30px 16px 30px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.suggestion-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: white;
}

.suggestion-icon {
    font-size: 20px;
}

.suggestion-title {
    font-size: 16px;
    font-weight: 600;
}

.suggestion-subtitle {
    font-size: 13px;
    opacity: 0.8;
    margin-left: auto;
}

.suggestion-content {
    padding: 20px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.suggestion-card {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-color);
    border-left: 3px solid var(--primary-color);
    transition: all 0.3s;
}

.suggestion-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.suggestion-card.hygiene {
    border-left-color: #10b981;
}

.suggestion-card.discipline {
    border-left-color: #f59e0b;
}

.suggestion-card.eye {
    border-left-color: #6366f1;
}

.suggestion-card.indoor {
    border-left-color: #ec4899;
}

.suggestion-card.flag {
    border-left-color: #ef4444;
}

.suggestion-card.positive {
    border-left-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

.suggestion-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.suggestion-category {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.suggestion-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: var(--primary-color);
    color: white;
}

.suggestion-badge.positive {
    background: var(--success-color);
}

.suggestion-badge.attention {
    background: var(--warning-color);
}

.suggestion-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.suggestion-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* 时间范围条样式 */
.time-range-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(59, 130, 246, 0.06);
    border-radius: var(--radius-sm);
    margin: 0 30px 16px 30px;
    border-left: 3px solid var(--primary-color);
}

.time-range-icon {
    font-size: 16px;
}

.time-range-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.time-range-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}
