/* ========================================
   汇创英领科技官网 - 自定义样式
   ======================================== */

/* === 1. 全局变量 === */
:root {
  --brand-primary: #667eea;
  --brand-secondary: #764ba2;
  --brand-accent: #06b6d4;
  --brand-orange: #f97316;
  --brand-red: #ef4444;
  --text-dark: #1f2937;
  --text-light: #6b7280;
  --bg-light: #f9fafb;
}

/* === 2. 基础样式 === */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: 80px; /* 为固定导航栏留出空间 */
}

/* 确保Font Awesome图标正确显示 */
.fas, .far, .fab, .fa {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === 3. Header 样式 === */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000; /* 提高 z-index 确保在内容之上 */
  transition: all 0.3s ease;
  background: white;
  width: 100%;
}

header.scrolled {
  background: rgba(255, 255, 255, 0.95); /* 半透明背景 */
  backdrop-filter: blur(10px); /* 毛玻璃效果 */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* 更柔和的阴影 */
  border-bottom: 1px solid rgba(99, 102, 241, 0.1); /* 添加品牌色边框 */
}

header.scrolled .logo {
  transform: scale(0.9);
}

.logo {
  transition: transform 0.3s ease;
}

/* === 4. Mega Menu 样式 === */
.mega-menu-wrapper {
  position: relative;
}

.mega-menu-trigger {
  position: relative;
  cursor: pointer;
}

.mega-menu-trigger > a {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.2s ease;
}

.mega-menu-trigger:hover > a {
  color: var(--brand-primary);
}

.mega-menu-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  /* 移除 margin-top 和 translateY，消除悬停间隙 */
  padding-top: 0.5rem; /* 添加内边距以保持视觉间距，但不影响悬停区域 */
  background: transparent; /* 顶部透明区域用于悬停 */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 100;
  min-width: 600px;
}

/* 实际的下拉内容容器 */
.mega-menu-dropdown::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.5rem; /* 悬停容忍区域 */
  background: transparent;
}

/* 关键修复：当 hover trigger 或 dropdown 本身时都显示 */
.mega-menu-trigger:hover .mega-menu-dropdown,
.mega-menu-dropdown:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mega-menu-content {
  padding: 2rem;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.mega-menu-section {
  margin-bottom: 1.5rem;
}

.mega-menu-section:last-child {
  margin-bottom: 0;
}

.mega-menu-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.mega-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  color: var(--text-dark);
  text-decoration: none;
}

.mega-menu-item:hover {
  background: var(--bg-light);
  transform: translateX(4px);
}

.mega-menu-item i {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
  font-size: 1.25rem;
  color: var(--brand-primary);
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-align: center;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.mega-menu-item-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.mega-menu-item-content p {
  font-size: 0.8rem;
  color: var(--text-light);
}

.mega-menu-footer {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
  margin-top: 1rem;
}

.mega-menu-footer a {
  color: var(--brand-primary);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: gap 0.2s ease;
}

.mega-menu-footer a:hover {
  gap: 0.75rem;
}

/* === 5. 移动端菜单 === */
#mobileMenu {
  position: fixed;
  top: 0;
  right: 0;
  width: 80%;
  max-width: 320px;
  height: 100vh;
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 1001;
  overflow-y: auto;
}

#mobileMenu.active {
  transform: translateX(0);
}

.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.mobile-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-item {
  border-bottom: 1px solid #e5e7eb;
}

.mobile-menu-item > a {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--text-dark);
  font-weight: 500;
  transition: background 0.2s ease;
}

.mobile-menu-item > a:hover {
  background: var(--bg-light);
}

.mobile-submenu {
  background: var(--bg-light);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0;
}

.mobile-submenu.active {
  max-height: 1000px; /* 增加高度以容纳更多子菜单项 */
  padding: 0.5rem 0;
}

.mobile-submenu a {
  display: block;
  padding: 0.75rem 1.5rem 0.75rem 3rem;
  color: var(--text-light);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.mobile-submenu a:hover {
  color: var(--brand-primary);
  background: rgba(99, 102, 241, 0.05);
}

/* 移动端二级菜单图标样式 */
.mobile-submenu i {
  font-size: 0.875rem;
}

/* 移动端子菜单分组标题 */
.mobile-submenu .text-xs {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* 移动端菜单切换按钮的箭头动画 */
.mobile-menu-toggle i {
  transition: transform 0.3s ease;
}

.mobile-menu-toggle.active i {
  transform: rotate(180deg);
}

/* 确保移动端菜单在固定导航栏之上 */
@media (max-width: 1024px) {
  #mobileMenu {
    z-index: 1001 !important;
  }
  
  .mobile-overlay {
    z-index: 1000 !important;
  }
}

/* === 6. 浮动咨询按钮 === */
.floating-cta {
  position: fixed !important; /* 使用 !important 防止被覆盖 */
  bottom: 2rem;
  right: 2rem;
  z-index: 9999 !important; /* 大幅提高 z-index，确保在所有元素之上 */
  animation: float 3s ease-in-out infinite;
  pointer-events: auto; /* 确保可点击 */
  overflow: visible; /* 防止被裁剪 */
  display: block !important; /* 确保显示 */
}

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

.floating-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-red));
  color: white;
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
  font-weight: 600;
  transition: all 0.3s ease;
  text-decoration: none;
  white-space: nowrap; /* 防止文字换行 */
  min-width: fit-content; /* 确保按钮宽度适应内容 */
}

