/* ========== 韵之都 - 小清新风格 CSS ========== */

/* ---------- CSS 变量 ---------- */
:root {
  --bg: #faf8f5;
  --bg-card: #ffffff;
  --bg-nav: rgba(255, 255, 255, 0.92);
  --bg-hero: linear-gradient(135deg, #e8f5e9 0%, #fff8e1 50%, #fce4ec 100%);
  --text: #3a3a3a;
  --text-light: #777;
  --primary: #66bb6a;
  --primary-dark: #43a047;
  --primary-light: #c8e6c9;
  --accent: #ffa726;
  --accent-dark: #f57c00;
  --accent-light: #ffe0b2;
  --danger: #ef5350;
  --danger-dark: #c62828;
  --danger-light: #ffcdd2;
  --border: #e8e4df;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --nav-height: 60px;
  --max-width: 1100px;
  --transition: 0.25s ease;
}

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

html {
  scroll-behavior: smooth;
}

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

a {
  color: var(--primary-dark);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-dark);
}

img {
  max-width: 100%;
}

/* ---------- 导航栏 ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 0 20px;
}

.navbar-inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 1px;
}

.navbar-brand:hover {
  color: var(--primary-dark);
}

.navbar-links {
  display: flex;
  gap: 6px;
  list-style: none;
}

.navbar-links a {
  display: block;
  padding: 6px 14px;
  border-radius: 20px;
  color: var(--text);
  font-size: 0.92rem;
  transition: background var(--transition), color var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 4px 8px;
}

/* ---------- 主体容器 ---------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.main-content {
  padding-top: calc(var(--nav-height) + 30px);
  padding-bottom: 60px;
  min-height: calc(100vh - 200px);
}

/* ---------- Hero 区域 ---------- */
.hero {
  text-align: center;
  padding: 60px 20px 50px;
  background: var(--bg-hero);
  border-radius: var(--radius);
  margin-bottom: 40px;
}

.hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition), transform var(--transition);
}

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

.card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
  color: var(--primary-dark);
}

.card p {
  color: var(--text-light);
  font-size: 0.95rem;
}

/* ---------- 网格布局 ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

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

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border: none;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-align: center;
  line-height: 1.5;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

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

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

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

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

.btn-accent:hover {
  background: var(--accent-dark);
  color: #fff;
}

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

.btn-danger:hover {
  background: var(--danger-dark);
  color: #fff;
}

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

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

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

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

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23777' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--primary-dark);
}

.tab-btn.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

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

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

table th {
  background: #f5f3f0;
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

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

table tr:hover td {
  background: #fdfcfa;
}

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

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.stat-card .stat-label {
  font-size: 0.88rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* ---------- Toast 提示 ---------- */
.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + 12px);
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.92rem;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 360px;
  word-break: break-word;
}

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

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

.toast.fade-out {
  animation: toastOut 0.3s ease forwards;
}

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

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

/* ---------- 模态框 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

.modal h2 {
  font-size: 1.2rem;
  margin-bottom: 20px;
  color: var(--primary-dark);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

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

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

/* ---------- 页脚 ---------- */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-light);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ---------- 空状态 ---------- */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-light);
}

.empty-state p {
  font-size: 1rem;
}

/* ---------- 标签 / Badge ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 500;
}

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

.badge-orange {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.badge-red {
  background: var(--danger-light);
  color: var(--danger-dark);
}

/* ---------- 搜索框 ---------- */
.search-box {
  position: relative;
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  font-size: 0.95rem;
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box::before {
  content: "\1F50D";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.5;
}

/* ---------- Wiki 文章详情 ---------- */
.article-detail {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 30px;
  box-shadow: var(--shadow);
}

.article-detail h2 {
  font-size: 1.4rem;
  color: var(--primary-dark);
  margin-bottom: 16px;
}

.article-detail .article-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.article-detail .article-body {
  line-height: 1.9;
  color: var(--text);
}

.article-detail .article-body p {
  margin-bottom: 12px;
}

.article-detail .article-body ul,
.article-detail .article-body ol {
  padding-left: 24px;
  margin-bottom: 12px;
}

.article-detail .article-body li {
  margin-bottom: 4px;
}

.article-detail .article-body code {
  background: #f5f3f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.article-detail .article-body pre {
  background: #2d2d2d;
  color: #f8f8f2;
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 12px;
}

.article-detail .article-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* ---------- 登录界面 ---------- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-height) - 100px);
}

.login-box {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-box h2 {
  margin-bottom: 24px;
  color: var(--primary-dark);
}

/* ---------- 公告卡片 ---------- */
.announcement-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}

.announcement-card:hover {
  box-shadow: var(--shadow-lg);
}

.announcement-card h3 {
  font-size: 1.08rem;
  color: var(--text);
  margin-bottom: 8px;
}

.announcement-card .announcement-meta {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 10px;
}

.announcement-card .announcement-content {
  color: var(--text);
  font-size: 0.93rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ---------- 功能入口卡片 ---------- */
.feature-card {
  text-align: center;
  padding: 30px 20px;
}

.feature-card .feature-icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
  .navbar-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    gap: 2px;
  }

  .navbar-links.open {
    display: flex;
  }

  .navbar-toggle {
    display: block;
  }

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

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

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

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

  .tabs {
    flex-wrap: wrap;
  }

  .tab-btn {
    padding: 8px 14px;
    font-size: 0.88rem;
  }

  .modal {
    width: 95%;
    padding: 20px;
  }

  table {
    font-size: 0.85rem;
  }

  table th,
  table td {
    padding: 8px 10px;
  }
}

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

  .stat-card {
    padding: 14px;
  }

  .stat-card .stat-number {
    font-size: 1.5rem;
  }

  .hero {
    padding: 40px 16px 36px;
  }
}
