/* ========================================
   动物百科网站 - 全局样式系统
   自然清新风格 · 浅绿+浅蓝主色调
   ======================================== */

/* ===== CSS 变量 ===== */
:root {
  /* 主色调 - 自然绿 */
  --green-50: #f0f9f4;
  --green-100: #dcf0e3;
  --green-200: #bbe1c9;
  --green-300: #8ccba6;
  --green-400: #5aaf82;
  --green-500: #389e6b;
  --green-600: #2a7d56;
  --green-700: #226345;

  /* 辅助色 - 清新蓝 */
  --blue-50: #eef6fd;
  --blue-100: #d6ebfa;
  --blue-200: #aed4f4;
  --blue-300: #7bb8ec;
  --blue-400: #4a9be0;
  --blue-500: #2a80c9;
  --blue-600: #1e659f;

  /* 中性色 */
  --bg: #ffffff;
  --bg-soft: #f5f9f8;
  --bg-card: #ffffff;
  --text: #1a2e2a;
  --text-secondary: #5a6b66;
  --text-muted: #8a9b96;
  --border: #e0ebe7;
  --border-hover: #c5d8cf;

  /* 保护等级标签色 */
  --tag-critical: #e53935;   /* 极危 - 红色 */
  --tag-endangered: #fb8c00; /* 濒危 - 橙色 */
  --tag-vulnerable: #fdd835; /* 易危 - 黄色 */
  --tag-safe: #43a047;       /* 无危 - 绿色 */
  --tag-special: #1e88e5;    /* 特有物种 - 蓝色 */

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 28px rgba(0,0,0,0.12);

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* 布局 */
  --max-width: 1280px;
  --header-height: 68px;
}

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

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

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

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  transition: all 0.2s;
}

input, select {
  font-family: inherit;
  font-size: inherit;
}

/* ===== 通用容器 ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== 顶部导航栏 ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--green-600);
}

.nav-logo .logo-icon {
  font-size: 1.6rem;
  line-height: 1;
}

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

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  padding: 6px 0;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--green-600);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: var(--green-500);
  border-radius: 2px;
}

.nav-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-soft);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 8px 16px;
  width: 240px;
  transition: border-color 0.2s;
}

.nav-search-box:focus-within {
  border-color: var(--green-400);
  background: #fff;
}

.nav-search-box input {
  border: none;
  background: none;
  outline: none;
  flex: 1;
  font-size: 0.88rem;
  color: var(--text);
}

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

.nav-toggle {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

/* ===== 页面通用标题 ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .accent-bar {
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--green-400), var(--blue-400));
  border-radius: 3px;
}

.section-link {
  font-size: 0.9rem;
  color: var(--green-600);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.section-link:hover {
  gap: 8px;
}

/* ===== 标签系统 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.tag-critical { background: #fde8e8; color: var(--tag-critical); }
.tag-endangered { background: #fff0e0; color: var(--tag-endangered); }
.tag-vulnerable { background: #fff9db; color: #b8860b; }
.tag-safe { background: #e6f6ec; color: var(--tag-safe); }
.tag-special { background: #e3f0fd; color: var(--tag-special); }
.tag-neutral { background: var(--bg-soft); color: var(--text-secondary); }
.tag-purple { background: #f0e8fd; color: #7b1fa2; }

/* 保护等级色块 */
.protection-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.protection-1 { background: #fde8e8; color: var(--tag-critical); border: 1px solid #f5b5b5; }
.protection-2 { background: #fff0e0; color: var(--tag-endangered); border: 1px solid #f5cfa0; }
.protection-3 { background: #e6f6ec; color: var(--tag-safe); border: 1px solid #a5d8b2; }
.protection-none { background: var(--bg-soft); color: var(--text-muted); border: 1px solid var(--border); }

/* IUCN 等级 */
.iucn-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.iucn-CR { background: #d32f2f; color: #fff; }
.iucn-EN { background: #f57c00; color: #fff; }
.iucn-VU { background: #fbc02d; color: #3e2723; }
.iucn-NT { background: #fff3cd; color: #856404; }
.iucn-LC { background: #4caf50; color: #fff; }

/* ===== 卡片通用 hover ===== */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--green-500), var(--green-400));
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(56, 158, 107, 0.35);
}

.btn-outline {
  background: #fff;
  color: var(--green-600);
  border: 1.5px solid var(--green-300);
}

.btn-outline:hover {
  background: var(--green-50);
  border-color: var(--green-400);
}

/* ===== 动物图片占位（渐变+emoji） ===== */
.animal-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  position: relative;
  overflow: hidden;
}

.animal-img::before {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
}

.animal-img .emoji {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15));
  transition: transform 0.4s ease;
}

/* 多种渐变背景 */
.grad-1 { background: linear-gradient(135deg, #a8e6cf, #88d8a8); }
.grad-2 { background: linear-gradient(135deg, #b5e8f5, #8ecae6); }
.grad-3 { background: linear-gradient(135deg, #ffd9a8, #ffb787); }
.grad-4 { background: linear-gradient(135deg, #c8e6c9, #a5d6a7); }
.grad-5 { background: linear-gradient(135deg, #d4c5f9, #b39ddb); }
.grad-6 { background: linear-gradient(135deg, #ffe0b2, #ffcc80); }
.grad-7 { background: linear-gradient(135deg, #b2dfdb, #80cbc4); }
.grad-8 { background: linear-gradient(135deg, #f8bbd0, #f48fb1); }
.grad-9 { background: linear-gradient(135deg, #c5e1a5, #aed581); }
.grad-10 { background: linear-gradient(135deg, #90caf9, #64b5f6); }
.grad-11 { background: linear-gradient(135deg, #fff9c4, #fff176); }
.grad-12 { background: linear-gradient(135deg, #d7ccc8, #bcaaa4); }

/* ===== Footer ===== */
.footer {
  background: var(--text);
  color: #b0c4be;
  padding: 48px 0 24px;
  margin-top: 80px;
}

.footer .container {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-desc {
  font-size: 0.88rem;
  line-height: 1.7;
  color: #8a9b96;
}

.footer h4 {
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  font-size: 0.88rem;
  color: #8a9b96;
}

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

.footer-bottom {
  grid-column: 1 / -1;
  border-top: 1px solid #2a3e3a;
  padding-top: 20px;
  margin-top: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: #6a7b76;
}

/* ===== 页面通用间距 ===== */
.page-content {
  padding: 40px 0;
}

.page-banner {
  background: linear-gradient(135deg, var(--green-50), var(--blue-50));
  padding: 48px 0;
  text-align: center;
}

.page-banner h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.page-banner p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ===== 面包屑 ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.breadcrumb a:hover {
  color: var(--green-600);
}

.breadcrumb .sep {
  color: var(--border-hover);
}

/* ===== 滚动条美化 ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-soft);
}

::-webkit-scrollbar-thumb {
  background: var(--green-200);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--green-400);
}

/* ===== 选中文字 ===== */
::selection {
  background: var(--green-100);
  color: var(--green-700);
}

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

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

.fade-in-up {
  animation: fadeInUp 0.5s ease both;
}

.fade-in {
  animation: fadeIn 0.4s ease both;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .footer .container {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand-section {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: #fff;
    padding: 20px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }

  .nav-links.show {
    display: flex;
  }

  .nav-search-box {
    display: none;
  }

  .nav-toggle {
    display: block;
  }

  .container {
    padding: 0 16px;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .footer .container {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .page-banner h1 {
    font-size: 1.6rem;
  }
}
