* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

#lastUpdate {
    background: rgba(255,255,255,0.1);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 30px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.total {
    border-color: #3498db;
}

.stat-card.internal {
    border-color: #2ecc71;
}

.stat-card.external {
    border-color: #e74c3c;
}

.stat-card.valid {
    border-color: #9b59b6;
}

.stat-card.invalid {
    border-color: #f39c12;
}

.stat-card h3 {
    color: #7f8c8d;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    padding: 0 30px 30px;
}

.chart-container {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    height: 350px;
    display: flex;
    flex-direction: column;
}

.chart-container h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.chart-container canvas {
    flex: 1;
    min-height: 0;
}

/* 统一容器宽度 */
.recent-scans,
.summary-grid {
    padding: 0 30px 30px;
    width: calc(100% - 60px);
    margin: 0 auto;
}

.recent-scans h3,
.summary-grid h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.3rem;
}

.table-container {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

thead {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

tbody tr:hover {
    background: #f5f9ff;
}

.status-valid {
    color: #27ae60;
    font-weight: bold;
}

.status-invalid {
    color: #e74c3c;
    font-weight: bold;
}

/* 分组统计表格特定样式 */
#groupStatsTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    table-layout: fixed;
}

#groupStatsTable thead {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

#groupStatsTable th, 
#groupStatsTable td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

/* 操作列固定宽度并右对齐 */
#groupStatsTable th:last-child,
#groupStatsTable td:last-child {
    width: 150px;
    text-align: right;
    padding-right: 25px;
}

/* 其他列自适应宽度 */
#groupStatsTable th:not(:last-child),
#groupStatsTable td:not(:last-child) {
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 操作按钮样式 */
.reset-group-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    white-space: nowrap;
    display: inline-block;
    text-align: center;
    min-width: 100px;
}

.reset-group-btn:hover {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.test-form {
    padding: 30px;
    background: #f8f9fa;
    margin: 0 30px 30px;
    border-radius: 15px;
}

.test-form h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #34495e;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
}

.summary-grid {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

#summaryTable {
    width: 100%;
    border-collapse: collapse;
}

#summaryTable th, #summaryTable td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

#summaryTable th {
    background-color: #f8f9fa;
    font-weight: 600;
}

#summaryTable tr:hover {
    background-color: #f5f5f5;
}

.reset-btn {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.reset-btn:hover {
    background-color: #c0392b;
}

.no-data {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 20px;
}

.no-group-data {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
    padding: 30px;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .header-controls {
        flex-direction: column;
    }
    
    #groupStatsTable th, 
    #groupStatsTable td {
        padding: 12px 10px;
        font-size: 0.85rem;
    }
    
    #groupStatsTable th:last-child,
    #groupStatsTable td:last-child {
        width: 120px;
        padding-right: 15px;
    }
    
    .table-container {
        border-radius: 10px;
    }
    
    .recent-scans,
    .summary-grid {
        padding: 0 15px 30px;
        width: calc(100% - 30px);
    }
}
