/* ========================================
   common.css - 全局公共样式
   电将军智慧能源 3.0 版
   ======================================== */

/* 图片加载过渡效果 - 恢复原有样式 */
img[data-i18n-src],
.hero-slide-bg .hero-img-desktop,
.hero-slide-bg .hero-img-mobile,
.zones-bg-item img,
.zones-bg-item video,
.zones-bg-card img {
  /* 保留原有transition，实现平滑过渡 */
}


/* ---------- CSS变量 ---------- */
:root {
  --primary: #7eb63b;
  --primary-dark: #6a9a32;
  --primary-light: #9ed45c;
  --secondary: #00C853;
  --secondary-dark: #009624;
  --accent: #FF6D00;
  --accent-light: #FF9E40;
  --bg-light: #F8F9FA;
  --bg-white: #FFFFFF;
  --bg-dark: #0A1628;
  --bg-dark-2: #121E33;
  --text-primary: #1A1A2E;
  --text-secondary: #4A5568;
  --text-light: #718096;
  --text-white: #FFFFFF;
  --border-color: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 50px rgba(0,0,0,0.15);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 30px;
  --transition: all 0.3s ease;
  --transition-slow: all 0.5s ease;
  --font-cn: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  --font-en: 'Inter', 'Roboto', sans-serif;
  --container-width: 98vw;
  --header-height: 80px;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  touch-action: manipulation;
}

html {
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  width: 0;
}

html::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}

/* 自定义滚动条 - 不占用布局空间 */
.custom-scrollbar {
  position: fixed;
  top: 0;
  right: 0;
  width: 8px;
  height: 100vh;
  z-index: 99999;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.custom-scrollbar.visible {
  opacity: 1;
  pointer-events: auto;
}

.custom-scrollbar-track {
  width: 100%;
  height: 100%;
  background: transparent;
}

.custom-scrollbar-thumb {
  position: absolute;
  top: 0;
  right: 2px;
  width: 6px;
  min-height: 30px;
  background: var(--primary);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.custom-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

body {
  font-family: var(--font-cn);
  color: var(--text-primary);
  background-color: var(--bg-white);
  line-height: 1.7;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
}

/* ---------- 通用容器 ---------- */
.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 1%;
  box-sizing: border-box;
}

.section {
  padding: 100px 0;
}

.section-dark {
  background-color: var(--bg-dark);
  color: var(--text-white);
}

.section-gray {
  background-color: var(--bg-light);
}

/* ---------- 标题组件 ---------- */
.section-header {
  text-align: center;
  margin-bottom: 26px;
  margin-top: 26px;
}

.section-tag {
  display: none;
}

.section-title {
  font-size: 25px;
  color: #3a4a5c;
  margin-bottom: 16px;
  font-weight: 560;
}

.section-dark .section-title {
  color: var(--text-white);
}

.section-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.8;
}

.section-dark .section-subtitle {
  color: rgba(255,255,255,0.7);
}

/* ---------- 按钮组件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(126,182,59,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(126,182,59,0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(0,200,83,0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,200,83,0.4);
}

.btn-accent {
  border: 2px solid var(--accent);
  /* background: linear-gradient(135deg, var(--accent), #E65100); */
  color: var(--primary);
  box-shadow: 0 4px 15px rgba(255,109,0,0.3);
}

.btn-accent:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,109,0,0.4);
}

.btn-outline {
  border: 2px solid var(--primary);
  color: var(--primary);
  background: transparent;
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-outline-white {
  border: 2px solid rgba(255,255,255,0.6);
  color: white;
  background: transparent;
}

.btn-outline-white:hover {
  background: white;
  color: var(--primary);
}

.btn-lg {
  padding: 16px 40px;
  font-size: 16px;
}

.btn-sm {
  padding: 10px 24px;
  font-size: 14px;
}

.btn-icon {
  font-size: 18px;
}

/* ---------- 卡片组件 ---------- */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-5px);
}

/* ---------- 网格布局 ---------- */
.grid {
  display: grid;
  gap: 30px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- 动画 ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.fade-in-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.scale-in {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-in.visible {
  opacity: 1;
  transform: scale(1);
}

/* 延迟动画 */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }

/* ---------- 页面Banner ---------- */
/* 可调整尺寸：修改 --banner-height 控制高度，--banner-title-size 控制标题大小 */
.page-banner {
  position: relative;
  height: 368px;                  /* ← 调整Banner高度 */
  display: flex;
  align-items: flex-end;          /* 内容贴底部 */
  justify-content: flex-start;    /* 内容贴左侧 */
  background-size: cover;
  background-position: center;
  background-attachment: scroll;   /* 图片随页面滚动 */
  overflow: hidden;
}

.page-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,22,40,0.80) 0%, rgba(10,22,40,0.35) 50%, rgba(10,22,40,0.15) 100%);
}

.page-banner-content {
  position: relative;
  z-index: 2;
  text-align: left;
  color: white;
  padding: 0 60px 48px;           /* ← 调整左侧和底部间距 */
  max-width: 700px;               /* ← 调整内容最大宽度 */
}

.page-banner-title {
  font-size: 48px;                /* ← 调整标题字号 */
  font-weight: 800;
  margin-bottom: 10px;
  line-height: 1.1;
}

.page-banner-subtitle {
  font-size: 16px;
  opacity: 0.75;
  letter-spacing: 3px;
  margin-bottom: 0;
}

.page-banner-breadcrumb {
  margin-top: 14px;
  font-size: 13px;
  opacity: 0.65;
}

.page-banner-breadcrumb a {
  color: white;
  opacity: 0.8;
}

.page-banner-breadcrumb a:hover {
  opacity: 1;
}

.page-banner-breadcrumb span {
  margin: 0 8px;
}

/* ---------- 辅助类 ---------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--primary) !important; }
.text-secondary-color { color: var(--secondary) !important; }
.text-accent { color: var(--accent) !important; }
.text-white { color: white !important; }
.text-light { color: var(--text-light) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 25px; margin-bottom: 25px;}
.mb-20 { margin-bottom: 20px; }
.mb-40 { margin-bottom: 40px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 70px 0; }
  .section-title { font-size: 21px; }
  .page-banner { height: 400px; }                    /* ← 平板Banner高度 */
  .page-banner-title { font-size: 38px; }
  .page-banner-content { padding: 0 40px 40px; }
  .container { padding: 0 16px; }
}

@media (max-width: 768px) {
  .custom-scrollbar { display: none !important; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .section { padding: 50px 0; }
  .section-title { font-size: 18px; text-align: left; }
  .section-subtitle { font-size: 15px; text-align: left; }
  .section-header { margin-bottom: 30px; margin-top: 30px;  }
  .page-banner { height: 260px; background-attachment: scroll; } /* ← 移动端Banner高度，scroll避免移动端fixed卡顿 */
  .page-banner-title { font-size: 20px; }
  .page-banner-content { padding: 0 24px 32px; }
  .btn-lg { padding: 14px 30px; font-size: 15px; }
  :root { --header-height: 64px; }
  .container { padding: 0 12px; }
  
  /* 防止内容溢出 */
  img { max-width: 100%; height: auto; }
  pre, code { white-space: pre-wrap; word-wrap: break-word; }
  table { display: block; overflow-x: auto; }
  input, textarea, select { max-width: 100%; }
}

/* 防止所有元素溢出屏幕 */
img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* 文本溢出处理 */
.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-ellipsis-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-ellipsis-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
