/* shared.css */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --accent-color: #28a745;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --text-color: #333;
    --light-text-color: #f0f0f0;
    --border-color: #dee2e6;
    --box-shadow-light: 0 4px 8px rgba(0, 0, 0, 0.1);
    --box-shadow-dark: 0 6px 12px rgba(0, 0, 0, 0.2);
    --font-family-base: 'Roboto', sans-serif;
    --header-height: 80px;
    --top-bar-height: 40px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-base);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.2s ease;
}

a:hover {
    color: var(--dark-color);
    text-decoration: underline;
    transform: translateY(-1px);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    border: none;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background-color: #0056b3;
    color: var(--light-text-color);
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background-color: #5a6268;
    color: var(--light-text-color);
    transform: translateY(-2px);
}

.btn-hero {
    background-color: var(--accent-color);
    color: var(--light-text-color);
    padding: 12px 25px;
    font-size: 1.1rem;
    border-radius: 30px;
}

.btn-hero:hover {
    background-color: #218838;
    transform: translateY(-3px);
    box-shadow: var(--box-shadow-dark);
}

.btn-subscribe {
    background-color: var(--primary-color);
    color: var(--light-text-color);
    padding: 10px 15px;
    border-radius: 0 5px 5px 0;
    margin-left: -1px;
}

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

/* Header styles */
.site-header {
    background-color: var(--dark-color);
    color: var(--light-text-color);
    box-shadow: var(--box-shadow-light);
    position: relative; /* For hero section positioning */
}

.header-top-bar {
    background-color: #2c3136;
    padding: 10px 0;
    font-size: 0.9em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.header-top-bar .welcome-message {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
}

.header-top-bar .top-bar-links a {
    color: rgba(255, 255, 255, 0.7);
    margin-left: 20px;
}

.header-top-bar .top-bar-links a:hover {
    color: var(--light-color);
    text-decoration: none;
}

.main-navigation {
    padding: 15px 0;
    background-color: var(--dark-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.brand-logo {
    display: flex;
    align-items: center;
    color: var(--light-text-color);
    font-size: 1.8rem;
    font-weight: 700;
    text-decoration: none;
}

.brand-logo:hover {
    text-decoration: none;
    color: var(--light-color);
}

.brand-logo .logo-img {
    height: 40px;
    margin-right: 10px;
    filter: invert(1); /* Adjust if logo is already light */
}

.menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--light-text-color);
    cursor: pointer;
}

.nav-menu {
    display: flex;
    gap: 25px;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: var(--light-text-color);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

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

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

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #3f464d;
    min-width: 200px;
    box-shadow: var(--box-shadow-dark);
    border-radius: 5px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 10;
}

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

.dropdown-menu li a {
    display: block;
    padding: 10px 15px;
    color: var(--light-text-color);
    white-space: nowrap;
    transition: background-color 0.3s ease;
}

.dropdown-menu li a:hover {
    background-color: var(--primary-color);
    text-decoration: none;
    color: var(--light-text-color);
}

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

.search-box {
    display: flex;
    border-radius: 5px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1);
}

.search-box input[type="search"] {
    border: none;
    padding: 8px 12px;
    background: transparent;
    color: var(--light-text-color);
    outline: none;
    width: 150px;
}

.search-box input[type="search"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-box button {
    background-color: var(--primary-color);
    border: none;
    padding: 8px 12px;
    color: var(--light-text-color);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-box button:hover {
    background-color: #0056b3;
}

.user-area .btn {
    margin-left: 10px;
}

.theme-toggle-btn {
    background: none;
    border: none;
    color: var(--light-text-color);
    font-size: 1.3rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.theme-toggle-btn:hover {
    color: var(--primary-color);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('/static/images/hero-bg.jpg') no-repeat center center/cover;
    text-align: center;
    padding: 100px 0;
    color: var(--light-text-color);
}

.hero-section h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-section p {
    font-size: 1.3rem;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
}

/* Footer styles */
.site-footer {
    background-color: var(--dark-color);
    color: var(--light-text-color);
    padding: 60px 0 30px;
    font-size: 0.95em;
    position: relative;
}

.site-footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

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

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

.footer-col h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 40px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer-col ul {
    padding: 0;
    margin: 0;
}

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

.footer-col ul li a {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s ease;
}

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

.footer-col .about-us .footer-logo {
    display: flex;
    align-items: center;
    color: var(--light-text-color);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.footer-col .about-us .footer-logo .logo-img {
    height: 35px;
    margin-right: 10px;
    filter: invert(1);
}

.footer-col .about-us p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
    line-height: 1.8;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-links a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--light-text-color);
    font-size: 1.1rem;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px) scale(1.05);
    color: var(--light-color);
}

.footer-col.contact-info p {
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
}

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

.footer-col.contact-info p a {
    color: rgba(255, 255, 255, 0.7);
}

.footer-col.contact-info p a:hover {
    color: var(--light-color);
}

.newsletter-signup {
    margin-top: 25px;
}

.newsletter-signup h4 {
    color: var(--light-text-color);
    margin-bottom: 15px;
}

.newsletter-signup form {
    display: flex;
}

.newsletter-signup input[type="email"] {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 5px 0 0 5px;
    outline: none;
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--light-text-color);
}

