/* ========================================
   高校录取分数查询系统 - 样式表
   ======================================== */

/* ----- CSS Variables ----- */
:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-header: linear-gradient(135deg, #1e1b4b 0%, #3730a3 50%, #4f46e5 100%);
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: 0.2s ease;
}

/* ----- Reset & Base ----- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----- Header ----- */
.header {
    background: var(--bg-header);
    color: #fff;
    padding: 0 2rem;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-icon {
    font-size: 1.6rem;
}

/* ----- Navigation Tabs ----- */
.nav-tabs {
    display: flex;
    gap: 4px;
    height: 100%;
    align-items: stretch;
}

.nav-tab {
    display: flex;
    align-items: center;
    padding: 0 1.2rem;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.nav-tab:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.nav-tab.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
}

/* ----- Main Content ----- */
.main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ----- Stats Cards Grid ----- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    border: 1px solid var(--border-light);
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.orange { background: #fef3c7; color: #d97706; }
.stat-icon.purple { background: #e9d5ff; color: #7c3aed; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.teal { background: #ccfbf1; color: #0d9488; }

.stat-info h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ----- Cards ----- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 1rem;
}

.card-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ----- Search Bar ----- */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: #fff;
}

/* ----- Form Controls ----- */
select, .select {
    padding: 0.65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    min-width: 130px;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
}

/* ----- Filter Tags ----- */
.filter-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tag {
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: #fff;
    color: var(--text-secondary);
    transition: var(--transition);
    user-select: none;
}

.filter-tag:hover {
    border-color: var(--primary-light);
    color: var(--primary);
}

.filter-tag.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ----- Table ----- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background: #f8fafc;
}

/* Tags in table */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 3px;
}

.badge-985 { background: #fef3c7; color: #92400e; }
.badge-211 { background: #dbeafe; color: #1e40af; }
.badge-double { background: #e9d5ff; color: #6b21a8; }
.badge-public { background: #d1fae5; color: #065f46; }
.badge-private { background: #fce7f3; color: #9d174d; }
.badge-science { background: #dbeafe; color: #1e40af; }
.badge-arts { background: #fce7f3; color: #9d174d; }

/* ----- Province Grid ----- */
.province-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
}

.province-item {
    padding: 0.75rem 0.5rem;
    text-align: center;
    background: var(--bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.province-item:hover {
    border-color: var(--primary);
    background: #eef2ff;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.province-item.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ----- University Cards Grid ----- */
.uni-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.uni-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.uni-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.uni-card .name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.uni-card .meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.uni-card .info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ----- Score Result ----- */
.score-result {
    margin-top: 1.5rem;
}

.score-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.score-header h2 {
    font-size: 1.3rem;
    color: var(--text);
}

.score-header .subject-tag {
    padding: 0.2rem 0.7rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.score-chart {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.year-score {
    flex: 1;
    min-width: 140px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.year-score .year {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.year-score .score {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.year-score .rank {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

/* ----- Pagination ----- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.page-btn {
    padding: 0.4rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    background: #fff;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    color: var(--text);
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ----- Loading & Empty States ----- */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading::before {
    content: '';
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

.empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* ----- Toast / Notification ----- */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.9rem;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow);
    max-width: 360px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

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

/* ----- Chart Bars (simple inline) ----- */
.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.chart-bar-label {
    width: 80px;
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.chart-bar-track {
    flex: 1;
    height: 24px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.chart-bar-fill span {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .header { padding: 0 1rem; }
    .main { padding: 1rem; }

    .nav-tab { padding: 0 0.7rem; font-size: 0.8rem; }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-bar {
        flex-direction: column;
    }

    .search-input-wrapper {
        min-width: 100%;
    }

    .uni-grid {
        grid-template-columns: 1fr;
    }

    .province-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .score-chart {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .nav-tab {
        padding: 0 0.5rem;
        font-size: 0.75rem;
    }
}

/* ----- Quick Search Hero ----- */
.hero-search {
    text-align: center;
    padding: 2rem 0 1rem;
}

.hero-search h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.hero-search .search-bar {
    max-width: 700px;
    margin: 0 auto 1rem;
    justify-content: center;
}

/* ----- Two Column Layout ----- */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

/* Result count */
.result-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* Autocomplete dropdown */
.autocomplete-wrapper {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: var(--shadow);
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.autocomplete-item:hover {
    background: #eef2ff;
    color: var(--primary);
}

.autocomplete-item mark {
    background: #fef3c7;
    color: var(--text);
}

/* Highlighted text in search */
.highlight {
    background: #fef3c7;
    padding: 0 2px;
    border-radius: 2px;
}
