/* 全局样式 */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 地图容器 */
#map {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* 筛选按钮样式 */
.filter-btn {
    font-size: 0.75rem;
    padding: 4px 14px;
    border-radius: 9999px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #3b82f6;
}

.filter-btn.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* 自定义标记样式 */
.custom-marker {
    position: relative;
    cursor: pointer;
}

.marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -20px 0 0 -16px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
}

.marker-pin::after {
    content: '';
    width: 18px;
    height: 18px;
    margin: 7px 0 0 7px;
    background: rgba(255, 255, 255, 0.4);
    position: absolute;
    border-radius: 50%;
}

.marker-pin.public {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.marker-pin.private {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

.marker-pin.vocational {
    background: linear-gradient(135deg, #10b981, #059669);
}

.marker-pin:hover, .marker-pin.active {
    transform: rotate(-45deg) scale(1.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.35);
}

.marker-label {
    position: absolute;
    white-space: nowrap;
    left: 50%;
    transform: translateX(-50%);
    top: 18px;
    font-size: 11px;
    font-weight: 600;
    color: #1e293b;
    text-shadow: 0 0 4px white, 0 0 4px white, 0 0 4px white, 0 0 4px white;
    pointer-events: none;
}

/* 弹窗样式覆盖 */
.leaflet-popup-content-wrapper {
    border-radius: 16px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    padding: 0 !important;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    min-width: 300px;
}

.leaflet-popup-tip {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1) !important;
}

.popup-card {
    padding: 0;
}

.popup-header {
    padding: 16px 20px;
    color: white;
    position: relative;
    overflow: hidden;
}

.popup-header.public-bg {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.popup-header.private-bg {
    background: linear-gradient(135deg, #f97316, #ef4444);
}

.popup-header.vocational-bg {
    background: linear-gradient(135deg, #10b981, #0d9488);
}

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

.popup-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px 0;
    position: relative;
    z-index: 1;
}

.popup-header .badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    position: relative;
    z-index: 1;
}

.popup-header .popup-remark {
    display: inline-block;
    font-size: 10px;
    padding: 1px 8px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.15);
    margin-left: 6px;
    position: relative;
    z-index: 1;
}

.popup-body {
    padding: 16px 20px;
}

.popup-info-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    font-size: 13px;
    color: #4b5563;
}

.popup-info-row:last-child {
    margin-bottom: 0;
}

.popup-info-row i {
    width: 20px;
    margin-right: 10px;
    margin-top: 2px;
    text-align: center;
    flex-shrink: 0;
}

/* ========== 分数线样式 ========== */
.score-section {
    background: linear-gradient(135deg, #f0f9ff, #faf5ff);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid #e0e7ff;
}

.score-title {
    font-size: 12px;
    font-weight: 700;
    color: #4338ca;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.score-total-note {
    font-size: 10px;
    font-weight: 400;
    color: #9ca3af;
    margin-left: 6px;
}

/* 分数线表格（住宿/走读对比） */
.score-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 6px;
    font-size: 12px;
}

.score-table thead th {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    text-align: center;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
}

.score-table thead th:first-child {
    width: 50px;
}

.score-th-ac {
    color: #2563eb !important;
}

.score-th-d {
    color: #ea580c !important;
}

.score-row-label {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    padding: 6px 8px;
    white-space: nowrap;
}

.score-cell {
    text-align: center;
    padding: 6px 8px;
    font-weight: 800;
    font-size: 18px;
    line-height: 1.2;
}

.score-cell-ac {
    color: #2563eb;
}

.score-cell-d {
    color: #ea580c;
}

.score-table tbody tr {
    background: white;
    border-radius: 8px;
    transition: background 0.15s;
}

.score-table tbody tr:hover {
    background: #f8fafc;
}

.score-table tbody tr:first-child td {
    border-top: none;
}

.score-table tbody tr + tr td {
    border-top: 1px solid #f3f4f6;
}

.score-grid {
    display: flex;
    gap: 8px;
}

.score-item {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    border-radius: 10px;
    background: white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s;
}

.score-item:hover {
    transform: translateY(-1px);
}

.score-item.score-ac {
    border-bottom: 3px solid #3b82f6;
}

.score-item.score-d {
    border-bottom: 3px solid #f97316;
}

.score-item.score-acd {
    border-bottom: 3px solid #8b5cf6;
}

.score-label {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 4px;
}

.score-sublabel {
    font-size: 9px;
    color: #9ca3af;
    font-weight: 400;
    display: block;
}

.score-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1.1;
}

.score-ac .score-value {
    color: #2563eb;
}

.score-d .score-value {
    color: #ea580c;
}

.score-acd .score-value {
    color: #7c3aed;
}

/* 分数线徽章（用于列表和搜索） */
.score-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 6px;
    margin-left: 6px;
    vertical-align: middle;
}

.score-badge-ac {
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    color: #2563eb;
}

.score-badge-acd {
    background: linear-gradient(135deg, #f3e8ff, #ede9fe);
    color: #7c3aed;
}

/* 列表中的分数行 */
.school-score-row {
    font-size: 11px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    color: #6b7280;
}

/* 分数线筛选栏 */
#scoreFilterBar {
    background: linear-gradient(135deg, #faf5ff 0%, #f0f9ff 100%);
    border-top: 1px solid #e5e7eb;
}

#scoreFilterBar input[type="number"] {
    -moz-appearance: textfield;
}

#scoreFilterBar input[type="number"]::-webkit-outer-spin-button,
#scoreFilterBar input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 搜索结果样式 */
.search-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s;
}