.floating-cta a:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 40px rgba(239, 68, 68, 0.4);
}

.floating-cta i {
  font-size: 1.125rem; /* 确保图标大小合适 */
}

/* === 7. Hero 轮播样式 === */
.hero-bg {
  background-image: url('../images/slider-bg-1-1.png');
}

.grad-overlay {
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.88) 0%, rgba(118, 75, 162, 0.85) 100%);
  height: 100%;
  display: flex;
  align-items: center;
}

.swiper-slide {
  background-size: cover;
  background-position: center;
}

.hero-slide {
  min-height: 520px;
}

@media (min-width: 768px) {
  .hero-slide {
    min-height: 720px;
  }
}

.swiper-container-main,
.swiper-wrapper {
  min-height: 520px;
  height: 100vh;
  max-height: 900px;
}

@media (min-width: 768px) {
  .swiper-container-main,
  .swiper-wrapper {
    min-height: 720px;
  }
}

.hero-content {
  padding: 3rem 0;
}

.hero-content h1,
.hero-content h2 {
  line-height: 1.05;
}

.hero-content h1 {
  font-size: 2.25rem;
}

@media (min-width: 768px) {
  .hero-content h1 {
    font-size: 3.5rem;
  }
}

.hero-content p {
  color: rgba(235, 245, 255, 0.95);
}

/* === 8. 按钮样式 === */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-block;
  text-decoration: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: white;
  color: var(--brand-primary);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  border: 2px solid white;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-block;
  text-decoration: none;
}

.btn-secondary:hover {
  background: transparent;
  color: white;
}

/* === 9. 卡片样式 === */
.card {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 6px 18px rgba(20, 20, 40, 0.06);
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(20, 20, 40, 0.12);
}

/* === 10. 响应式调整 === */
@media (max-width: 640px) {
  .hero-content {
    padding: 2rem 0;
  }

  .hero-content h1 {
    font-size: 1.75rem;
  }

  .floating-cta {
    bottom: 1.5rem !important; /* 提高位置，避免被底部导航栏遮挡 */
    right: 1rem !important;
    /* 确保按钮在移动端完全可见 */
    max-width: calc(100vw - 2rem);
    position: fixed !important; /* 强制固定定位 */
    display: block !important; /* 强制显示 */
    z-index: 9999 !important; /* 确保在最上层 */
  }

  .floating-cta a {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4); /* 增强阴影，提高可见度 */
    display: flex !important; /* 确保 flex 布局 */
  }

  .floating-cta i {
    font-size: 1rem;
  }

  .floating-cta span {
    display: inline !important; /* 确保文字显示 */
  }

  .mega-menu-dropdown {
    min-width: 100%;
    left: 0;
    transform: translateX(0);
  }
}

/* 超小屏幕优化（iPhone SE等） */
@media (max-width: 375px) {
  .floating-cta {
    bottom: 1rem !important;
    right: 0.75rem !important;
    max-width: calc(100vw - 1.5rem); /* 更严格的宽度限制 */
  }

  .floating-cta a {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    gap: 0.375rem;
  }

  .floating-cta i {
    font-size: 0.9rem;
  }

  .floating-cta span {
    display: inline !important; /* 确保文字显示 */
  }
}

/* === 11. Filter Buttons === */
.filter-btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  background: white;
  color: #6b7280;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  border-color: #4f46e5;
  color: #4f46e5;
  background: #eef2ff;
}

.filter-btn.active {
  border-color: #4f46e5;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

/* Testimonial Swiper Customization */
.testimonial-swiper {
  position: relative;
  padding: 0 60px; /* 为左右箭头留出空间 */
}

.testimonial-swiper .swiper-button-prev,
.testimonial-swiper .swiper-button-next {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.testimonial-swiper .swiper-button-prev:hover,
.testimonial-swiper .swiper-button-next:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

.testimonial-swiper .swiper-button-prev:after,
.testimonial-swiper .swiper-button-next:after {
  font-size: 18px;
  font-weight: bold;
  color: #4f46e5;
}

.testimonial-swiper .swiper-button-prev:hover:after,
.testimonial-swiper .swiper-button-next:hover:after {
  color: white;
}

.testimonial-swiper .swiper-button-prev {
  left: 0;
}

.testimonial-swiper .swiper-button-next {
  right: 0;
}

.testimonial-swiper .swiper-pagination {
  position: relative;
  bottom: auto;
  margin-top: 2rem;
}

.testimonial-swiper .swiper-pagination-bullet {
  width: 12px;
  height: 12px;
  background: #d1d5db;
  opacity: 1;
  transition: all 0.3s ease;
}

.testimonial-swiper .swiper-pagination-bullet-active {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  width: 32px;
  border-radius: 6px;
}

@media (max-width: 768px) {
  .testimonial-swiper {
    padding: 0 50px;
  }

  .testimonial-swiper .swiper-button-prev,
  .testimonial-swiper .swiper-button-next {
    width: 36px;
    height: 36px;
  }

  .testimonial-swiper .swiper-button-prev:after,
  .testimonial-swiper .swiper-button-next:after {
    font-size: 14px;
  }
}
