/* 文件路径：css/common.css */

/* ========== 1. CSS Reset / Normalize ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ========== 2. CSS Variables ========== */
:root {
  --primary: #07C160;
  --primary-dark: #06AD56;
  --secondary: #1AAD8F;
  --accent: #FF6B00;
  --text: #1A1A1A;
  --text-secondary: #666666;
  --text-light: #999999;
  --bg: #F5F7FA;
  --white: #FFFFFF;
  --border: #E8E8E8;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 8px;
  --max-width: 1200px;
  --header-height: 72px;
}

/* ========== 3. 通用布局 ========== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.section { padding: 80px 0; }
.section-title {
  text-align: center;
  margin-bottom: 48px;
}
.section-title h2 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  display: inline-block;
  position: relative;
}
.section-title h2::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  background: var(--primary);
  margin: 12px auto 0;
  border-radius: 2px;
}
.section-title p {
  color: var(--text-secondary);
  margin-top: 12px;
  font-size: 16px;
}

/* ========== 4. 按钮系统 ========== */
.btn-primary {
  display: inline-block;
  padding: 12px 32px;
  background: var(--primary);
  color: var(--white);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s;
  border: none;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(7,193,96,0.3); }
.btn-accent {
  display: inline-block;
  padding: 12px 32px;
  background: var(--accent);
  color: var(--white);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s;
  border: none;
}
.btn-accent:hover { background: #E66000; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(255,107,0,0.3); }
.btn-outline {
  display: inline-block;
  padding: 12px 32px;
  background: transparent;
  color: var(--white);
  border: 2px solid var(--white);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s;
}
.btn-outline:hover { background: var(--white); color: var(--primary); }
.btn-lg { padding: 16px 48px; font-size: 18px; }
.btn-sm { padding: 8px 20px; font-size: 14px; }

/* ========== 5. 卡片 ========== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.3s;
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* ========== 6. 表单 ========== */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  transition: border-color 0.3s;
  outline: none;
  background: var(--white);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(7,193,96,0.1);
}
.form-group textarea { min-height: 120px; resize: vertical; }
.form-error { color: #E74C3C; font-size: 13px; margin-top: 4px; display: none; }
.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select { border-color: #E74C3C; }
.form-group.has-error .form-error { display: block; }

/* ========== 7. 栅格 ========== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ========== 8. 文字工具类 ========== */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-primary   { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-light     { color: var(--text-light); }

/* ========== 9. 全局导航栏 ========== */
#global-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--white);
  height: var(--header-height);
  display: flex;
  align-items: center;
  transition: box-shadow 0.3s;
}
#global-header.scrolled { box-shadow: 0 2px 16px rgba(0,0,0,0.08); }
.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo span { color: var(--text); font-size: 14px; font-weight: 400; opacity: 0.6; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a {
  padding: 8px 16px;
  font-size: 15px;
  color: var(--text-secondary);
  border-radius: 6px;
  transition: all 0.3s;
  position: relative;
}
.nav-links a:hover { color: var(--primary); background: rgba(7,193,96,0.05); }
.nav-links a.active { color: var(--primary); font-weight: 600; }
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}
.nav-cta {
  margin-left: 16px;
  padding: 8px 20px;
  background: var(--accent);
  color: var(--white) !important;
  border-radius: 6px;
  font-weight: 500;
}
.nav-cta:hover { background: #E66000 !important; }

/* 汉堡按钮 */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s;
}
.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* 移动端导航面板 */
.nav-mobile {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--white);
  padding: 24px 20px;
  overflow-y: auto;
  flex-direction: column;
  gap: 4px;
  z-index: 999;
}
.nav-mobile.open { display: flex; }
.nav-mobile a {
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text-secondary);
  border-radius: 8px;
  transition: all 0.3s;
}
.nav-mobile a:hover { background: rgba(7,193,96,0.05); color: var(--primary); }
.nav-mobile a.active { color: var(--primary); font-weight: 600; background: rgba(7,193,96,0.08); }
.nav-mobile .nav-cta { margin-top: 12px; text-align: center; }

/* ========== 10. 全局页脚 ========== */
.global-footer {
  background: #1A1A1A;
  color: rgba(255,255,255,0.7);
  padding: 60px 0 0;
}
.footer-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 40px;
}
.footer-col h4 {
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  position: relative;
  padding-bottom: 12px;
}
.footer-col h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 32px;
  height: 2px;
  background: var(--primary);
}
.footer-col p { font-size: 14px; line-height: 1.8; margin-bottom: 12px; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  transition: color 0.3s;
}
.footer-col ul li a:hover { color: var(--primary); }
.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 14px;
}
.footer-contact-item .icon { color: var(--primary); flex-shrink: 0; margin-top: 2px; }
.footer-bottom {
  margin-top: 48px;
  padding: 20px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

/* ========== 11. 面包屑 ========== */
.breadcrumb {
  padding: 16px 0;
  font-size: 14px;
  color: var(--text-light);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 8px; }

/* ========== 12. 页面 Banner ========== */
.page-banner {
  background: linear-gradient(135deg, #0A2540 0%, #07C160 100%);
  padding: 80px 0 60px;
  color: var(--white);
  text-align: center;
}
.page-banner h1 { font-size: 40px; font-weight: 700; margin-bottom: 12px; }
.page-banner p  { font-size: 18px; opacity: 0.85; }

/* ========== 13. 回到顶部按钮 ========== */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 80px;
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(7,193,96,0.35);
}
.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(0) scale(1.08);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ========== 14. 懒加载图片 ========== */
.lazy-image,
img[data-src] {
  background: #e8e8e8;
  min-height: 80px;
  transition: opacity 0.5s ease;
  opacity: 0.6;
}
.lazy-image.loaded,
img[data-src].loaded {
  background: transparent;
  opacity: 1;
}

/* ========== 15. 移动端修复 ========== */
@media (max-width: 768px) {
  body {
    overflow-x: hidden;
  }
  img {
    max-width: 100%;
    height: auto;
  }
}

/* ========== 16. 表单错误样式 ========== */
input.error,
textarea.error,
select.error {
  border-color: #E74C3C !important;
  box-shadow: 0 0 0 3px rgba(231,76,60,0.1) !important;
}
.form-error {
  color: #E74C3C;
  font-size: 13px;
  margin-top: 4px;
  display: none;
}
.form-group.has-error .form-error {
  display: block;
}

/* ========== 17. Toast 弹窗提示 ========== */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-120px);
  padding: 14px 28px;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  z-index: 10001;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}
.toast-success {
  background: linear-gradient(135deg, #07C160, #06AD56);
}
.toast-error {
  background: linear-gradient(135deg, #E74C3C, #C0392B);
}

/* ========== 18. 响应式 ========== */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 32px; }
}
@media (max-width: 768px) {
  :root { --header-height: 60px; }
  .section { padding: 48px 0; }
  .section-title h2 { font-size: 24px; }
  .section-title { margin-bottom: 32px; }
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .page-banner { padding: 60px 0 40px; }
  .page-banner h1 { font-size: 28px; }
  .page-banner p  { font-size: 15px; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .btn-lg { padding: 14px 36px; font-size: 16px; }
}
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .section { padding: 36px 0; }
  .nav-logo { font-size: 18px; }
  .nav-logo span { display: none; }
}