.search-item:hover {
    background: #eff6ff;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item .name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.search-item .info {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

.search-item .tag {
    display: inline-block;
    font-size: 10px;
    padding: 1px 8px;
    border-radius: 9999px;
    margin-left: 8px;
    vertical-align: middle;
}

.tag-public {
    background: #dbeafe;
    color: #2563eb;
}

.tag-private {
    background: #ffedd5;
    color: #ea580c;
}

.tag-vocational {
    background: #d1fae5;
    color: #059669;
}

/* 侧边栏学校卡片 */
.school-card {
    padding: 14px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: all 0.15s;
}

.school-card:hover {
    background: #f0f9ff;
}

.school-card .school-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.school-card .school-meta {
    font-size: 12px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 8px;
}

.school-card .school-meta .district-badge {
    background: #f3f4f6;
    padding: 1px 8px;
    border-radius: 4px;
    font-size: 11px;
}

/* 滚动条美化 */
#schoolList::-webkit-scrollbar,
#searchResultsList::-webkit-scrollbar {
    width: 4px;
}

#schoolList::-webkit-scrollbar-track,
#searchResultsList::-webkit-scrollbar-track {
    background: transparent;
}

#schoolList::-webkit-scrollbar-thumb,
#searchResultsList::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

/* 高亮匹配文字 */
.highlight {
    background: #fef08a;
    padding: 0 2px;
    border-radius: 2px;
}

/* 缩放控件样式 */
.leaflet-control-zoom a {
    border-radius: 10px !important;
    width: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    font-size: 18px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-control-zoom {
    border: none !important;
    border-radius: 12px !important;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12) !important;
}

/* 无结果状态 */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #e5e7eb;
}

.no-results p {
    font-size: 14px;
}

/* 脉冲动画 - 用于选中标记 */
@keyframes pulse-ring {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

.marker-pulse {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    left: 50%;
    top: 50%;
    margin: -16px 0 0 -16px;
    animation: pulse-ring 1.5s ease-out infinite;
}

.marker-pulse.public-pulse {
    background: rgba(59, 130, 246, 0.4);
}

.marker-pulse.private-pulse {
    background: rgba(249, 115, 22, 0.4);
}

.marker-pulse.vocational-pulse {
    background: rgba(16, 185, 129, 0.4);
}

/* 展开收缩筛选区域样式 */
#filterBar,
#scoreFilterBar {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#filterBar.collapsed,
#scoreFilterBar.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden !important;
}

#toggleFilters {
    transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
}

#toggleFilters:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: scale(1.05);
}

#toggleFilters:active {
    transform: scale(0.95);
}

/* 顶部导航栏样式 */
#app-header {
    transition: all 0.3s ease;
}

/* 当筛选区域收缩时，调整地图位置 */
.filters-collapsed #map {
    top: 64px !important;
}

/* ========== 视图切换按钮 ========== */
.view-switch {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 2px;
    gap: 2px;
}

.view-switch-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.view-switch-btn:hover {
    color: #6b7280;
    background: #e5e7eb;
}

.view-switch-btn.active {
    background: white;
    color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ========== 列表视图容器 ========== */
.table-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.table-view.hidden {
    display: none !important;
}

.table-container {
    flex: 1;
    overflow: auto;
    padding: 0;
    margin-top: 140px; /* 为顶部header留空间 */
}

/* ========== 表格样式 ========== */
.school-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    background: white;
}

.school-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.school-table thead th {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 10px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
    user-select: none;
    position: relative;
}

.school-table thead th i {
    font-size: 10px;
    margin-left: 4px;
    color: #cbd5e1;
    transition: color 0.2s;
}

.th-sortable {
    cursor: pointer;
    transition: background 0.15s;
}

.th-sortable:hover {
    background: linear-gradient(135deg, #eff6ff, #eef2ff) !important;
}

.th-sortable:hover i {
    color: #3b82f6 !important;
}

.th-active {
    background: linear-gradient(135deg, #eff6ff, #eef2ff) !important;
}

.th-active i {
    color: #3b82f6 !important;
}

/* ========== 表格行样式 ========== */
.school-table tbody tr {
    transition: background 0.12s;
    border-bottom: 1px solid #f1f5f9;
}

.school-table tbody tr:nth-child(even) {
    background: #fafbfc;
}

.school-table tbody tr:hover {
    background: #eff6ff !important;
    cursor: pointer;
}

.school-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

/* 序号列 */
.td-index {
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    width: 40px;
    font-weight: 500;
}

/* 学校名称列 */
.td-name {
    font-weight: 600;
    color: #1e293b;
    min-width: 160px;
    max-width: 220px;
}

.school-name-text {
    cursor: pointer;
}

.school-name-text:hover {
    color: #3b82f6;
}

/* 备注标签 */
.table-remark {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #fef3c7;
    color: #d97706;
    margin-left: 6px;
    font-weight: 400;
    vertical-align: middle;
}

/* 分数列 */
.td-score {
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    min-width: 70px;
}

.td-score-ac {
    color: #2563eb;
}

.td-score-ac-light {
    color: #60a5fa;
    font-weight: 600;
}

.td-score-d {
    color: #ea580c;
}

.td-score-d-light {
    color: #fb923c;
    font-weight: 600;
}

.td-score-acd {
    color: #7c3aed;
}

/* 地址列 */
.td-address {
    color: #94a3b8;
    font-size: 12px;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 底部栏 */
.table-footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 表格滚动条美化 */
.table-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.table-container::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 响应式调整 */
@media (max-width: 768px) {
    #toggleFilters {
        width: 36px;
        height: 36px;
    }
    
    #filterBar,
    #scoreFilterBar {
        flex-direction: column;
        gap: 8px;
    }
    
    #filterBar .flex-wrap,
    #scoreFilterBar .flex-wrap {
        gap: 6px;
    }
}
