/* shared_css.css - 全局共享样式 */
:root {
    --primary-color: #007bff; /* 主色调，蓝色 */
    --secondary-color: #6c757d; /* 次要色调，灰色 */
    --accent-color: #28a745; /* 强调色，绿色 */
    --text-color: #343a40; /* 主要文本颜色 */
    --light-text-color: #6c757d; /* 辅助文本颜色 */
    --background-color: #f8f9fa; /* 页面背景色 */
    --card-background: #ffffff; /* 卡片背景色 */
    --border-color: #dee2e6; /* 边框颜色 */
    --link-color: #007bff;
    --link-hover-color: #0056b3;
    --font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;
    --border-radius: 0.25rem;
    --spacing-unit: 1rem; /* 16px */
    --header-height-desktop: 80px;
    --footer-height-min: 200px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    color: var(--text-color);
    background-color: var(--background-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    line-height: 1.2;
}

p {
    margin-top: 0;
    margin-bottom: var(--spacing-unit);
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

button, input[type="submit"], .btn {
    cursor: pointer;
    border: 1px solid transparent;
    padding: 0.6rem 1.2rem;
    font-size: var(--font-size-base);
    border-radius: var(--border-radius);
    transition: all 0.2s ease-in-out;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--link-hover-color);
    border-color: var(--link-hover-color);
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: #fff;
    border-color: var(--secondary-color);
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
    text-decoration: none;
}

input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    color: var(--text-color);
    background-color: var(--card-background);
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, input[type="search"]:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Accessibility: Screen reader text */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Header styles */
.site-header {
    background-color: var(--card-background);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: var(--header-height-desktop);
}

.header-top-bar {
    background-color: #e9ecef;
    padding: 0.5rem 0;
    font-size: 0.85em;
    color: var(--light-text-color);
}

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

.top-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.top-nav ul li {
    margin-right: var(--spacing-unit);
}

.top-nav ul li:last-child {
    margin-right: 0;
}

.top-nav a {
    color: var(--light-text-color);
}

.top-nav a:hover {
    color: var(--primary-color);
}

.language-selector select {
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.6rem;
    border-radius: var(--border-radius);
    background-color: var(--card-background);
    font-size: 0.9em;
}

.header-main {
    padding: calc(var(--spacing-unit) * 0.75) 0;
}

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

.branding {
    display: flex;
    align-items: center;
}

.branding .logo img {
    display: block;
    max-height: 40px;
    width: auto;
}

.branding .tagline {
    margin-left: calc(var(--spacing-unit) * 0.75);
    font-size: 1.1em;
    color: var(--light-text-color);
    white-space: nowrap;
}

.main-navigation {
    flex-grow: 1;
    text-align: center;
}

.main-navigation .menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
}

.main-navigation .menu > li {
    position: relative;
    margin: 0 var(--spacing-unit);
}

.main-navigation .menu > li > a {
    display: block;
    padding: 0.8rem 0;
    font-weight: bold;
    color: var(--text-color);
}

.main-navigation .menu > li > a:hover,
.main-navigation .menu > li.current-menu-item > a {
    color: var(--primary-color);
    text-decoration: none;
}

.main-navigation .sub-menu {
    display: none;
    position: absolute;
    background-color: var(--card-background);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    min-width: 12rem;
    z-index: 10;
    border-radius: var(--border-radius);
    text-align: left;
    left: 0;
    top: 100%;
}

.main-navigation .menu > li:hover > .sub-menu,
.main-navigation .menu > li.menu-item-hover > .sub-menu {
    display: block;
}

.main-navigation .sub-menu li a {
    padding: 0.5rem 1rem;
    display: block;
    color: var(--text-color);
    white-space: nowrap;
}

.main-navigation .sub-menu li a:hover {
    background-color: var(--background-color);
    color: var(--primary-color);
}

.menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-color);
    order: 2; /* To appear after branding on mobile */
}

.menu-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-color);
    margin: 4px 0;
}

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

.search-form {
    display: flex;
    margin-right: var(--spacing-unit);
}

.search-form input[type="search"] {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex-grow: 1;
}

.search-form button {
    background-color: var(--primary-color);
    color: #fff;
    border: 1px solid var(--primary-color);
    padding: 0.6rem 0.8rem;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    white-space: nowrap;
}

.search-form button:hover {
    background-color: var(--link-hover-color);
    border-color: var(--link-hover-color);
}

/* Footer styles */
.site-footer {
    background-color: #212529; /* 深灰色背景 */
    color: #f8f9fa;
    padding: calc(var(--spacing-unit) * 2.5) 0 calc(var(--spacing-unit) * 1.25);
    font-size: 0.9em;
    min-height: var(--footer-height-min);
}

