/**
 * 现代化样式 (modern.css)
 * 卡片阴影、渐变、移动端优化
 */

/* ========== CSS 变量定义 ========== */
:root {
  --primary-color: #0096D6;
  --primary-gradient: linear-gradient(135deg, #0096D6 0%, #00b4d8 100%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

/* ========== 产品卡片现代化 ========== */
.image-box {
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border-radius: var(--border-radius);
  overflow: hidden;
  background: #fff;
}

.image-box:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.image-box img {
  transition: var(--transition);
}

.image-box:hover img {
  transform: scale(1.05);
}

.image-box .btn {
  border-radius: 0;
  transition: var(--transition-fast);
}

.image-box:hover .btn {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
}

/* ========== 服务卡片现代化 ========== */
.block-list {
  background: #fff;
  padding: 24px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary-color);
  transition: var(--transition);
  margin-bottom: 20px;
}

.block-list:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.block-list .media-heading {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 15px;
}

/* ========== 按钮现代化 ========== */
.btn-default {
  border-radius: 6px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: var(--transition);
  padding: 12px 24px;
}

.btn-default:hover {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: var(--primary-gradient);
  border: none;
  border-radius: 6px;
  font-weight: 500;
  letter-spacing: 0.5px;
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ========== 标题渐变效果 ========== */
.title {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  position: relative;
  padding-bottom: 15px;
}

.title:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

/* ========== 导航栏优化 ========== */
.navbar-nav > li > a {
  transition: var(--transition-fast);
  position: relative;
}

/* 底部下划线（仅选中状态） */
.navbar-nav > li.active > a:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 2px;
  background: var(--primary-color);
  pointer-events: none;
}

/* 选中状态：淡背景色 + 底部线条 */
.navbar-nav > li.active > a,
.navbar-nav > li.active > a:hover,
.navbar-nav > li.active > a:focus {
  background: rgba(0, 150, 214, 0.08) !important;
}

/* 确保固定头部有足够的z-index */
.header.fixed,
.navbar-fixed-top {
  z-index: 1030 !important;
}

/* Banner 从顶部开始，导航栏覆盖在上面 */
.banner {
  position: relative;
  z-index: 1;
}

/* Banner标题区域向下偏移，考虑导航栏高度 */
.banner-caption {
  top: calc(50% + 40px) !important;
}

/* Banner下面的第一个section添加顶部间距，避免被导航栏遮挡 */
.hero-caption {
  padding-top: 120px !important;
  position: relative;
  background-color: #e8f4f8;
  background-image: url('../images/bg1.jpg');
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  min-height: 400px;
}

/* Hero section 半透明遮罩，确保文字清晰可读 */
.hero-caption::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.5);
  z-index: 0;
}

/* 确保内容在遮罩之上 */
.hero-caption .container {
  position: relative;
  z-index: 1;
}

/* Hero section 文字样式优化 */
.hero-caption h2 {
  color: #333;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero-caption p {
  color: #555;
  font-size: 16px;
  line-height: 1.8;
}

/* 确保页面内容布局正确 */
body {
  position: relative;
}

/* ========== 语言切换器美化 ========== */
#lang-switcher .dropdown-toggle {
  padding: 10px 20px !important;
  border-radius: 0;
  transition: var(--transition-fast);
  font-size: 18px !important;
  font-weight: 500;
  line-height: 20px;
}

/* 桌面端匹配其他菜单项的padding */
@media (min-width: 768px) {
  #lang-switcher .dropdown-toggle {
    padding-top: 30px !important;
    padding-bottom: 30px !important;
  }
}

/* 滚动后固定状态的padding */
.fixed-header-on #lang-switcher .dropdown-toggle {
  padding-top: 20px !important;
  padding-bottom: 20px !important;
}

#lang-switcher .dropdown-toggle:hover {
  background: transparent;
}

#lang-switcher .dropdown-toggle .fa-globe {
  color: inherit;
  margin-right: 5px;
}

#lang-switcher .dropdown-toggle #current-lang {
  vertical-align: middle;
}

#lang-switcher .dropdown-toggle .caret {
  margin-left: 5px;
  vertical-align: middle;
}

#lang-switcher .dropdown-menu {
  border-radius: 0;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 0;
  min-width: 120px;
}

#lang-switcher .dropdown-menu li a {
  padding: 10px 20px;
  transition: var(--transition-fast);
  color: #333 !important;
  font-size: 16px;
}

#lang-switcher .dropdown-menu li a:hover {
  background: var(--primary-color);
  color: white !important;
}

