/* shared_styles.css */

/* Basic Resets & Global Styles */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --accent-color: #28a745;
    --text-color: #333;
    --light-text-color: #f8f9fa;
    --background-color: #ffffff;
    --light-background-color: #f4f7f6;
    --border-color: #dee2e6;
    --header-height: 70px;
    --topbar-height: 40px;
    --footer-bg: #212529;
    --footer-text: #adb5bd;
    --font-family-base: 'Noto Sans SC', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

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

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

body {
    font-family: var(--font-family-base);
    color: var(--text-color);
    background-color: var(--light-background-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Layout Wrapper */
.wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* Links */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

a:hover {
    color: darken(var(--primary-color), 10%);
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-primary {
    color: var(--light-text-color);
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: darken(var(--primary-color), 10%);
    border-color: darken(var(--primary-color), 10%);
}

.btn-search {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--light-text-color);
}
.btn-search:hover {
    background-color: darken(var(--accent-color), 10%);
    border-color: darken(var(--accent-color), 10%);
}

.btn-subscribe {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--light-text-color);
    padding: 8px 15px;
    font-size: 0.9rem;
}
.btn-subscribe:hover {
    background-color: darken(var(--primary-color), 10%);
    border-color: darken(var(--primary-color), 10%);
}

/* Header Styles */
#main-header {
    background-color: var(--background-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-topbar {
    background-color: var(--footer-bg); /* Using a darker color for topbar */
    color: var(--footer-text);
    height: var(--topbar-height);
    font-size: 0.85rem;
    line-height: var(--topbar-height);
}

.header-topbar .wrapper {
    justify-content: space-between;
}

.topbar-left span {
    margin-right: 20px;
}

.topbar-link {
    color: var(--footer-text);
    margin-left: 15px;
}
.topbar-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.language-selector {
    display: inline-block;
    margin-left: 15px;
}
.language-selector select {
    background-color: transparent;
    border: none;
    color: var(--footer-text);
    font-size: 0.85rem;
    padding: 2px 5px;
    cursor: pointer;
    outline: none;
}
.language-selector select option {
    color: var(--text-color);
    background-color: var(--background-color);
}
.language-selector .fa-globe {
    margin-right: 5px;
}

.header-main {
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
}

.logo img {
    margin-right: 10px;
    max-height: 40px;
    width: auto;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.main-navigation ul li {
    position: relative;
    margin-left: 30px;
}

.main-navigation ul li a {
    display: block;
    padding: 10px 0;
    color: var(--text-color);
    font-weight: 500;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

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

.main-navigation ul li a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 5px;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.main-navigation ul li a:hover::after {
    width: 100%;
}

.main-navigation .has-submenu > a .fa-chevron-down {
    font-size: 0.7em;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.main-navigation .has-submenu:hover > a .fa-chevron-down {
    transform: rotate(180deg);
}

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--background-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    min-width: 180px;
    z-index: 1001;
    border-top: 3px solid var(--primary-color);
    padding: 10px 0;
    list-style: none;
}

.main-navigation .has-submenu:hover .submenu {
    display: block;
}

.submenu li {
    margin: 0;
}

.submenu li a {
    padding: 10px 20px;
    white-space: nowrap;
    font-weight: 400;
    color: var(--text-color);
}

.submenu li a:hover {
    background-color: var(--light-background-color);
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    margin-left: auto; /* Pushes actions to the right */
}

.header-actions .btn {
    margin-left: 20px;
}

.search-toggle, .menu-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 5px;
    margin-left: 15px;
    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;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.search-form-wrapper {
    background-color: var(--background-color);
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    display: flex;
    align-items: center;
    position: relative;
}

.search-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    margin-right: 10px;
}

.close-search {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--secondary-color);
    cursor: pointer;
}

/* Main Content */
#main-content {
    flex-grow: 1; /* Ensures main content takes up available space */
    padding: 20px 0;
}

/* Footer Styles */
#main-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 40px 0 20px;
    margin-top: auto; /* Pushes footer to the bottom */
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
    align-items: flex-start; /* Align items at the start of the grid cell */
}

.footer-widget h3 {
    color: var(--light-text-color);
    font-size: 1.2rem;
    margin-bottom: 20px;
    position: relative;
}

.footer-widget h3::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background-color: var(--primary-color);
    margin-top: 10px;
}

.footer-widget p {
    font-size: 0.95rem;
    margin-bottom: 15px;
}

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

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

.footer-widget ul li a {
    color: var(--footer-text);
    transition: color 0.3s ease;
}

.footer-widget ul li a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.social-links a {
    color: var(--footer-text);
    font-size: 1.5rem;
    margin-right: 15px;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-color);
}

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

.contact-info p i {
    margin-right: 10px;
    color: var(--primary-color);
}

.newsletter-signup h4 {
    color: var(--light-text-color);
    font-size: 1rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

.newsletter-signup form {
    display: flex;
}

.newsletter-signup input[type="email"] {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid #495057;
    border-radius: 4px 0 0 4px;
    background-color: #343a40;
    color: var(--light-text-color);
    font-size: 0.9rem;
    outline: none;
}

.newsletter-signup input[type="email"]::placeholder {
    color: #ced4da;
}

.newsletter-signup button {
    border-radius: 0 4px 4px 0;
    border: 1px solid var(--primary-color);
    padding: 8px 15px;
    background-color: var(--primary-color);
    color: var(--light-text-color);
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.newsletter-signup button:hover {
    background-color: darken(var(--primary-color), 10%);
    border-color: darken(var(--primary-color), 10%);
}

.footer-bottom {
    border-top: 1px solid #343a40;
    padding-top: 20px;
    text-align: center;
    font-size: 0.85rem;
}

.footer-bottom .copyright,
.footer-bottom .icp-license {
    margin-bottom: 5px;
}

.footer-bottom a {
    color: var(--primary-color);
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .main-navigation {
        display: none; /* Hide main navigation on smaller screens */
    }
    .header-actions .btn-primary {
        display: none; /* Hide customer center button */
    }
    .search-toggle, .menu-toggle {
        display: block; /* Show menu and search toggles */
    }
    .header-main .wrapper {
        justify-content: space-between;
    }
    .logo {
        flex-grow: 1;
    }
    .header-actions {
        margin-left: 0;
    }
    .footer-widgets {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .footer-widget h3::after {
        margin-left: auto;
        margin-right: auto;
    }
    .social-links {
        justify-content: center;
        display: flex;
        margin-bottom: 15px;
    }
    .contact-info p {
        justify-content: center;
    }
    .newsletter-signup form {
        max-width: 300px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .header-topbar {
        display: none; /* Hide topbar on very small screens */
    }
    .header-main {
        height: var(--header-height);
    }
    .logo img {
        width: 150px;
        height: auto;
    }
    .logo h1 {
        font-size: 1.5rem;
    }
    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 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;
  }
}
