﻿/* ========== 1. 变量定义（必须放在最前面！） ========== */
:root {
  --primary-color: #1a73e8;
  --secondary-color: #f0f7ff;
  --accent-color: #0d47a1;
  --text-dark: #2d3436;
  --text-light: #6c757d;
  --border-radius: 12px;
}

/* ========== 2. 导航栏样式 ========== */

/* 第一行标语栏 */
.bg-light {
  font-size: 0.875rem;
}

/* 第二行导航栏整体 */
.navbar {
  padding: 0.75rem 0;
}

/* 顶部导航链接通用样式（仅一级） */
.navbar-nav > .nav-item > .nav-link {
  position: relative;
  transition: color 0.3s ease;
  padding: 0.5rem 1rem !important;
  color: var(--text-dark) !important;
}

/* 一级导航悬停变色 */
.navbar-nav > .nav-item > .nav-link:hover {
  color: var(--primary-color) !important;
}

/* ✅ 使用 ::before 实现下划线动画，避免与 ::after 冲突 */
.navbar-nav > .nav-item > .nav-link::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width 0.3s ease;
  z-index: 1;
}

.navbar-nav > .nav-item > .nav-link:hover::before {
  width: 100%;
}

/* ========== ✅ 恢复并确保下拉箭头 ▼ 正常显示 ========== */
.navbar-nav .dropdown-toggle::after {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.255em;
  vertical-align: 0.255em;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-bottom: 0;
  border-left: 0.3em solid transparent;
  transition: transform 0.2s ease-in-out;
  z-index: 2;
}

/* 点击时箭头旋转 */
.navbar-nav .dropdown-toggle:active::after,
.navbar-nav .dropdown-toggle.show::after {
  transform: rotate(180deg);
}

/* ========== 确保子菜单项干净整洁，无任何伪元素 ========== */
.dropdown-item::before,
.dropdown-item::after {
  display: none !important;
}

.dropdown-item {
  color: var(--text-dark);
  padding: 0.5rem 1rem;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: #f8f9fa;
  color: var(--primary-color);
}

/* ========== 移动端下拉菜单样式优化 ========== */
@media (max-width: 991.98px) {
  .navbar-collapse {
    margin-top: 0.5rem;
    border-top: 1px solid #eee;
    padding-top: 0.5rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .dropdown-menu {
    margin: 0;
    border-radius: 0.25rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
    padding-left: 1rem;
  }

  .dropdown-item {
    padding: 0.5rem 1rem;
  }
}

/* ========== 3. 其他组件样式 ========== */

/* 轮播图区域 */
.hero-slider {
  position: relative;
  margin-bottom: 2rem;
}

.hero-slider .carousel-item img {
  height: 60vh;
  object-fit: cover;
}

.slider-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
}

.slider-progress .progress-bar {
  background: white;
  transition: width 0.3s ease;
}

/* 欢迎标题 */
.welcome-section {
  background: linear-gradient(135deg, var(--primary-color) 0%, #0d47a1 100%);
  padding: 4rem 0;
}

/* 业务项目卡片 */
.business-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.business-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.business-card img {
  height: 200px;
  object-fit: cover;
}

/* 关于翔宇图片 */
.about-section .img-fluid {
  height: 400px;
  object-fit: cover;
  border-radius: var(--border-radius);
}

/* 新闻资讯卡片 */
.news-card {
  transition: all 0.3s ease;
  border: none;
  border-radius: var(--border-radius);
}

.news-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.news-card .card-title {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.news-card .text-muted.small {
  color: var(--text-light);
  font-size: 0.875rem;
}

/* ========== ✅ 修复：保留选项卡立体感 + 增强下划线动画 ========== */

/* 恢复默认选项卡的“按钮”立体感 */
.nav-tabs {
  border-bottom: 3px solid #dee2e6; /* 默认边框 */
  margin-bottom: 1.5rem;
}

/* 恢复 nav-link 的默认按钮样式 */
.nav-tabs .nav-link {
  margin-bottom: -3px;
  border: 1px solid transparent;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  color: var(--text-dark);
  background-color: #f8f9fa;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* 悬停时：背景变亮 + 加下划线动画 */
.nav-tabs .nav-link:hover:not(.active) {
  background-color: white;
  color: var(--primary-color);
  border-color: #dee2e6;
}

/* ✅ 在按钮内部添加蓝色下划线动画（不破坏立体感） */
.nav-tabs .nav-link:hover:not(.active)::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary-color);
  transition: opacity 0.3s ease;
  opacity: 0;
}

.nav-tabs .nav-link:hover:not(.active)::before {
  opacity: 1;
}

/* 活跃项：保持 Bootstrap 默认激活样式 */
.nav-tabs .nav-link.active {
  background-color: white;
  color: var(--primary-color);
  border-color: #dee2e6 #dee2e6 white;
  font-weight: 500;
  border-bottom-color: white !important; /* 确保在顶部 */
}

/* 可选：活跃项也加一点光效 */
.nav-tabs .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background: var(--primary-color);
  border-radius: 1.5px;
}

/* 移动端适配 */
@media (max-width: 767.98px) {
  .hero-slider .carousel-item img {
    height: 40vh;
  }

  .about-section .img-fluid {
    height: 250px;
    margin-bottom: 1.5rem;
  }

  .nav-tabs {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 0.5rem;
  }

  .nav-tabs .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
  }
}