/* WP Visual Builder - Frontend Styles for Published Pages */

/* ===== 全局重置：隔离主题样式污染 ===== */
.wpvb-page,
.wpvb-page * {
  box-sizing: border-box;
}

/* 强制重置 ul/li，防止主题样式污染导致列表符号出现 */
.wpvb-page ul,
.wpvb-page ol,
.wpvb-page li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* 强制重置链接、标题、段落继承 */
.wpvb-page a { text-decoration: none; }
.wpvb-page h1, .wpvb-page h2, .wpvb-page h3,
.wpvb-page h4, .wpvb-page h5, .wpvb-page h6 {
  margin: 0; padding: 0; font-weight: inherit; line-height: inherit;
}
.wpvb-page p { margin: 0; padding: 0; }
/* 全局图片重置，但排除 nav logo（用更具体的选择器覆盖） */
.wpvb-page img { max-width: 100%; display: block; }
.wpvb-page button { cursor: pointer; }

/* ===== 布局容器 ===== */
.wpvb-page { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.wpvb-boxed .wpvb-nav-inner,
.wpvb-boxed .wpvb-heading,
.wpvb-boxed .wpvb-text,
.wpvb-boxed .wpvb-image-text,
.wpvb-boxed .wpvb-grid,
.wpvb-boxed .wpvb-mask-grid,
.wpvb-boxed .wpvb-table-wrap,
.wpvb-boxed .wpvb-button-wrap,
.wpvb-boxed .wpvb-social,
.wpvb-boxed .wpvb-footer-inner {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ===== NAV ===== */
.wpvb-nav { position: relative; z-index: 100; }
.wpvb-nav-inner {
  display: flex;
  align-items: center;
  height: 64px;
}
.wpvb-nav.style-logo .wpvb-nav-inner { justify-content: space-between; }
.wpvb-nav-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.wpvb-nav-brand img { height: 40px; width: auto; object-fit: contain; }
.wpvb-nav-brand-name { font-weight: 700; font-size: 18px; }
.wpvb-nav-menu {
  display: flex !important;
  align-items: center !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.wpvb-nav-menu > li {
  position: relative;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.wpvb-nav-menu > li > a {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
  white-space: nowrap;
}
.wpvb-nav-menu li.has-children > a::after { content: ' ▾'; font-size: 10px; }
.wpvb-nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-radius: 8px;
  min-width: 160px;
  list-style: none !important;
  padding: 6px 0 !important;
  margin: 0 !important;
  z-index: 200;
}
.wpvb-nav-menu li:hover > .wpvb-nav-dropdown { display: block; }
.wpvb-nav-dropdown li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.wpvb-nav-dropdown li a {
  display: block;
  padding: 8px 16px;
  text-decoration: none;
  font-size: 13px;
  color: #374151;
  transition: background 0.2s;
}
.wpvb-nav-dropdown li a:hover { background: #f3f4f6; }

/* ===== Mobile Nav ===== */
.wpvb-nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 5px;
  margin-left: auto;
}
.wpvb-nav-mobile-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.3s;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .wpvb-nav-menu { display: none !important; }
  .wpvb-nav-menu.mobile-open {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: inherit;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 8px 0 !important;
  }
  .wpvb-nav-mobile-toggle { display: flex !important; }
  .wpvb-image-text-inner { flex-direction: column !important; }
  .wpvb-grid-inner { grid-template-columns: 1fr !important; }
  .wpvb-mask-grid-inner { grid-template-columns: 1fr !important; }
  .wpvb-banner-title { font-size: 22px !important; }
  .wpvb-banner-subtitle { font-size: 14px !important; }
  .wpvb-mask-fullwidth-title { font-size: 24px !important; }
}

/* ===== 修复：nav logo 高度不被全局 img 重置覆盖 ===== */
.wpvb-page .wpvb-nav-brand img {
  height: 40px !important;
  width: auto !important;
  max-width: none !important;
  display: inline-block;
}

/* ===== 确保 image_text flex 布局在前端正常工作 ===== */
.wpvb-page .wpvb-image-text-inner {
  display: flex !important;
  align-items: center;
}
.wpvb-page .wpvb-image-text.layout-right .wpvb-image-text-inner { flex-direction: row-reverse !important; }
.wpvb-page .wpvb-image-text.layout-top .wpvb-image-text-inner { flex-direction: column !important; }
.wpvb-page .wpvb-image-text.layout-bottom .wpvb-image-text-inner { flex-direction: column-reverse !important; }
.wpvb-page .wpvb-image-text-image { flex-shrink: 0; }
.wpvb-page .wpvb-image-text-image img { height: auto !important; }

/* ===== 确保 grid flex/grid 布局在前端正常工作 ===== */
.wpvb-page .wpvb-grid-inner { display: grid !important; }
.wpvb-page .wpvb-mask-grid-inner { display: grid !important; }
.wpvb-page .wpvb-mask-fullwidth { position: relative; }

/* ===== 全屏布局（fullwidth）强制覆盖主题容器 ===== */
/* JS 会把 .wpvb-fullwidth 移到 body 下，这里确保它全宽铺开 */
body > .wpvb-page.wpvb-fullwidth {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  left: 0 !important;
  right: 0 !important;
  box-sizing: border-box;
}
/* fullwidth 模式下所有内容组件也不限制最大宽度 */
.wpvb-fullwidth .wpvb-nav-inner,
.wpvb-fullwidth .wpvb-heading,
.wpvb-fullwidth .wpvb-text,
.wpvb-fullwidth .wpvb-image-text,
.wpvb-fullwidth .wpvb-grid,
.wpvb-fullwidth .wpvb-mask-grid,
.wpvb-fullwidth .wpvb-table-wrap,
.wpvb-fullwidth .wpvb-button-wrap,
.wpvb-fullwidth .wpvb-social,
.wpvb-fullwidth .wpvb-footer-inner {
  max-width: none !important;
  padding-left: 40px;
  padding-right: 40px;
}

/* ===== CODE BLOCK（自定义代码组件）===== */
.wpvb-code-block {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.wpvb-code-block iframe {
  display: block;
  width: 100%;
  border: none;
  min-height: 100px;
}