.footer-widgets {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: calc(var(--spacing-unit) * 2);
    gap: var(--spacing-unit);
}

.footer-widget {
    flex: 1;
    min-width: 250px;
    margin-bottom: var(--spacing-unit);
}

.footer-widget h3 {
    color: #fff;
    font-size: 1.2em;
    margin-bottom: var(--spacing-unit);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: calc(var(--spacing-unit) * 0.5);
}

.footer-widget p {
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    color: #ced4da;
}

.footer-widget address p {
    margin-bottom: calc(var(--spacing-unit) * 0.5);
}

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

.footer-widget ul li {
    margin-bottom: 0.5rem;
}

.footer-widget ul li a {
    color: #ced4da;
}

.footer-widget ul li a:hover {
    color: #fff;
    text-decoration: underline;
}

.social-links {
    margin-top: var(--spacing-unit);
    display: flex;
    gap: 0.8rem;
}

.social-links a img {
    width: 28px;
    height: 28px;
    vertical-align: middle;
    transition: transform 0.2s ease-in-out;
}

.social-links a:hover img {
    transform: translateY(-2px);
}

.newsletter-form {
    display: flex;
    margin-top: var(--spacing-unit);
}

.newsletter-form input[type="email"] {
    border: 1px solid #495057;
    padding: 0.6rem 0.8rem;
    border-radius: var(--border-radius);
    background-color: #343a40;
    color: #fff;
    flex-grow: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.newsletter-form button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding: 0.6rem 1rem;
}

.newsletter-disclaimer {
    font-size: 0.8em;
    color: #adb5bd;
    margin-top: 0.5rem;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: calc(var(--spacing-unit) * 1.25);
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-unit);
}

.footer-bottom p {
    margin: 0;
    color: #ced4da;
    flex-grow: 1;
    text-align: left;
}

.footer-legal-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.footer-legal-nav ul li {
    margin-left: var(--spacing-unit);
}

.footer-legal-nav ul li a {
    color: #ced4da;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .main-navigation .menu > li {
        margin: 0 0.8rem;
    }
    .branding .tagline {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-top-bar .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .top-nav ul {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .top-nav ul li {
        margin-right: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .header-main .container {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-unit);
    }

    .branding {
        width: 100%;
        justify-content: space-between;
    }

    .main-navigation {
        width: 100%;
        text-align: left;
        order: 3; /* Below branding and actions */
    }

    .main-navigation .menu {
        flex-direction: column;
        display: none; /* Hidden by default for mobile */
        width: 100%;
        border-top: 1px solid var(--border-color);
        margin-top: var(--spacing-unit);
    }

    .main-navigation .menu.active {
        display: flex;
    }

    .main-navigation .menu > li {
        margin: 0;
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .main-navigation .menu > li:last-child {
        border-bottom: none;
    }

    .main-navigation .menu > li > a {
        padding: 0.8rem var(--spacing-unit);
    }

    .main-navigation .sub-menu {
        position: static;
        box-shadow: none;
        background-color: var(--background-color);
        padding-left: calc(var(--spacing-unit) * 1.5);
        border-top: 1px solid var(--border-color);
        border-radius: 0;
        min-width: auto;
    }

    .main-navigation .sub-menu li a {
        padding: 0.6rem var(--spacing-unit);
    }

    .menu-toggle {
        display: block;
        align-self: center;
        order: 2; /* Next to branding */
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        order: 4; /* After main nav on mobile */
    }

    .search-form {
        flex-grow: 1;
        margin-right: 0.5rem;
    }

    .footer-widgets {
        flex-direction: column;
        gap: calc(var(--spacing-unit) * 1.5);
    }

    .footer-widget {
        margin-right: 0;
        width: 100%;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 0.8rem;
    }

    .footer-bottom p {
        text-align: center;
    }

    .footer-legal-nav ul {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
    }

    .footer-legal-nav ul li {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }
    .search-form {
        margin-right: 0;
    }
    .search-form input[type="search"],
    .search-form button,
    .btn {
        width: 100%;
        border-radius: var(--border-radius);
    }
    .search-form input[type="search"] {
        border-bottom-right-radius: 0;
        border-top-right-radius: 0;
    }
    .search-form button {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
    .newsletter-form {
        flex-direction: column;
        gap: 0.5rem;
    }
    .newsletter-form input[type="email"],
    .newsletter-form button {
        width: 100%;
        border-radius: var(--border-radius);
    }
    .newsletter-form input[type="email"] {
        border-bottom-right-radius: 0;
        border-top-right-radius: 0;
    }
    .newsletter-form button {
        border-top-left-radius: 0;
        border-bottom-left-radius: 0;
    }
    .header-actions .btn {
        margin-top: 0.5rem;
    }
    .header-actions .btn:first-of-type {
        margin-top: 0;
    }
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
