/* Shared CSS for the entire website */

/* Basic Reset & Box Sizing */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container for content width */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    color: #2c3e50;
    margin-bottom: 0.5em;
}

h1 {
    font-size: 2.5em;
}
h2 {
    font-size: 2em;
}
h3 {
    font-size: 1.75em;
}
p {
    margin-bottom: 1em;
}

a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease;
}
a:hover {
    color: #0056b3;
    text-decoration: underline;
}

ul {
    list-style: none;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: #007bff;
    color: #fff;
}
.btn-primary:hover {
    background-color: #0056b3;
    color: #fff;
    text-decoration: none;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}
.btn-secondary:hover {
    background-color: #5a6268;
    color: #fff;
    text-decoration: none;
}

/* Header */
.main-header {
    background-color: #fff;
    padding: 15px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 40px;
}

.main-nav ul {
    display: flex;
    gap: 25px;
}

.main-nav a {
    color: #333;
    font-weight: 500;
    padding: 5px 0;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: #007bff;
    transition: width 0.3s ease;
}

.main-nav a:hover::after, .main-nav a.active::after {
    width: 100%;
}

.main-nav .dropdown {
    position: relative;
}

.main-nav .dropdown-menu {
    display: none;
    position: absolute;
    background-color: #fff;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    min-width: 160px;
    z-index: 1;
    padding: 10px 0;
    border-radius: 5px;
    top: 100%; /* Position below the parent link */
    left: 0;
}

.main-nav .dropdown:hover .dropdown-menu {
    display: block;
}

.main-nav .dropdown-menu a {
    color: #333;
    padding: 10px 15px;
    display: block;
    text-align: left;
    white-space: nowrap;
}

.main-nav .dropdown-menu a:hover {
    background-color: #f1f1f1;
    text-decoration: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.9em;
}

.mobile-menu-toggle {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    cursor: pointer;
    width: 30px;
    height: 20px;
    justify-content: space-between;
}

.mobile-menu-toggle span {
    display: block;
    height: 2px;
    background-color: #333;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Main Content */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 180px); /* Adjust based on header/footer height */
}

/* Footer */
.main-footer {
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 40px 0 20px;
    font-size: 0.9em;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.footer-col h3 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.2em;
}

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

.footer-col ul {
    padding: 0;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col a {
    color: #bdc3c7;
    transition: color 0.3s ease;
}

.footer-col a:hover {
    color: #fff;
    text-decoration: underline;
}

.social-links {
    margin-top: 15px;
}

.social-links a {
    color: #ecf0f1;
    font-size: 1.5em;
    margin-right: 15px;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: #007bff;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid #34495e;
    padding-top: 20px;
    margin-top: 20px;
}

.footer-bottom p {
    margin-bottom: 5px;
}

/* Responsive Design */
@media (max-width: 992px) {
    .main-nav {
        display: none; /* Hide main nav on smaller screens */
    }

    .header-actions .btn-primary, .header-actions .search-input {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    /* Mobile menu overlay */
    .main-header.open .main-nav {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 70px; /* Below header */
        left: 0;
        width: 100%;
        background-color: #fff;
        box-shadow: 0 8px 16px rgba(0,0,0,0.2);
        padding: 20px 0;
        text-align: center;
    }

    .main-header.open .main-nav ul {
        flex-direction: column;
        gap: 10px;
    }

    .main-header.open .main-nav a {
        padding: 10px 0;
        border-bottom: 1px solid #eee;
    }

    .main-header.open .main-nav .dropdown-menu {
        position: static;
        box-shadow: none;
        padding: 0;
        margin-top: 10px;
        background-color: #f9f9f9;
    }

    .main-header.open .main-nav .dropdown-menu a {
        padding-left: 30px;
    }

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

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .social-links {
        justify-content: center;
        display: flex;
    }
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
