/* 心有所SHU - 全局样式 (重构版) */

/* ===== CSS 变量 ===== */
:root {
  /* 主色调 - 温暖的红色系 */
  --primary: #e85a5a;
  --primary-hover: #d44a4a;
  --primary-light: #fef2f2;

  /* 背景色 */
  --background: #fafafa;
  --foreground: #1a1a1a;
  --muted: #f5f5f5;
  --muted-foreground: #737373;

  /* 卡片 */
  --card: #ffffff;
  --card-foreground: #1a1a1a;

  /* 边框和输入框 */
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #e85a5a;

  /* 功能色 */
  --success: #22c55e;
  --error: #ef4444;
  --info: #3b82f6;

  /* 圆角 */
  --radius: 12px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ===== 基础重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

/* ===== 容器 ===== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px;
}

/* ===== 导航栏 ===== */
.navbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.9);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--foreground);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a {
  color: var(--muted-foreground);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-links a:hover {
  color: var(--foreground);
  background: var(--muted);
}

.nav-links .btn {
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.nav-links .btn:hover {
  background: var(--primary-hover);
}

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--card-foreground);
  letter-spacing: -0.02em;
}

/* ===== 表单 ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--foreground);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--card);
  color: var(--foreground);
  transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(232, 90, 90, 0.15);
}

.form-group input::placeholder {
  color: var(--muted-foreground);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group .hint {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  margin-top: 6px;
}

/* 复选框组 */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.checkbox-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--muted);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 400;
  font-size: 0.9rem;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.checkbox-group label:hover {
  background: var(--primary-light);
}

.checkbox-group input:checked + label,
.checkbox-group label:has(input:checked) {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.checkbox-group input {
  width: auto;
  accent-color: var(--primary);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

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

.btn-secondary {
  background: var(--muted);
  color: var(--foreground);
}

.btn-secondary:hover {
  background: var(--border);
}

/* ===== 提示消息 ===== */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

/* ===== 首页 Hero ===== */
.hero {
  text-align: center;
  padding: 80px 32px;
  background: linear-gradient(135deg, rgba(232, 90, 90, 0.85) 0%, rgba(180, 60, 60, 0.9) 100%),
              url('/images/campus.jpg') center/cover no-repeat;
  color: white;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.hero::before {
  display: none;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 16px;
  position: relative;
  letter-spacing: -0.03em;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 12px;
  position: relative;
}

.hero .btn {
  background: white;
  color: var(--primary);
  font-weight: 600;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}

.hero .btn:hover {
  background: #fafafa;
  transform: translateY(-2px);
}

/* ===== 功能卡片 ===== */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 40px;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  text-align: center;
  transition: all 0.3s;
}

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

.feature-card .icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  display: block;
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--foreground);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--muted-foreground);
}

/* Hero 内的图标 */
.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 16px;
  position: relative;
  letter-spacing: -0.03em;
}

/* ===== 问卷页 ===== */
.form-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
  margin-bottom: 24px;
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  margin: 24px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  display: inline-block;
}

/* ===== 匹配结果 ===== */
.match-card {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  padding: 32px;
  border-radius: var(--radius-lg);
  text-align: center;
}

.match-card h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--foreground);
}

.match-info {
  background: white;
  padding: 24px;
  border-radius: var(--radius);
  margin: 20px 0;
  text-align: left;
}

.match-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ===== 表格 ===== */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th, td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--muted);
}

/* ===== 页脚 ===== */
.footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--muted-foreground);
  font-size: 0.9rem;
  margin-top: 60px;
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.footer-links a {
  color: var(--muted-foreground);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--primary);
}

.info-page {
  max-width: 860px;
  padding-top: 48px;
}

.info-page .card {
  margin-bottom: 0;
}

.info-meta {
  color: var(--muted-foreground);
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.info-lead {
  color: var(--muted-foreground);
  margin-bottom: 28px;
}

.info-section + .info-section {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 24px;
}

.info-section h2 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.info-section p + p {
  margin-top: 10px;
}

.info-section ul {
  padding-left: 20px;
}

.info-section li + li {
  margin-top: 8px;
}

/* ===== 动画 ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card, .hero, .feature-card {
  animation: fadeIn 0.4s ease-out;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .navbar .container {
    padding: 12px 16px;
  }

  .hero {
    padding: 48px 24px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .card {
    padding: 24px;
    border-radius: var(--radius);
  }

  .nav-links {
    gap: 4px;
  }

  .nav-links > a:not(.btn) {
    display: none;
  }

  /* 移动端下拉菜单里的链接要显示 */
  :root .dropdown-menu a {
    display: block;
  }

  /* 移动端下拉菜单样式 */
  :root .dropdown {
    display: inline-block;
  }

  :root .dropdown-toggle {
    padding: 8px 12px;
  }

  :root .dropdown-menu {
    position: fixed;
    top: 60px;
    right: 8px;
    left: auto;
    width: auto;
    min-width: 180px;
    max-width: calc(100vw - 16px);
    box-sizing: border-box;
  }

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

  .form-group input[type="text"],
  .form-group input[type="email"],
  .form-group input[type="password"],
  .form-group input[type="search"],
  .form-group input[type="tel"],
  .form-group input[type="url"],
  .form-group input[type="number"],
  .form-group textarea,
  .form-group select {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .btn {
    width: 100%;
  }

  .footer-links {
    gap: 12px;
  }
}

/* ===== 下拉菜单 ===== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.dropdown-toggle:hover {
  background: var(--muted);
}

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  min-width: 160px;
  max-width: calc(100vw - 32px);
  z-index: 1000;
  margin-top: 4px;
  box-sizing: border-box;
}

/* 伪元素填充间隙，保持 hover 连续性 */
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 4px;
  pointer-events: auto;
}

.dropdown-menu a {
  display: block;
  padding: 10px 16px;
  color: var(--foreground);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.dropdown-menu a:hover {
  background: var(--muted);
}

.dropdown:hover .dropdown-menu {
  display: block;
}

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