@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

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

body {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  background: #0a0a0f;
  min-height: 100vh;
  color: #c9d1d9;
  line-height: 1.6;
}

/* 背景网格 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(88, 166, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(88, 166, 255, 0.02) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
  z-index: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
  position: relative;
  z-index: 1;
}

/* 头部 */
.header {
  margin-bottom: 40px;
  border: 1px solid #30363d;
  background: linear-gradient(135deg, #161b22 0%, #0d1117 100%);
  border-radius: 12px;
  padding: 25px;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #58a6ff, #a371f7, #58a6ff);
  background-size: 200% 100%;
  animation: gradient 3s ease infinite;
}

@keyframes gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.header-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #21262d;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #3fb950;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(63, 185, 80, 0.5);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-text {
  color: #3fb950;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 1px;
}

.session-info {
  color: #484f58;
  font-size: 0.7rem;
}

.session-info span {
  color: #7d8590;
}

.title-container {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 10px;
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #c9d1d9;
  letter-spacing: -1px;
}

.data-year-badge {
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.3);
  color: #58a6ff;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
}

.data-year-badge.active {
  background: rgba(88, 166, 255, 0.2);
  border-color: #58a6ff;
}

.data-year-badge.inactive {
  opacity: 0.5;
  cursor: not-allowed;
}

.data-year-badge.inactive:hover {
  opacity: 0.7;
}

.year-badges {
  display: flex;
  gap: 10px;
}

.header-desc {
  color: #484f58;
  font-size: 0.85rem;
}

/* 保密提示样式（居中突出显示） */
.security-notice {
  background: linear-gradient(135deg, rgba(248, 81, 73, 0.15) 0%, rgba(251, 146, 60, 0.1) 100%);
  border: 1px solid rgba(248, 81, 73, 0.5);
  border-top: 3px solid #f85149;
  padding: 18px 24px;
  border-radius: 10px;
  margin-bottom: 24px;
  font-size: 1rem;
  color: #ff9492;
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(248, 81, 73, 0.08);
  font-weight: 500;
}

.security-notice .notice-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.security-notice .notice-text {
  letter-spacing: 2px;
}

