:root {
  --header-offset: 122px; /* Desktop: 68px (header-top) + 52px (main-nav) = 120px, +2px for safety */
  --primary-color: #2F6BFF;
  --accent-color: #6FA3FF;
  --button-gradient: linear-gradient(180deg, #4A8BFF 0%, #2F6BFF 100%);
  --card-bg: #FFFFFF;
  --page-bg: #F4F7FB;
  --text-main: #1F2D3D;
  --text-dark: #000000;
  --border-color: #D6E2FF;
  --glow-color: #A5C4FF;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--page-bg);
  padding-top: var(--header-offset); /* Fixed header offset */
  overflow-x: hidden; /* Prevent horizontal scroll from body */
}

/* --- Shared Header Styles --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  background-color: transparent; /* Actual backgrounds set on header-top and main-nav */
  box-sizing: border-box;
  overflow-x: hidden; /* Prevent horizontal scroll from header */
}

.header-top {
  box-sizing: border-box;
  min-height: 68px; /* Desktop height */
  height: 68px; /* Desktop height */
  display: flex;
  align-items: center;
  overflow: hidden;
  background-color: var(--primary-color); /* Distinct background color */
  width: 100%;
  color: white;
}

.header-container {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px; /* Padding for logo and buttons */
}

.logo {
  font-size: 28px;
  font-weight: bold;
  color: white;
  text-decoration: none;
  display: block; /* Ensure it's not inline */
  line-height: 1; /* Adjust line height for text logo */
}

.logo img {
  display: block;
  max-height: 60px; /* Desktop logo max height */
  height: auto;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

.desktop-nav-buttons {
  display: flex; /* Visible on desktop */
  gap: 12px;
  align-items: center;
}

.btn {
  background: var(--button-gradient);
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  display: inline-flex; /* Use flex for button content alignment */
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn:hover {
  opacity: 0.9;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.hamburger-menu {
  display: none; /* Hidden on desktop */
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  cursor: pointer;
  padding: 5px;
  z-index: 1001; /* Above header */
}

.hamburger-menu span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}
.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}
.hamburger-menu.active span:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

.mobile-nav-buttons {
  box-sizing: border-box;
  display: none; /* Hidden on desktop by default */
  min-height: 48px; /* Mobile height */
  background-color: var(--page-bg); /* A neutral background for this section */
  width: 100%;
  padding: 0 15px; /* Adjust padding for mobile */
  gap: 10px;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.main-nav {
  box-sizing: border-box;
  min-height: 52px; /* Desktop height */
  height: 52px; /* Desktop height */
  display: flex; /* Visible on desktop */
  align-items: center;
  overflow: hidden;
  background-color: var(--accent-color); /* Distinct background color */
  width: 100%;
}

.nav-container {
  box-sizing: border-box;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: center; /* Center menu items */
  align-items: center;
  padding: 0 20px;
  flex-wrap: nowrap; /* Prevent menu items from wrapping on desktop */
  overflow-x: auto; /* Allow horizontal scroll for many items on desktop if needed */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  scrollbar-width: none; /* Hide scrollbar for Firefox */
  -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */
}

.nav-container::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari/Opera */
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 10px 15px;
  font-weight: bold;
  transition: background-color 0.3s ease;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: none; /* Hidden by default */
}

body.no-scroll {
  overflow: hidden;
}

/* --- Mobile Styles --- */
@media (max-width: 768px) {
  :root {
    --header-offset: 110px; /* Mobile: 60px (header-top) + 48px (mobile-nav-buttons) = 108px, +2px for safety */
  }

  .header-top {
    min-height: 60px !important; /* Mobile height */
    height: 60px !important; /* Mobile height */
    padding: 0 15px; /* Adjust padding */
    justify-content: space-between; /* Space out hamburger and logo */
  }

  .header-container {
    width: 100%;
    max-width: none; /* No max-width on mobile */
    padding: 0; /* Handled by header-top padding */
    position: relative; /* For absolute positioning of logo if needed */
  }

  .logo {
    flex: 1 !important; /* Take available space */
    display: flex !important;
    justify-content: center !important; /* Center the logo */
    align-items: center !important;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 100px); /* Ensure logo doesn't overlap hamburger */
  }

  .logo img {
    max-height: 56px !important; /* Mobile logo max height */
  }

  .desktop-nav-buttons {
    display: none !important; /* Hide desktop buttons on mobile */
  }

  .hamburger-menu {
    display: flex; /* Show hamburger menu on mobile */
  }

  .mobile-nav-buttons {
    display: flex !important; /* Show mobile buttons on mobile */
    min-height: 48px; /* Mobile height */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 8px 15px; /* Adjusted padding for buttons */
    overflow: hidden;
    gap: 10px;
    flex-wrap: nowrap; /* Ensure buttons stay in one line */
    background-color: var(--page-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  }

  .mobile-nav-buttons .btn {
    flex: 1; /* Distribute space evenly */
    min-width: 0; /* Allow shrinking */
    max-width: calc(50% - 5px); /* Max width for two buttons with gap */
    box-sizing: border-box;
    padding: 8px 12px; /* Smaller padding for mobile buttons */
    font-size: 13px; /* Smaller font size for mobile buttons */
    white-space: normal; /* Allow text wrapping */
    word-wrap: break-word; /* Ensure text wraps */
    overflow-wrap: break-word;
    line-height: 1.2; /* Adjust line height for wrapped text */
  }

  .main-nav {
    min-height: auto; /* Auto height for expanded menu */
    height: auto; /* Auto height for expanded menu */
    position: fixed; /* Fixed position for mobile menu */
    top: var(--header-offset); /* Position below fixed header and mobile buttons */
    left: 0;
    width: 80%; /* Menu width */
    max-width: 300px; /* Max width for mobile menu */
    height: calc(100% - var(--header-offset)); /* Fill remaining viewport height */
    background-color: var(--primary-color); /* Menu background */
    flex-direction: column; /* Stack menu items vertically */
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px 0;
    transform: translateX(-100%); /* Hidden by default */
    transition: transform 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    display: none; /* Hidden by default for display toggle */
    overflow-y: auto; /* Allow scrolling for many menu items */
  }

  .main-nav.active {
    transform: translateX(0); /* Show menu */
    display: flex; /* Show menu when active */
  }

  .nav-container {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    width: 100%;
    max-width: none; /* No max-width on mobile */
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scroll within menu */
  }

  .nav-link {
    width: 100%;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-link:last-child {
    border-bottom: none;
  }

  .overlay.active {
    display: block; /* Show overlay when active */
  }

  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }
  /* body { overflow-x: hidden; } - already set globally to prevent issues */
}

/* --- Footer Styles --- */
.site-footer {
  background-color: var(--text-main); /* Dark background for footer */
  color: white;
  padding: 40px 20px 20px;
  font-size: 14px;
  line-height: 1.6;
  box-sizing: border-box;
}

.footer-top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive grid */
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto 30px;
}

