.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }


/* =============================================
   Base UI Components — 追加到各模板 style.css 末尾
   使用 CSS 属性选择器匹配不同模板的类名变体
   主题色通过 CSS 变量继承（各模板自定义）
   ============================================= */

/* === Class Name Mapping Fixes === */
/* Many templates have HTML class mismatches: .header vs .site-header, .footer vs .site-footer, etc. */

/* Header: basic layout — use nowrap so logo + nav stay on one row */
.header { position: sticky; top: 0; z-index: 1000; }
.header .container { display: flex; align-items: center; justify-content: space-between; min-height: 60px; flex-wrap: nowrap; gap: 12px; }
header[class*="header"] { position: sticky; top: 0; z-index: 1000; }

/* Logo: keep on one line, truncate if absurdly long */
[class*="logo"] { flex-shrink: 0; max-width: 260px; }
[class*="logo"] a, [class*="logo-text"] { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* Nav list items: nowrap on desktop so items never wrap to a new row */
.main-nav > ul, .nav-list { display: flex; list-style: none; margin: 0; padding: 0; gap: 2px; flex-wrap: nowrap; align-items: center; }
.main-nav > ul > li, .nav-list > li { position: relative; flex-shrink: 0; }
.main-nav > ul > li > a, .nav-list > li > a { 
  display: block; padding: 10px 14px; white-space: nowrap;
  text-decoration: none; font-size: 14px; transition: background 0.3s ease, color 0.3s ease;
}
.main-nav > ul > li > a:hover, .nav-list > li > a:hover { opacity: 0.8; }

/* Submenu: visibility + opacity transition (no hover flash) */
.main-nav li ul, .nav-list li ul, .subnav {
  visibility: hidden; opacity: 0; position: absolute; top: 100%; left: 0;
  min-width: 160px; z-index: 300; padding: 8px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: visibility 0.15s, opacity 0.15s ease;
}
.main-nav li:hover > ul, .nav-list li:hover > ul { visibility: visible; opacity: 1; }
.main-nav li ul a, .nav-list li ul a { padding: 8px 18px; display: block; white-space: nowrap; text-decoration: none; }
.main-nav li ul a:hover, .nav-list li ul a:hover { opacity: 0.8; }

/* Nav toggle (hamburger) */
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-toggle span { display: block; width: 24px; height: 2px; margin: 5px 0; border-radius: 2px; transition: 0.3s; }
@media (max-width: 992px) {
  .header .container { flex-wrap: nowrap; }
}
@media (max-width: 768px) {
  .header .container { flex-wrap: wrap; }
  .nav-toggle { display: block; }
  .main-nav { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; width: 100%; }
  .main-nav.active { max-height: 90vh; overflow-y: auto; }
  .main-nav > ul { flex-direction: column; width: 100%; flex-wrap: wrap; }
  .main-nav > ul > li > a { padding: 12px 16px; border-bottom: 1px solid rgba(128,128,128,0.1); }
  .main-nav li ul { position: static; box-shadow: none; padding-left: 16px; }
}

/* Footer: layout only, colors from template CSS */
.footer { padding: 50px 0 0; }
.footer .container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
footer[class*="footer"] .footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; padding-bottom: 32px; border-bottom: 1px solid rgba(128,128,128,0.2); }
@media(max-width:992px){ footer[class*="footer"] .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media(max-width:768px){ footer[class*="footer"] .footer-grid { grid-template-columns: 1fr; } }
.footer-col h4 { font-family: var(--font-serif, inherit); color: #fff; font-size: 1rem; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid rgba(255,255,255,0.15); }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { color: rgba(255,255,255,0.7); font-size: 14px; transition: color 0.3s ease; text-decoration: none; }
.footer-col a:hover { color: #fff; }
.footer-bottom { text-align: center; padding: 20px 0; font-size: 13px; }
.footer-bottom a { color: rgba(255,255,255,0.7); text-decoration: none; }
.footer-bottom a:hover { color: #fff; }

/* --- Buttons --- */
[class*="btn"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-decoration: none;
  line-height: 1.4;
}
[class*="btn"][class*="primary"],
[class*="btn-primary"] {
  background: var(--primary, #2563eb);
  color: #fff;
}
[class*="btn"][class*="primary"]:hover,
[class*="btn-primary"]:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
[class*="btn"][class*="outline"],
[class*="btn-outline"] {
  background: transparent;
  color: var(--primary, #2563eb);
  border: 2px solid var(--primary, #2563eb);
}
[class*="btn"][class*="outline"]:hover,
[class*="btn-outline"]:hover {
  background: var(--primary, #2563eb);
  color: #fff;
}
[class*="btn"][class*="white"],
[class*="btn-white"] {
  background: #fff;
  color: var(--primary, #2563eb);
}
[class*="btn"][class*="white"]:hover,
[class*="btn-white"]:hover {
  background: rgba(255,255,255,0.85);
}
[class*="btn"][class*="lg"],
[class*="btn-lg"] {
  padding: 16px 36px;
  font-size: 1.05rem;
}
[class*="btn"][class*="sm"],
[class*="btn-sm"] {
  padding: 8px 20px;
  font-size: 0.85rem;
}

/* --- Cards --- */
[class*="card"] {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
[class*="card"]:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
[class*="card"] a {
  text-decoration: none;
  color: inherit;
}
[class*="card"] h3,
[class*="card"] h4 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text, #1e293b);
}
[class*="card"] p {
  color: var(--gray, #64748b);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 0;
}

/* --- Grids --- */
[class*="grid"] {
  display: grid;
  gap: 24px;
}

/* --- Section / Page Sections --- */
[class*="section"] {
  padding: 80px 0;
}
[class*="section"][class*="alt"],
[class*="section"][class*="dark"],
[class*="section-bg-dark"],
[class*="section"][class*="gray"],
[class*="section"][class*="grey"] {
  background: var(--gray-100, #f1f5f9);
}
[class*="section-header"] {
  text-align: center;
  margin-bottom: 48px;
}
[class*="section-title"] {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text, #0f172a);
  margin-bottom: 8px;
}
[class*="section-subtitle"],
[class*="section-desc"],
[class*="section-header"] p {
  color: var(--gray, #64748b);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}
[class*="section-more"] {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--primary, #2563eb);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
}
[class*="section-more"]:hover {
  opacity: 0.8;
}

/* --- Hero --- */
[class*="hero"] {
  padding: 100px 0 80px;
  background: var(--primary, #2563eb);
  color: #fff;
  position: relative;
  overflow: hidden;
}
[class*="hero"] h1,
[class*="hero"] [class*="title"] {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 16px;
  color: #fff;
}
[class*="hero"] p {
  font-size: 1.1rem;
  opacity: 0.85;
  line-height: 1.7;
  margin-bottom: 32px;
  color: rgba(255,255,255,0.85);
}
[class*="hero-badge"] {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  color: #fff;
  padding: 6px 20px;
  border-radius: 50px;
  font-size: 0.85rem;
  margin-bottom: 24px;
}
[class*="hero-actions"] {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- Tags / Labels / Badges --- */
[class*="tag"],
[class*="label"],
[class*="badge"] {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--primary-light, #dbeafe);
  color: var(--primary, #2563eb);
  text-decoration: none;
}

/* --- Meta / Info lines --- */
[class*="meta"] {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--gray, #94a3b8);
}
[class*="meta"] span {
  white-space: nowrap;
}

/* --- Links with arrows --- */
[class*="link"]:not([class*="nav"]):not([class*="footer"]) {
  color: var(--primary, #2563eb);
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.3s;
}
[class*="link"]:not([class*="nav"]):not([class*="footer"]):hover {
  opacity: 0.8;
}

/* --- News / Article items --- */
[class*="news"] article,
[class*="news"] [class*="item"],
[class*="article"] {
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100, #f1f5f9);
}
[class*="news"] h3,
[class*="news"] h3 a {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text, #1e293b);
  text-decoration: none;
}
[class*="news"] h3 a:hover {
  color: var(--primary, #2563eb);
}

/* --- Category / Feature icons --- */
[class*="icon"] {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* --- Empty state --- */
[class*="empty"] {
  text-align: center;
  padding: 40px 0;
  color: var(--gray, #94a3b8);
  font-size: 0.95rem;
}

/* --- Stats counter --- */
[class*="stat"] [class*="number"],
[class*="stat"] [class*="num"] {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--primary, #2563eb);
  line-height: 1;
}
[class*="stat"] [class*="label"] {
  font-size: 0.9rem;
  color: var(--gray, #64748b);
  margin-top: 4px;
}

/* --- CTA --- */
[class*="cta"] {
  text-align: center;
  padding: 80px 24px;
  background: linear-gradient(135deg, var(--primary, #2563eb), var(--secondary, #0891b2));
  color: #fff;
  border-radius: 16px;
}
[class*="cta"] h2 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}
[class*="cta"] p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 28px;
  color: rgba(255,255,255,0.85);
}

/* --- Partner / client logos --- */
[class*="partner"],
[class*="client"] {
  opacity: 0.6;
  transition: opacity 0.3s;
}
[class*="partner"]:hover,
[class*="client"]:hover {
  opacity: 1;
}

/* --- Responsive --- */
@media (max-width: 992px) {
  [class*="grid"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  [class*="hero"] h1 {
    font-size: 2rem;
  }
  [class*="section-title"] {
    font-size: 1.6rem;
  }
}
@media (max-width: 768px) {
  [class*="grid"] {
    grid-template-columns: 1fr !important;
  }
  [class*="hero"] {
    padding: 60px 0;
  }
  [class*="hero"] h1 {
    font-size: 1.65rem;
  }
  [class*="section"] {
    padding: 48px 0;
  }
  [class*="btn"] {
    padding: 10px 22px;
  }
  [class*="cta"] {
    padding: 48px 16px;
  }
}

/* Skip-to-content link (accessibility) */
.skip-link {
  position: absolute; top: -100%; left: 50%; z-index: 9999;
  transform: translateX(-50%);
  background: #2563eb; color: #fff; padding: 8px 20px; border-radius: 0 0 8px 8px;
  font-size: 14px; text-decoration: none; white-space: nowrap;
}
.skip-link:focus { top: 0; }

/* Article subtitle (extracted from inline style) */
.article-subtitle {
  color: #888; font-size: 1.05rem; line-height: 1.6; margin: -8px 0 16px 0;
}

/* --- Advertisement slots --- */
.ad-slot {
  margin: 16px 0;
  position: relative;
}
.ad-slot:first-child { margin-top: 0; }
.ad-slot img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}
.ad-item { margin-bottom: 12px; }
.ad-item:last-child { margin-bottom: 0; }
.ad-item-card {
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  background: #f8fafc;
}
.ad-item-card h4 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #1f2937;
}
.ad-item-card p {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.5;
}
.ad-item-text a {
  color: #2563eb;
  text-decoration: underline;
}
.header-banner, .footer-banner {
  background: #f8fafc;
}
.header-banner .ad-slot,
.footer-banner .ad-slot {
  margin: 0 auto;
  max-width: 1200px;
  padding: 12px 16px;
}