/* 搜索区域 */
.search-section {
  background: linear-gradient(135deg, #161b22 0%, #0d1117 100%);
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 30px;
}

.search-bar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* 第一行：学校名称 + 专业关键词 */
.search-row-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* 第二行：省份（独立一行，明显突出） */
.search-row-province {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

/* 省份输入框特殊样式 */
.province-group {
  background: rgba(56, 139, 253, 0.05);
  border: 1px solid rgba(56, 139, 253, 0.15);
  padding: 12px 16px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.province-group:hover {
  background: rgba(56, 139, 253, 0.08);
  border-color: rgba(56, 139, 253, 0.3);
}

.province-input-wrap {
  position: relative;
}

.province-input-wrap input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #58a6ff;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.province-input-wrap input:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
  cursor: text;
}

.province-input-wrap input::placeholder {
  color: #58a6ff;
  opacity: 0.7;
}

.province-reset {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #484f58;
  cursor: pointer;
  font-size: 1.5rem;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  user-select: none;
  transition: all 0.15s ease;
}

.province-reset:hover {
  color: #f85149;
  background: rgba(248, 81, 73, 0.15);
}

.input-group {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 省份下拉检索框样式 */
.combobox-wrapper {
  position: relative;
}

.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  list-style: none;
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.combobox-list.show {
  display: block;
}

.combobox-item {
  padding: 10px 14px;
  border-radius: 6px;
  color: #c9d1d9;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.9rem;
}

.combobox-item:hover {
  background: #21262d;
}

.combobox-item.disabled {
  color: #484f58;
  cursor: not-allowed;
  font-style: italic;
}

/* "不限"选项高亮显示 */
.combobox-item-unlimited {
  background: rgba(88, 166, 255, 0.08);
  border: 1px solid rgba(88, 166, 255, 0.2);
  font-weight: 500;
  color: #58a6ff;
  margin-bottom: 2px;
}

.combobox-item-unlimited:hover {
  background: rgba(88, 166, 255, 0.15);
}

.input-label {
  color: #7d8590;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.input-group input {
  width: 100%;
  padding: 14px 16px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.input-group input:focus {
  outline: none;
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.input-group input::placeholder {
  color: #484f58;
}

.search-btn {
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.search-btn:hover {
  background: linear-gradient(135deg, #2ea043 0%, #3fb950 100%);
  transform: translateY(-1px);
  box-shadow: 0 5px 20px rgba(46, 160, 67, 0.3);
}

/* 可折叠筛选器 */
.filter-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #21262d;
}

.filter-toggle {
  background: none;
  border: none;
  color: #7d8590;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  transition: color 0.3s ease;
}

.filter-toggle:hover {
  color: #58a6ff;
}

.toggle-icon {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.filter-toggle.active .toggle-icon {
  transform: rotate(90deg);
}

.filter-content {
  display: none;
  margin-top: 15px;
  animation: slideDown 0.3s ease;
}

.filter-content.show {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
}

.form-group select {
  width: 100%;
  padding: 12px 16px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.form-group select:focus {
  outline: none;
  border-color: #58a6ff;
}

.form-group select option {
  background: #0d1117;
  color: #c9d1d9;
}

/* 结果区域 */
.results-section {
  background: linear-gradient(135deg, #161b22 0%, #0d1117 100%);
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 25px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #21262d;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

#resultCount {
  font-size: 0.95rem;
  color: #c9d1d9;
  font-weight: 500;
}

.data-tag {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: #f85149;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.sort-info {
  color: #484f58;
  font-size: 0.8rem;
  background: #21262d;
  padding: 6px 12px;
  border-radius: 6px;
}

.logout-btn {
  background: #21262d;
  color: #7d8590;
  border: 1px solid #30363d;
  padding: 6px 14px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background: rgba(248, 81, 73, 0.1);
  border-color: #f85149;
  color: #f85149;
}

/* 结果卡片 - 整块可点击 */
.results-container {
  display: grid;
  gap: 15px;
}

.card {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #58a6ff, #a371f7);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card:hover {
  border-color: #30363d;
  transform: translateX(5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.school-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #58a6ff;
  margin-bottom: 5px;
}

.school-name::before {
  content: '[ ';
  color: #484f58;
}

.school-name::after {
  content: ' ]';
  color: #484f58;
}

.major-name {
  color: #8b949e;
  font-size: 0.95rem;
}

.score-badge {
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 1.2rem;
  font-weight: 700;
}

.card-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-label {
  color: #484f58;
  font-size: 0.75rem;
}

.info-value {
  color: #c9d1d9;
  font-size: 0.85rem;
}

.highlight {
  background: rgba(255, 235, 59, 0.2);
  color: #ffeb3b;
  padding: 0 2px;
  border-radius: 2px;
}

.major-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255, 235, 59, 0.1);
  border: 1px solid rgba(255, 235, 59, 0.2);
  border-radius: 6px;
  font-size: 0.8rem;
  color: #ffeb3b;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #484f58;
}

.empty-state svg {
  width: 60px;
  height: 60px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h3 {
  color: #7d8590;
  margin-bottom: 10px;
}

/* 加载状态 */
.loading {
  text-align: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #21262d;
  border-top-color: #58a6ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

/* 弹窗 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: #161b22;
  border: 1px solid #30363d;
  margin: 2% auto;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

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

.close-btn {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  color: #7d8590;
  cursor: pointer;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #0d1117;
  border: 1px solid #30363d;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-btn:hover {
  color: #f85149;
  border-color: #f85149;
}

.modal-header {
  position: relative;
  padding: 30px;
  background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
  border-radius: 12px 12px 0 0;
}

.modal-header-content {
  position: relative;
  z-index: 1;
}

.modal-header h2 {
  font-size: 1.8rem;
  color: white;
  margin-bottom: 5px;
}

.modal-header p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.modal-body {
  padding: 30px;
}

/* 统计卡片 */
.school-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.stat-item {
  background: #0d1117;
  border: 1px solid #21262d;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.stat-label {
  display: block;
  color: #484f58;
  font-size: 0.8rem;
  margin-bottom: 8px;
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: #58a6ff;
}

/* 院系分组区域 */
.departments-section {
  margin-top: 20px;
}

.section-title {
  color: #c9d1d9;
  font-size: 1.2rem;
  margin-bottom: 5px;
  padding-bottom: 10px;
  border-bottom: 2px solid #21262d;
}

.section-hint {
  color: #484f58;
  font-size: 0.85rem;
  margin-bottom: 20px;
  margin-top: -5px;
}

.departments-list {
  display: grid;
  gap: 12px;
}

.department-card {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.department-card:hover {
  border-color: #30363d;
}

.department-header {
  width: 100%;
  background: none;
  border: none;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: inherit;
  font-family: inherit;
}

.department-header:hover {
  background: #161b22;
}

.dept-icon {
  font-size: 1.5rem;
}

.dept-info {
  flex: 1;
  text-align: left;
}

.dept-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: #58a6ff;
  margin-bottom: 4px;
}

.dept-count {
  display: block;
  font-size: 0.85rem;
  color: #7d8590;
}

.dept-arrow {
  color: #484f58;
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.department-content {
  padding: 0 20px 20px;
  border-top: 1px solid #21262d;
  animation: slideDown 0.3s ease;
}

/* 专业表格 */
.majors-table {
  margin-top: 15px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #21262d;
}

.major-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 15px;
  padding: 14px 16px;
  align-items: center;
  border-bottom: 1px solid #21262d;
  transition: background 0.2s ease;
}

.major-row:last-child {
  border-bottom: none;
}

.major-row:hover {
  background: #161b22;
}

.header-row {
  background: #0d1117;
  font-weight: 700;
  color: #7d8590;
  font-size: 0.85rem;
}

.major-cell {
  font-size: 0.9rem;
  color: #c9d1d9;
}

.major-name-cell {
  font-weight: 600;
}

.major-score-cell {
  color: #3fb950;
  font-weight: 700;
  font-size: 1.1rem;
}

.major-rank-cell {
  color: #f0883e;
}

.major-other-cell {
  color: #7d8590;
  font-size: 0.85rem;
}

.inline-note {
  color: #ffeb3b;
  font-size: 0.8rem;
}

/* 响应式 */
@media (max-width: 768px) {
  .search-inputs {
    grid-template-columns: 1fr;
  }
  
  .search-bar {
    flex-direction: column;
  }
  
  .filter-grid {
    grid-template-columns: 1fr;
  }
  
  .school-stats {
    grid-template-columns: 1fr;
  }
  
  .header h1 {
    font-size: 1.5rem;
  }
  
  .title-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  /* 院系专业表格 - 移动端优化 */
  .major-row {
    grid-template-columns: 1.5fr 1fr;
    gap: 8px;
    font-size: 0.8rem;
  }
  
  .major-row .major-rank-cell,
  .major-row .major-other-cell {
    grid-column: span 2;
    font-size: 0.75rem;
  }
  
  .header-row {
    display: none;
  }
}