.footer-col h3 {
  color: var(--accent-color);
  font-size: 18px;
  margin-bottom: 15px;
}

.footer-logo {
  font-size: 28px;
  font-weight: bold;
  color: white;
  text-decoration: none;
  display: block;
  margin-bottom: 15px;
}

.footer-description {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 20px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.footer-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav li {
  margin-bottom: 10px;
}

.footer-nav a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-nav a:hover {
  color: var(--accent-color);
}

.footer-slot-anchor-inner {
  min-height: 10px; /* Ensure slot is visible for inspection */
}

.footer-bottom-nav {
    max-width: 1200px;
    margin: 20px auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.footer-bottom-nav .footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px 30px;
}

.footer-bottom-nav .footer-nav li {
    margin-bottom: 0;
}

.footer-bottom {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

.footer-bottom p {
  margin: 0;
}

@media (max-width: 768px) {
  .site-footer {
    padding: 30px 15px 15px;
  }
  .footer-top-grid {
    grid-template-columns: 1fr; /* Single column on mobile */
    margin-bottom: 20px;
  }
  .footer-col {
    text-align: center;
  }
  .footer-col h3 {
    text-align: center;
  }
  .footer-nav {
    text-align: center;
  }
  .footer-bottom-nav .footer-nav {
      flex-direction: column;
      align-items: center;
      gap: 10px;
  }
}

/* Mobile Content Overflow Protection */
@media (max-width: 768px) {
  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }
  /* body { overflow-x: hidden; } - already set globally to prevent issues */
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@media (max-width: 768px) {
  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }
  body {
    overflow-x: hidden;
  }
}
/* 内容保护（系统追加，请勿删除） */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}