/* ========== 导航栏背景优化 ========== */
/* 初始状态：半透明白色背景，深色文字 */
.header {
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

/* 滚动后固定状态：纯白背景 */
.fixed-header-on .header {
  background: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 导航链接颜色统一为深色 */
.navbar-default .navbar-nav > li > a {
  color: #333333 !important;
  text-shadow: none;
}

.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > .active > a {
  color: var(--primary-color) !important;
}

/* Logo 文字颜色统一为深色 */
.brand a {
  color: #333333 !important;
  text-shadow: none;
}

/* 语言切换器统一为深色 */
#lang-switcher .dropdown-toggle {
  color: #333333 !important;
  text-shadow: none;
}

/* ========== Modal 现代化 ========== */
.modal-content {
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  border: none;
}

.modal-header {
  background: var(--primary-gradient);
  color: white;
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  padding: 20px 24px;
}

.modal-header .close {
  color: white;
  opacity: 0.8;
  transition: var(--transition-fast);
}

.modal-header .close:hover {
  opacity: 1;
  transform: rotate(90deg);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 15px 24px;
  border-top: 1px solid #ecf0f1;
}

/* Modal 背景模糊 */
.modal.in {
  backdrop-filter: blur(4px);
}

.modal-backdrop.in {
  opacity: 0.6;
}

/* ========== 产品过滤器美化 ========== */
.filters .nav-pills > li > a {
  border-radius: 20px;
  padding: 8px 20px;
  margin: 0 5px;
  transition: var(--transition-fast);
  font-weight: 500;
}

.filters .nav-pills > li.active > a,
.filters .nav-pills > li > a:hover {
  background: var(--primary-gradient);
  color: white;
}

/* ========== Footer 优化 ========== */
.footer {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.subfooter {
  background: #1a252f;
}

/* ========== 移动端优化 ========== */
@media (max-width: 767px) {
  /* 移动端导航栏使用白色背景 */
  .header {
    background: rgba(255, 255, 255, 0.98) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  /* 导航菜单优化 */
  .navbar-collapse {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    margin-top: 10px;
  }

  .navbar-nav {
    margin: 10px 0;
  }

  .navbar-nav > li > a {
    padding: 12px 20px;
    border-radius: var(--border-radius);
    margin: 5px 10px;
  }

  /* 字体缩小 */
  h1 {
    font-size: 28px !important;
  }

  h2 {
    font-size: 22px !important;
  }

  h3 {
    font-size: 18px !important;
  }

  .title {
    font-size: 24px !important;
  }

  /* 产品卡片优化 - 每行2个 */
  .isotope-item {
    width: 50% !important;
    margin-bottom: 10px;
    padding: 0 5px;
  }

  .image-box {
    margin-bottom: 0;
  }

  /* 产品图片缩小 */
  .image-box img {
    width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: cover;
  }

  /* 产品标题字体缩小 */
  .image-box .btn {
    font-size: 12px;
    padding: 8px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Banner 高度调整 */
  .banner {
    min-height: 60vh;
  }

  /* 移动端 Banner 标题向下偏移更多，避免被导航栏遮挡 */
  .banner-caption {
    top: calc(50% + 100px) !important;
  }

  /* 移动端下面内容的顶部间距调整 */
  .hero-caption {
    padding-top: 100px !important;
    min-height: 300px;
    background-attachment: scroll;
  }

  /* 移动端文字样式调整 */
  .hero-caption h2 {
    font-size: 20px !important;
  }

  .hero-caption p {
    font-size: 14px !important;
  }

  .banner-caption h1 {
    font-size: 32px !important;
  }

  .banner-caption h3 {
    font-size: 16px !important;
  }

  /* 触摸目标优化 */
  .btn {
    min-height: 44px;
    padding: 12px 20px;
    font-size: 14px;
  }

  /* 间距优化 */
  .secPadding {
    padding: 40px 0 !important;
  }

  .space {
    height: 30px;
  }

  /* Modal 优化 */
  .modal-dialog {
    margin: 10px;
  }

  /* Modal图片优化 */
  #modal-product-image {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
  }

  .modal-body {
    padding: 15px;
  }

  .modal-header {
    padding: 15px;
  }

  .modal-footer {
    padding: 10px 15px;
  }

  /* 服务卡片 */
  .block-list {
    margin-bottom: 15px;
    padding: 20px;
  }

  /* 语言切换器 */
  #lang-switcher {
    margin: 10px 0;
  }

  #lang-switcher .dropdown-toggle {
    display: block;
    text-align: center;
  }
}

/* 平板设备优化 */
@media (min-width: 768px) and (max-width: 991px) {
  .isotope-item {
    width: 50%;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 26px;
  }

  .banner-caption h1 {
    font-size: 40px;
  }
}

/* ========== 动画增强 ========== */
/* 淡入动画优化 */
.fadeIn {
  animation-duration: 0.6s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* 页面加载动画 */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animated.slideInUp {
  animation-name: slideInUp;
  animation-duration: 0.6s;
}

/* Hover 发光效果 */
.image-box:hover {
  box-shadow: 0 8px 24px rgba(0, 150, 214, 0.2);
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #007ab8;
}

/* ========== 选择文本颜色 ========== */
::selection {
  background: var(--primary-color);
  color: white;
}

::-moz-selection {
  background: var(--primary-color);
  color: white;
}

/* ========== 焦点状态优化 ========== */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  outline-offset: 2px;
}

/* ========== 图片加载优化 ========== */
img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* 懒加载占位符 */
img[loading="lazy"] {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