.newsletter-signup input[type="email"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 25px;
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-bottom .copyright {
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom .legal-links {
    display: flex;
    gap: 20px;
}

.footer-bottom .legal-links a {
    color: rgba(255, 255, 255, 0.6);
}

.footer-bottom .legal-links a:hover {
    color: var(--light-color);
    text-decoration: underline;
}

#backToTopBtn {
    display: none; /* Hidden by default */
    position: fixed; /* Fixed/sticky position */
    bottom: 30px; /* Place the button at the bottom of the page */
    right: 30px; /* Place the button at the right */
    z-index: 99; /* Make sure it does not overlap */
    border: none; /* Remove borders */
    outline: none; /* Remove outline */
    background-color: var(--primary-color); /* Set a background color */
    color: white; /* Text color */
    cursor: pointer; /* Add a mouse pointer on hover */
    padding: 15px; /* Some padding */
    border-radius: 50%; /* Rounded corners */
    font-size: 18px; /* Increase font size */
    box-shadow: var(--box-shadow-dark);
    transition: background-color 0.3s, transform 0.3s;
}

#backToTopBtn:hover {
    background-color: #0056b3;
    transform: translateY(-3px);
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .main-navigation .nav-menu {
        display: none; /* Hide menu by default on smaller screens */
        flex-direction: column;
        width: 100%;
        background-color: #3f464d;
        position: absolute;
        top: calc(var(--header-height) + var(--top-bar-height) - 15px); /* Adjust based on header height */
        left: 0;
        padding: 15px 0;
        box-shadow: var(--box-shadow-dark);
        z-index: 999;
    }

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

    .main-navigation .nav-menu .nav-item {
        margin: 0;
        text-align: center;
    }

    .main-navigation .nav-menu .nav-link {
        display: block;
        padding: 12px 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .main-navigation .nav-menu .nav-link::after {
        display: none;
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        background-color: #4a5158;
        box-shadow: none;
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        border-radius: 0;
        margin-top: 0;
        padding-left: 20px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease-out;
    }

    .nav-item.dropdown.active .dropdown-menu {
        max-height: 500px; /* Arbitrary large value */
        transition: max-height 0.5s ease-in;
    }

    .menu-toggle {
        display: block; /* Show menu toggle button */
    }

    .header-actions {
        width: 100%;
        justify-content: center;
        margin-top: 15px;
        flex-wrap: wrap;
        gap: 15px;
    }

    .search-box {
        width: 100%;
        max-width: 300px;
    }

    .search-box input[type="search"] {
        width: calc(100% - 40px); /* Adjust for button width */
    }

    .hero-section h1 {
        font-size: 2.5rem;
    }

    .hero-section p {
        font-size: 1.1rem;
    }

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

    .footer-bottom .legal-links {
        margin-top: 10px;
    }
}

@media (max-width: 768px) {
    .header-top-bar .container {
        flex-direction: column;
        text-align: center;
    }

    .header-top-bar .welcome-message {
        margin-bottom: 10px;
    }

    .header-top-bar .top-bar-links a {
        margin: 0 10px;
    }

    .main-navigation .container {
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .brand-logo {
        font-size: 1.5rem;
    }

    .brand-logo .logo-img {
        height: 35px;
    }

    .header-actions {
        order: 3; /* Move actions below logo and toggle */
        margin-top: 20px;
        width: 100%;
        justify-content: center;
        gap: 10px;
    }

    .user-area .btn {
        margin-left: 5px;
        margin-right: 5px;
    }

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

    .footer-col h3::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .social-links {
        justify-content: center;
    }
    .newsletter-signup form {
        justify-content: center;
    }
    .newsletter-signup input[type="email"] {
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: 60px 0;
    }
    .hero-section h1 {
        font-size: 2rem;
    }
    .hero-section p {
        font-size: 1rem;
    }
    .btn-hero {
        padding: 10px 20px;
        font-size: 1rem;
    }
    .search-box {
        width: 90%;
    }
    .header-actions {
        flex-direction: column;
    }
    .user-area {
        display: flex;
        width: 100%;
        justify-content: center;
    }
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
