/* ============================================
   江西高校信息查询 - 样式表
   设计风格：清新、年轻化、响应式
   目标受众：18-19岁准大一新生
   ============================================ */

/* === CSS 变量 === */
:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --accent: #ff6d3f;
  --accent-light: #fff0eb;
  --success: #0d9e6c;
  --warning: #f5a623;
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --text: #2c3e50;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;
  --border: #e1e4e8;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === 头部 === */
.site-header {
  background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 50%, #1a73e8 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  color: #fff;
  padding: 40px 0 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.site-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(255,255,255,0.05) 0%, transparent 50%);
  pointer-events: none;
}

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

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

.header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.brand-icon {
  font-size: 2.5rem;
  animation: bounce 2s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.brand-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.brand-subtitle {
  font-size: 1rem;
  opacity: 0.9;
  font-weight: 400;
}

/* === 弹窗 (使用原生 dialog) === */
#welcomeModal {
  border: none;
  border-radius: var(--radius-xl);
  padding: 0;
  max-width: 460px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.4s ease;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

#welcomeModal::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  animation: backdropIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) translateY(0);
  }
}

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

.modal-content {
  padding: 36px 28px 28px;
  text-align: center;
  position: relative;
  background: #fff;
  border-radius: var(--radius-xl);
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
  line-height: 1;
}

.modal-close-btn:hover {
  background: #f1f3f4;
  color: var(--text);
}

.modal-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  animation: bounce 2s ease infinite;
}

#modal-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.modal-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

.modal-text strong {
  color: var(--primary);
  font-weight: 600;
}

.modal-qq-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #f0f7ff, #e8f0fe);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  margin-bottom: 20px;
  user-select: all;
}

.qq-icon {
  font-size: 1.8rem;
}

.qq-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
}

.btn-copy:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.35);
}

.btn-copy:active {
  transform: translateY(0);
}

.btn-copy.copied {
  background: var(--success);
}

.btn-join {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-join:hover {
  background: #e55a2f;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 109, 63, 0.35);
}

.modal-tip {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === 搜索区域 === */
.search-section {
  background: #fff;
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 2px solid transparent;
  border-radius: 30px;
  padding: 0 20px;
  transition: all var(--transition);
  max-width: 600px;
  margin: 0 auto 16px;
}

.search-box:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1);
}

.search-icon {
  font-size: 1.2rem;
  margin-right: 10px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1rem;
  padding: 14px 0;
  outline: none;
  font-family: var(--font-sans);
  color: var(--text);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 50%;
  transition: all var(--transition);
  line-height: 1;
}

.search-clear:hover {
  background: #e1e4e8;
  color: var(--text);
}

/* 筛选标签 */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.filter-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tag {
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
  white-space: nowrap;
}

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

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

.results-info {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

#searchQuery {
  margin-left: 8px;
  color: var(--primary);
  font-weight: 600;
}

/* === 主体内容 === */
.main-content {
  flex: 1;
  padding: 28px 0 40px;
}

.university-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

/* === 高校卡片 === */
.university-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.university-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #4fc3f7);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.university-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

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

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

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.card-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-level {
  background: #fff3e0;
  color: #e65100;
}

.badge-city {
  background: var(--primary-light);
  color: var(--primary);
}

.card-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
  flex: 1;
}

.detail-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.detail-icon {
  flex-shrink: 0;
  font-size: 0.9rem;
  margin-top: 1px;
}

.detail-label {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.detail-value {
  color: var(--text);
  font-weight: 500;
}

.card-footer {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition);
  padding: 6px 12px;
  border-radius: 20px;
}

.card-link:hover {
  background: var(--primary-light);
}

.card-link.external::after {
  content: '↗';
  font-size: 0.7rem;
  margin-left: 2px;
}

/* === 无结果 === */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results-icon {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 16px;
}

.no-results p {
  font-size: 1rem;
}

/* === 页脚 === */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
}

.footer-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.footer-warning {
  font-size: 0.8rem;
  color: var(--warning);
  margin: 10px 0 6px;
  font-weight: 500;
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 10px;
}

/* === 回到顶部按钮 === */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  z-index: 200;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  font-family: var(--font-sans);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* === Toast 提示 === */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #323232;
  color: #fff;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

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

/* === 响应式设计 === */
@media (max-width: 768px) {
  .brand-title {
    font-size: 1.5rem;
  }

  .brand-icon {
    font-size: 2rem;
  }

  .university-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .university-card {
    padding: 18px;
  }

  .card-details {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .search-section {
    padding: 16px 0 12px;
  }

  .search-box {
    padding: 0 16px;
  }

  .search-input {
    padding: 12px 0;
  }

  .filter-bar {
    gap: 4px;
  }

  .filter-tag {
    padding: 4px 10px;
    font-size: 0.75rem;
  }

  .modal-content {
    padding: 28px 20px 22px;
  }

  #modal-title {
    font-size: 1.15rem;
  }

  .qq-number {
    font-size: 1.2rem;
    letter-spacing: 2px;
  }

  .modal-actions {
    flex-direction: column;
    align-items: center;
  }

  .btn-copy, .btn-join {
    width: 100%;
    justify-content: center;
  }

  .back-to-top {
    bottom: 20px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 400px) {
  .brand-title {
    font-size: 1.25rem;
  }

  .card-header {
    flex-direction: column;
  }

  .filter-tags {
    gap: 4px;
  }

  .filter-tag {
    padding: 3px 8px;
    font-size: 0.7rem;
  }
}

/* === 打印样式 === */
@media print {
  .search-section,
  .site-footer,
  .back-to-top,
  #welcomeModal {
    display: none !important;
  }

  .university-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
