/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #2c3e50, #1a2530);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

/* 返回按钮样式 */
.back-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.back-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* 主要内容区域 */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* 搜索区域 */
.search-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.search-section h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    text-align: center;
}

/* 表单样式 */
#search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* 按钮样式 */
button[type="submit"],
button[type="reset"],
.view-details-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

button[type="reset"] {
    background-color: #95a5a6;
    margin-left: 0.5rem;
}

button[type="submit"]:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

button[type="reset"]:hover {
    background-color: #7f8c8d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.view-details-btn {
    background-color: #27ae60;
    align-self: center;
    padding: 0.6rem 1.2rem;
}

.view-details-btn:hover {
    background-color: #219653;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 结果区域 */
.results-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.results-section h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    text-align: center;
}

.result-count {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: #555;
}

/* 结果网格布局 */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

/* 学校卡片样式 */
.school-card {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 1.5rem;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.school-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.school-card-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.school-card-header h3 {
    color: #2c3e50;
    font-size: 1.4rem;
}

.school-card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.school-info {
    flex: 1;
}

.school-info p {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.school-info strong {
    color: #555;
}

/* 学校详情区域 */
.school-detail-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.school-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.school-header h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.school-header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* 学校信息网格 */
.school-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.info-item {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.info-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.info-item h4 {
    color: #7f8c8d;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.info-item p {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
}

/* 图表容器 */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.chart-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.chart-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.chart-card h3 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-size: 1.4rem;
}

.chart-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chart-container {
    position: relative;
    min-height: 200px;
    height: auto;
    margin: 0 auto;
}

/* 当图表容器中没有内容时，隐藏容器 */
.chart-container:empty {
    display: none;
}

/* 图例表格样式 */
.chart-legend-table {
    margin-top: 1rem;
}

.legend-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.legend-table th {
    background-color: #e9ecef;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
}

.legend-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

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

.legend-color-box {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    vertical-align: middle;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.legend-label {
    vertical-align: middle;
    font-weight: 500;
}

.legend-value {
    text-align: right;
    font-weight: 600;
    color: #495057;
}

.legend-percentage {
    text-align: right;
    color: #6c757d;
    font-weight: 500;
}

/* 年级分布样式 */
.grade-distribution {
    margin-top: 1rem;
}

.grade-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.grade-table th,
.grade-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.grade-table th {
    background-color: #f1f1f1;
    font-weight: 600;
}

.grade-table tr:hover {
    background-color: #f5f5f5;
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #7f8c8d;
    margin-top: 2rem;
    background-color: #2c3e50;
    color: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    main {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }
    
    .search-section,
    .results-section,
    .school-detail-section {
        padding: 1.5rem;
    }
    
    #search-form {
        grid-template-columns: 1fr;
    }
    
    .school-card-body {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .view-details-btn {
        align-self: stretch;
        margin-top: 1rem;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .chart-card {
        padding: 1.2rem;
    }
    
    .school-info-grid {
        grid-template-columns: 1fr;
    }
    
    .school-header h2 {
        font-size: 1.6rem;
    }
    
    .info-item {
        padding: 1.2rem;
    }
    
    .info-item p {
        font-size: 1.1rem;
    }
    
    .chart-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .school-header h2 {
        font-size: 1.4rem;
    }
    
    .chart-card h3 {
        font-size: 1.2rem;
    }
    
    .back-btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}