/* shared.css - 全局共享样式 */

/* 基础样式重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

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

/* 链接样式 */
a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* 容器和布局 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.main-header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
    transition: padding 0.3s ease, background-color 0.3s ease;
}

.main-header.scrolled {
    padding: 10px 0;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.logo img {
    height: 40px; 
    width: auto;
    max-width: 100%;
}

.main-nav .nav-list {
    list-style: none;
    display: flex;
    gap: 25px;
}

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

.main-nav .nav-link {
    display: block;
    padding: 10px 0;
    color: #333;
    font-weight: 500;
    position: relative;
}

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

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

.main-nav .has-dropdown .nav-link i {
    margin-left: 5px;
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.main-nav .has-dropdown:hover .nav-link i {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    list-style: none;
    min-width: 200px;
    padding: 10px 0;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 10;
}

.main-nav .has-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li a {
    display: block;
    padding: 8px 20px;
    color: #555;
    white-space: nowrap;
}

.dropdown-menu li a:hover {
    background-color: #f2f2f2;
    color: #007bff;
    text-decoration: none;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    color: #555;
    padding: 5px;
    transition: color 0.3s ease;
}

.btn-icon:hover {
    color: #007bff;
}

.mobile-only {
    display: none; /* Hidden by default, shown on smaller screens */
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay .container {
    display: flex;
    gap: 10px;
    width: 80%;
    max-width: 700px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    position: relative;
}

.search-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1.1em;
}

.btn-primary {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.close-search {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.8em;
    color: #666;
}

/* Mobile Menu */
#mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1001;
    display: none; /* Controlled by JS */
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -300px; /* Off-screen by default */
    width: 300px;
    height: 100%;
    background-color: #fff;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 1002;
    transition: right 0.3s ease;
    padding-top: 60px; /* Space for close button */
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.close-menu-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.8em;
    color: #555;
}

.mobile-nav-list {
    list-style: none;
    padding: 20px;
}

.mobile-nav-list li a {
    display: block;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    color: #333;
    font-size: 1.1em;
}

.mobile-nav-list li:last-child a {
    border-bottom: none;
}

.mobile-nav-list li a:hover {
    color: #007bff;
}

.mobile-nav-list .mobile-has-dropdown > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-nav-list .mobile-has-dropdown .mobile-dropdown-menu {
    list-style: none;
    padding-left: 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
}

.mobile-nav-list .mobile-has-dropdown.active-dropdown .mobile-dropdown-menu {
    max-height: 200px; /* Adjust based on content */
}

.mobile-nav-list .mobile-has-dropdown.active-dropdown > a i {
    transform: rotate(180deg);
}

.mobile-dropdown-menu li a {
    padding: 10px 0;
    font-size: 1em;
    border-bottom: none;
}

/* Footer Styles */
.main-footer {
    background-color: #222;
    color: #f8f8f8;
    padding: 50px 0 20px;
    font-size: 0.9em;
}

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

.footer-section h3 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.2em;
    position: relative;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 40px;
    height: 2px;
    background-color: #007bff;
}

.footer-section p, .footer-section ul {
    margin-bottom: 10px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li a {
    color: #ccc;
    padding: 5px 0;
    display: block;
}

.footer-section ul li a:hover {
    color: #007bff;
    text-decoration: none;
}

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

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

.contact-info p {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}

.contact-info i {
    font-size: 1.2em;
    color: #007bff;
    margin-top: 3px;
}

.contact-info p a {
    color: #f8f8f8;
}

.contact-info p a:hover {
    color: #007bff;
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid #333;
    padding-top: 20px;
    text-align: center;
    color: #ccc;
}

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

.footer-bottom a {
    color: #007bff;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 992px) {
    .main-nav {
        display: none; /* Hide desktop nav */
    }
    .header-actions {
        display: flex;
        gap: 10px;
    }
    .mobile-only {
        display: block; /* Show mobile menu toggle */
    }
    .main-header.scrolled {
        padding: 8px 0;
    }
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr; /* Stack footer sections */
        text-align: center;
    }
    .footer-section h3::after {
        left: 50%;
        transform: translateX(-50%);
    }
    .social-links {
        text-align: center;
        margin-top: 20px;
    }
    .contact-info p {
        justify-content: center;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
