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

/* CSS Reset / Normalize */
html {
    box-sizing: border-box;
    font-size: 16px;
    line-height: 1.6;
}
*, *::before, *::after {
    box-sizing: inherit;
}
body {
    margin: 0;
    padding: 0;
    font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    color: #333;
    background-color: #f8f9fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.8em;
    font-weight: 700;
    line-height: 1.3;
    color: #003366;
}
h1 { font-size: 2.8em; }
h2 { font-size: 2.2em; }
h3 { font-size: 1.8em; }
h4 { font-size: 1.4em; }
h5 { font-size: 1.1em; }
h6 { font-size: 0.9em; }
p {
    margin-top: 0;
    margin-bottom: 1em;
    line-height: 1.7;
}
a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease, background-color 0.3s ease;
}
a:hover {
    color: #0056b3;
    text-decoration: underline;
}
ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Layout & Containers */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -15px;
    margin-right: -15px;
}
.col {
    flex: 1;
    padding-left: 15px;
    padding-right: 15px;
}
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-white { color: #fff !important; }
.mb-3 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    color: #212529;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.3rem;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}
.btn i {
    margin-right: 8px;
}
.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}
.btn-primary:hover {
    color: #fff;
    background-color: #0056b3;
    border-color: #0056b3;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}
.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}
.btn-secondary:hover {
    color: #fff;
    background-color: #5a6268;
    border-color: #545b62;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}
.btn-outline-primary {
    color: #007bff;
    border-color: #007bff;
    background-color: transparent;
}
.btn-outline-primary:hover {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

/* Forms */
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Header & Footer specific styles (often shared for basic layout consistency) */
.header-top {
    background-color: #003366;
    color: #fff;
    padding: 10px 0;
    font-size: 0.85em;
}
.header-top .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-links a {
    color: #fff;
    margin-left: 15px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.top-links a:hover {
    text-decoration: underline;
    color: #add8e6;
}
.top-links a i {
    margin-right: 5px;
}

.header-main {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: relative; /* For dropdown positioning */
    z-index: 1000;
}
.header-main.scrolled {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    animation: slideDown 0.3s ease-out forwards;
}
@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.header-main .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo a {
    font-size: 2.2em;
    font-weight: bold;
    color: #003366;
    text-decoration: none;
    display: flex;
    align-items: center;
}
.logo img {
    height: 45px;
    margin-right: 12px;
}
.header-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}
.header-nav ul li {
    position: relative;
    margin-right: 35px;
}
.header-nav ul li:last-child {
    margin-right: 0;
}
.header-nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    padding: 12px 0;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}
.header-nav ul li a i {
    margin-right: 5px;
}
.header-nav ul li a:hover {
    color: #007bff;
}
.dropdown-menu {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 220px;
    box-shadow: 0px 8px 20px 0px rgba(0,0,0,0.15);
    z-index: 1001;
    padding: 10px 0;
    border-radius: 5px;
    left: 0;
    top: 100%;
    list-style: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.header-nav ul li:hover > .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.dropdown-menu li {
    margin: 0;
}
.dropdown-menu li a {
    color: #555;
    padding: 10px 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    white-space: nowrap;
    font-weight: normal;
    font-size: 0.95em;
    border-bottom: 1px solid #f8f9fa;
}
.dropdown-menu li:last-child a {
    border-bottom: none;
}
.dropdown-menu li a:hover {
    background-color: #f1f1f1;
    color: #007bff;
    text-decoration: none;
}
.dropdown-menu li a i {
    margin-right: 10px;
    color: #888;
}
.dropdown-menu li a:hover i {
    color: #007bff;
}

.search-box {
    display: flex;
    align-items: center;
    margin-left: 25px;
}
.search-box input {
    border: 1px solid #ccc;
    padding: 10px 15px;
    border-radius: 5px 0 0 5px;
    outline: none;
    width: 220px;
    font-size: 0.95em;
}
.search-box button {
    background-color: #007bff;
    color: #fff;
    border: 1px solid #007bff;
    padding: 10px 15px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.search-box button:hover {
    background-color: #0056b3;
}
.user-actions {
    margin-left: 25px;
    display: flex;
    gap: 10px;
}
.user-actions a {
    font-weight: 600;
    font-size: 0.95em;
}
.hamburger-menu {
    display: none; /* Hidden by default on desktop */
    cursor: pointer;
    font-size: 28px;
    color: #333;
    margin-left: 20px;
    line-height: 1;
}

/* Footer Styles */
.footer-main {
    background-color: #212529;
    color: #f8f9fa;
    padding: 60px 0 30px;
    font-size: 0.9em;
    border-top: 8px solid #003366;
}
.footer-main .container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 40px;
}
.footer-section {
    flex: 1;
    min-width: 250px;
    margin-bottom: 30px;
}
.footer-section h3 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.3em;
    display: flex;
    align-items: center;
}
.footer-section h3 i {
    margin-right: 10px;
    color: #007bff;
}
.footer-section p, .footer-section ul {
    color: #adb5bd;
    margin-bottom: 12px;
    line-height: 1.8;
}
.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-section ul li {
    margin-bottom: 10px;
}
.footer-section ul li a {
    color: #adb5bd;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}
.footer-section ul li a i {
    margin-right: 8px;
    font-size: 0.8em;
    color: #6c757d;
}
.footer-section ul li a:hover {
    color: #007bff;
    text-decoration: underline;
}
.footer-section .social-media a {
    color: #fff;
    font-size: 1.8em;
    margin-right: 18px;
    transition: color 0.3s ease, transform 0.3s ease;
}
.footer-section .social-media a:hover {
    color: #007bff;
    transform: translateY(-3px);
}
.footer-section form {
    display: flex;
    margin-top: 15px;
}
.footer-section form input[type="email"] {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #495057;
    border-radius: 5px 0 0 5px;
    background-color: #343a40;
    color: #fff;
    font-size: 0.95em;
}
.footer-section form button {
    padding: 10px 18px;
    background-color: #007bff;
    color: #fff;
    border: 1px solid #007bff;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 0.95em;
}
.footer-section form button:hover {
    background-color: #0056b3;
}
.newsletter-privacy {
    font-size: 0.8em;
    margin-top: 10px;
    color: #6c757d;
}

.footer-bottom {
    background-color: #1a1d20;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid #343a40;
}
.footer-bottom .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.footer-bottom p {
    margin: 0;
    color: #adb5bd;
    font-size: 0.85em;
}
.footer-bottom .legal-links a {
    color: #adb5bd;
    margin-left: 25px;
    font-size: 0.85em;
}
.footer-bottom .legal-links a:hover {
    color: #007bff;
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .header-nav ul li { margin-right: 25px; }
    .search-box input { width: 180px; }
}

@media (max-width: 992px) {
    .header-nav { display: none; }
    .hamburger-menu { display: block; }
    .header-main .container { flex-wrap: wrap; justify-content: space-between; }
    .logo { flex-basis: auto; text-align: left; margin-bottom: 0; }
    .search-box { order: 3; flex-basis: 100%; justify-content: center; margin-top: 15px; margin-left: 0; }
    .user-actions { order: 2; margin-left: auto; gap: 5px; }
    .header-nav.active {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #fff;
        box-shadow: 0 8px 16px rgba(0,0,0,0.15);
        z-index: 999;
        border-top: 1px solid #eee;
    }
    .header-nav.active ul {
        flex-direction: column;
        padding: 10px 0;
    }
    .header-nav.active ul li {
        margin: 0;
        width: 100%;
    }
    .header-nav.active ul li a {
        padding: 12px 25px;
        border-bottom: 1px solid #f1f1f1;
    }
    .header-nav.active ul li:last-child a { border-bottom: none; }
    .header-nav.active .dropdown-menu {
        position: static;
        box-shadow: none;
        border-radius: 0;
        padding-left: 35px;
        border-top: none;
        opacity: 1;
        transform: translateY(0);
        display: block; /* Always show dropdowns in mobile nav when active */
    }
    .header-nav.active .dropdown-menu li a { padding: 8px 0; border-bottom: none; }
    .footer-main .container { flex-direction: column; align-items: center; text-align: center; }
    .footer-section { min-width: unset; width: 100%; }
    .footer-section h3 { justify-content: center; }
    .footer-section form { justify-content: center; }
    .footer-bottom .container { flex-direction: column; text-align: center; }
    .footer-bottom .legal-links { margin-top: 15px; display: flex; flex-wrap: wrap; justify-content: center; }
    .footer-bottom .legal-links a { margin: 5px 10px; }
}

@media (max-width: 768px) {
    h1 { font-size: 2.4em; }
    h2 { font-size: 1.9em; }
    .header-top .container { flex-direction: column; text-align: center; }
    .header-top .top-message { margin-bottom: 8px; }
    .top-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
    .top-links a { margin: 0; }
    .search-box input { width: calc(100% - 80px); max-width: 300px; }
    .user-actions { flex-direction: column; align-items: center; margin-top: 10px; }
    .user-actions a { width: 80%; max-width: 200px; margin-left: 0; }
    .footer-section p, .footer-section ul li { font-size: 0.95em; }
}

@media (max-width: 480px) {
    .logo a { font-size: 1.8em; }
    .logo img { height: 35px; }
    .search-box input { width: calc(100% - 70px); }
    .btn { padding: 0.5rem 1rem; font-size: 0.9rem; }
    .footer-section h3 { font-size: 1.2em; }
    .footer-section .social-media a { font-size: 1.6em; margin-right: 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;
  }
}
