/* LOGO 样式 */
.logo {
  height: 40px;
  width: auto;
}

/* 导航栏 默认白色背景，滚动时变蓝色 */
.navbar-custom {
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.navbar-custom.scrolled {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  padding: 10px 0;
}

.navbar-brand {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--primary-color) !important;
  transition: color 0.3s ease;
}

.navbar-custom.scrolled .navbar-brand {
  color: white !important;
}

/* 导航链接样式，添加当前页面下划线效果 */
.navbar-nav .nav-link {
  color: var(--text-dark) !important;
  font-weight: 500;
  padding: 8px 16px !important;
  transition: all 0.3s ease;
  position: relative;
}

.navbar-nav .nav-link.active {
  color: var(--primary-color) !important;
}

.navbar-nav .nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  width: 100%;
  height: 3px;
  background: var(--primary-color);
  border-radius: 0;
}

.navbar-nav .nav-link.hover-active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  width: 100%;
  height: 3px;
  background: var(--primary-color);
  border-radius: 0;
}

.navbar-custom.scrolled .navbar-nav .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-custom.scrolled .navbar-nav .nav-link.active {
  color: white !important;
}

.navbar-custom.scrolled .navbar-nav .nav-link.active::after {
  background: white;
}

.navbar-custom.scrolled .navbar-nav .nav-link.hover-active::after {
  background: white;
}

.navbar-nav .nav-link:hover {
  color: var(--primary-color) !important;
  background: rgba(30, 64, 175, 0.1);
  border-radius: 5px;
}

.navbar-custom.scrolled .navbar-nav .nav-link:hover {
  color: white !important;
  background: rgba(255, 255, 255, 0.1);
}

/* 移动端导航样式 */
.navbar-toggler {
  border: 1px solid var(--primary-color);
  padding: 4px 8px;
  background: transparent;
}

.navbar-custom.scrolled .navbar-toggler {
  border-color: white;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2830, 64, 175, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='m4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-custom.scrolled .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='m4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* 修改子菜单为自适应宽度，添加右侧图片区域 */
.mega-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
  border-top: 3px solid var(--primary-color);
}

.dropdown-hover:hover .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-menu .container {
  padding: 30px 15px;
  max-width: 1200px;
}

.mega-menu .row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -15px;
}

.mega-menu .col-md-3 {
  flex: 0 0 25%;
  max-width: 25%;
  padding: 0 15px;
  margin-bottom: 20px;
}

.mega-menu .col-md-6 {
  flex: 0 0 50%;
  max-width: 50%;
  padding: 0 15px;
}

.mega-menu h6 {
  color: var(--primary-color);
  font-weight: bold;
  margin-bottom: 15px;
  font-size: 1rem;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 5px;
}

.mega-menu a {
  display: block;
  color: var(--text-dark);
  text-decoration: none;
  padding: 5px 0;
  transition: all 0.3s ease;
}

.mega-menu a:hover {
  color: var(--primary-color);
  text-decoration: none;
  padding-left: 10px;
}

.mega-menu img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
}

/* 移动端子菜单样式简化 */
@media (max-width: 991px) {
  .mega-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    background: rgba(248, 250, 252, 0.95);
    display: none;
    border-top: 1px solid #e2e8f0;
    margin-top: 5px;
  }

  .mega-menu.show {
    display: block;
    max-height: 300px;
    overflow-y: auto;
  }

  .mega-menu .col-md-3,
  .mega-menu .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .mega-menu .container {
    padding: 15px;
  }

  /* 移动端子菜单三角图标 */
  .mobile-dropdown-toggle::after {
    content: "▼";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    font-size: 10px;
    color: var(--primary-color);
  }

  .mobile-dropdown-toggle.active::after {
    content: "▲";
    transform: translateY(-50%);
  }

  .navbar-custom.scrolled .mobile-dropdown-toggle::after {
    color: white;
  }

  /* 修改移动端当前栏目样式，使用背景色而不是通栏下划线 */
  .navbar-nav .nav-link.active {
    background: var(--primary-color);
    color: white !important;
    border-radius: 5px;
    margin: 2px 5px;
    padding: 8px 15px !important;
  }

  .navbar-nav .nav-link.active::after {
    display: none;
  }

  .navbar-custom.scrolled .navbar-nav .nav-link.active {
    background: white;
    color: var(--primary-color) !important;
  }
}

/* 桌面端下划线样式正确 */
@media (min-width: 992px) {
  .navbar-nav .nav-link.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    /* left: 50%; */
    /* transform: translateX(-50%); */
    /* width: calc(100% - 32px); */
    height: 3px;
    background: var(--primary-color);
    border-radius: 0;
  }

  .navbar-nav .nav-link.hover-active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    /* left: 50%; */
    /* transform: translateX(-50%); */
    /* width: calc(100% - 32px); */
    height: 3px;
    background: var(--primary-color);
    border-radius: 0;
  }
}
