/* Shared CSS for Header and Footer */

/* Root variables for header offset */
:root {
  --header-offset: 122px; /* Desktop: header-top (68) + main-nav (52) + 2px buffer */
  --main-color: #017439;
  --auxiliary-color: #FFFFFF;
}
body {
  padding-top: var(--header-offset);
  overflow-x: hidden; /* Prevent horizontal scroll on desktop too */
  margin: 0;
  font-family: Arial, sans-serif;
  color: #333;
  background-color: var(--auxiliary-color);
}

/* Base styles for site header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  background-color: var(--auxiliary-color); /* Fallback, specific sections will override */
}

/* Header Top Section */
.header-top {
  box-sizing: border-box;
  min-height: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background-color: #015029; /* Darker green for contrast */
  width: 100%;
  color: var(--auxiliary-color);
}

.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 20px;
}

/* Logo */
.logo {
  display: block;
  font-size: 28px;
  font-weight: bold;
  color: var(--auxiliary-color);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1; /* Ensure text fits within height */
}
/* If logo is an image, these styles would apply */
.logo img {
  display: block;
  max-height: 60px;
  height: auto;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

/* Desktop Navigation Buttons */
.desktop-nav-buttons {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Mobile Navigation Buttons (hidden by default on desktop) */
.mobile-nav-buttons {
  box-sizing: border-box;
  display: none; /* Hidden on desktop */
  min-height: 48px; /* Fixed height for mobile */
  background-color: var(--main-color); /* Use main color for mobile button bar */
  width: 100%;
  padding: 0 15px; /* Mobile padding */
}

/* Main Navigation Section */
.main-nav {
  box-sizing: border-box;
  min-height: 52px;
  height: 52px;
  display: flex; /* Desktop default: flex for horizontal menu */
  align-items: center;
  overflow: hidden;
  background-color: var(--main-color); /* Main green for menu bar */
  width: 100%;
  color: var(--auxiliary-color);
}

.nav-container {
  box-sizing: border-box;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: row; /* Desktop default: horizontal */
  justify-content: center;
  align-items: center;
  padding: 0 20px;
  gap: 25px; /* Spacing between desktop nav items */
}

.nav-link {
  color: var(--auxiliary-color);
  text-decoration: none;
  font-weight: 500;
  padding: 5px 0;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: #FFFF00; /* Yellow on hover */
}

/* Hamburger Menu (hidden by default on desktop) */
.hamburger-menu {
  display: none; /* Hidden on desktop */
  width: 30px;
  height: 24px;
  position: relative;
  cursor: pointer;
  z-index: 1001; /* Above header */
  flex-shrink: 0; /* Prevent shrinking */
  margin-right: 15px; /* Space between hamburger and logo on mobile */
}

.hamburger-menu span {
  display: block;
  position: absolute;
  height: 4px;
  width: 100%;
  background: var(--auxiliary-color);
  border-radius: 2px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: .25s ease-in-out;
}

.hamburger-menu span:nth-child(1) { top: 0px; }
.hamburger-menu span:nth-child(2) { top: 10px; }
.hamburger-menu span:nth-child(3) { top: 20px; }

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

/* Overlay for mobile menu */
.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 */
}
.overlay.active {
  display: block;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  text-align: center;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.btn-register, .btn-login {
  background-color: #C30808; /* Red */
  color: #FFFF00; /* Yellow */
}

.btn-register:hover, .btn-login:hover {
  background-color: #a30606; /* Slightly darker red */
  box-shadow: 0 0 10px rgba(195, 8, 8, 0.5);
}

/* Footer Styles */
.site-footer {
  background-color: #015029; /* Darker green for footer */
  color: var(--auxiliary-color);
  padding: 40px 0 20px;
  font-size: 14px;
}

.footer-top-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 0 20px;
}

.footer-col {
  padding-bottom: 20px; /* Add some space between columns and next section */
}

.footer-logo {
  display: block;
  font-size: 24px;
  font-weight: bold;
  color: var(--auxiliary-color);
  text-decoration: none;
  margin-bottom: 15px;
}

.footer-description {
  line-height: 1.6;
  margin-bottom: 15px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

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

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

.footer-nav li, .footer-legal-nav li {
  margin-bottom: 8px;
}

.footer-nav a, .footer-legal-nav a {
  color: var(--auxiliary-color);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-nav a:hover, .footer-legal-nav a:hover {
  color: #FFFF00; /* Yellow on hover */
}

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

.footer-legal-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px 30px; /* Spacing between legal links */
}

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

.footer-bottom p {
  margin: 0;
  line-height: 1.5;
}

/* Anchor slots (keep them invisible and without affecting layout, but present) */
.footer-slot-anchor-inner {
  display: block;
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}

/* Prevents body scroll when mobile menu is open */
body.no-scroll {
  overflow: hidden;
}

/* Media Queries for Mobile */
@media (max-width: 768px) {
  /* Header Offset for Mobile */
  :root {
    --header-offset: 110px; /* Mobile: header-top (60) + mobile-nav-buttons (48) + 2px buffer */
  }

  body {
    overflow-x: hidden;
  }

  .page-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }
  .page-content {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* Header Top Mobile */
  .header-top {
    min-height: 60px !important;
    height: 60px !important;
  }

  .header-container {
    width: 100%;
    max-width: none; /* Remove max-width on mobile */
    padding: 0 15px; /* Smaller padding for mobile */
    justify-content: space-between; /* Hamburger left, logo center, space right */
    position: relative; /* For absolute positioning of logo if needed */
  }

  /* Hamburger Menu Mobile */
  .hamburger-menu {
    display: block; /* Show hamburger on mobile */
  }

  /* Logo Mobile Centering (Method 1: Flexbox) */
  .logo {
    flex: 1 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: absolute; /* To center it without affecting flex flow of hamburger/buttons */
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 100px); /* Ensure logo doesn't overlap hamburger/buttons */
    margin-left: 0; /* Reset margin */
  }
  .logo img {
    max-height: 56px !important; /* Smaller logo for mobile */
  }

  /* Desktop Nav Buttons (hide on mobile) */
  .desktop-nav-buttons {
    display: none !important;
  }

  /* Mobile Nav Buttons (show on mobile, below header-top) */
  .mobile-nav-buttons {
    display: flex !important; /* Show on mobile */
    min-height: 48px;
    align-items: center;
    justify-content: center; /* Center buttons horizontally */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 15px;
    overflow: hidden;
    gap: 10px;
    flex-wrap: nowrap; /* Ensure buttons stay in one row */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* Subtle shadow */
  }

  .mobile-nav-buttons .btn {
    flex: 1;
    min-width: 0;
    max-width: calc(50% - 5px); /* Max width for two buttons with 10px gap */
    box-sizing: border-box;
    padding: 8px 12px;
    font-size: 13px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Main Navigation Mobile (hidden by default, revealed by hamburger) */
  .main-nav {
    display: none; /* Hidden by default */
    position: fixed; /* Fixed position for off-canvas menu */
    top: var(--header-offset); /* Start below the fixed header + mobile buttons */
    left: 0;
    width: 280px; /* Width of the mobile menu */
    height: calc(100% - var(--header-offset)); /* Full height below header */
    background-color: var(--main-color); /* Same as main-nav desktop */
    flex-direction: column; /* Vertical menu items */
    justify-content: flex-start;
    align-items: flex-start;
    padding: 20px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    transform: translateX(-100%); /* Off-screen to the left */
    transition: transform 0.3s ease-in-out;
    z-index: 999; /* Below overlay, above header-top */
    overflow-y: auto; /* Allow scrolling for long menus */
  }

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

  .nav-container {
    flex-direction: column;
    align-items: flex-start;
    padding: 0 20px;
    gap: 15px; /* Spacing between vertical nav items */
    width: 100%;
    max-width: none; /* Remove max-width on mobile */
  }

  .nav-link {
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  .nav-link:last-child {
    border-bottom: none;
  }

  /* Footer Mobile */
  .site-footer {
    padding: 30px 0 15px;
  }

  .footer-top-grid {
    grid-template-columns: 1fr; /* Single column layout for footer on mobile */
    padding: 0 15px;
  }

  .footer-col {
    padding-bottom: 25px;
    text-align: center;
  }

  .footer-col h3 {
    margin-bottom: 10px;
  }

  .footer-nav li, .footer-legal-nav li {
    margin-bottom: 5px;
  }

  .footer-legal-nav-wrapper {
    margin: 15px auto 0;
    padding: 10px 15px;
  }

  .footer-legal-nav {
    flex-direction: column; /* Stack legal links vertically */
    gap: 10px;
  }

  .footer-bottom {
    margin-top: 10px;
    padding: 0 15px;
    padding-top: 10px;
  }
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
}
