/* Shared CSS for YourCompany Website */

/* --- Base Styles --- */
:root {
    --primary-color: #0056b3;
    --secondary-color: #007bff;
    --accent-color: #28a745;
    --text-color: #333;
    --light-text-color: #f8f9fa;
    --background-color: #f4f7f6;
    --header-bg: #fff;
    --footer-bg: #212529;
    --border-color: #dee2e6;
    --box-shadow-light: 0 2px 4px rgba(0,0,0,0.08);
    --font-family-sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-family-serif: 'Georgia', serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-sans);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

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

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

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

/* --- Header Styles --- */
.main-header {
    background-color: var(--header-bg);
    box-shadow: var(--box-shadow-light);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

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

.logo img {
    height: 40px;
    width: auto;
}

.slogan {
    margin-left: 15px;
    font-size: 1.1em;
    color: #666;
    font-style: italic;
    display: none; /* Hidden by default, shown on larger screens */
}

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

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

.main-nav .nav-link {
    display: block;
    padding: 10px 0;
    color: var(--text-color);
    font-weight: 500;
    font-size: 1.05em;
    position: relative;
}

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

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

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

.dropdown-menu {
    list-style: none;
    margin: 0;
    padding: 10px 0;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--header-bg);
    box-shadow: var(--box-shadow-light);
    min-width: 180px;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    z-index: 1001;
}

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

.dropdown-menu li a {
    display: block;
    padding: 8px 15px;
    color: var(--text-color);
    white-space: nowrap;
}

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

.nav-toggle {
    display: none; /* Hidden by default on desktop */
    background: none;
    border: none;
    font-size: 1.8em;
    cursor: pointer;
    color: var(--text-color);
}

.nav-toggle .icon-bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px 0;
    transition: all 0.3s ease;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

.search-box {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
}

.search-box input {
    border: none;
    padding: 8px 15px;
    outline: none;
    font-size: 0.95em;
    width: 150px;
}

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

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

.btn {
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 600;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    border: 1px solid transparent;
}

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

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

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* --- Main Content Area --- */
main {
    flex-grow: 1; /* Ensures footer sticks to bottom */
    padding: 30px 0;
}

/* --- Footer Styles --- */
.main-footer {
    background-color: var(--footer-bg);
    color: var(--light-text-color);
    padding: 40px 0 20px;
    font-size: 0.9em;
}

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

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

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

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

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

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

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

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

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

.social-links li a {
    font-size: 1.3em;
    color: rgba(255, 255, 255, 0.8);
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.social-links li a:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--light-text-color);
}

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

.contact-info address p i {
    color: var(--accent-color);
    font-size: 1.1em;
}

.newsletter-form {
    display: flex;
    margin-top: 15px;
}

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

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

.newsletter-form .btn-subscribe {
    background-color: var(--accent-color);
    color: var(--light-text-color);
    border: none;
    padding: 10px 20px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.newsletter-form .btn-subscribe:hover {
    background-color: #218838;
}

.privacy-note {
    font-size: 0.8em;
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.7);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    margin-top: 30px;
    text-align: center;
}

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

.copyright {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
}

.legal-links {
    display: flex;
    gap: 20px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.legal-links li a {
    color: rgba(255, 255, 255, 0.7);
}

.legal-links li a:hover {
    color: var(--light-text-color);
}

.back-to-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: var(--light-text-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 1.2em;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 999;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: #004085;
}

/* --- Responsive Adjustments --- */
@media (max-width: 1024px) {
    .main-nav .nav-list {
        gap: 15px;
    }
    .slogan {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-header .container {
        flex-wrap: wrap;
        justify-content: center;
    }

    .branding {
        width: 100%;
        justify-content: center;
        margin-bottom: 15px;
    }

    .nav-toggle {
        display: block;
        order: 1;
        margin-right: 15px;
    }

    .main-nav {
        order: 2;
        width: 100%;
        text-align: center;
    }

    .main-nav .nav-list {
        flex-direction: column;
        width: 100%;
        display: none; /* Hidden by default for mobile */
        background-color: var(--header-bg);
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        border-radius: 5px;
        padding: 10px 0;
        margin-top: 10px;
    }

    .main-nav .nav-list.active {
        display: flex;
    }

    .main-nav .nav-item {
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }

    .main-nav .nav-item:last-child {
        border-bottom: none;
    }

    .main-nav .nav-link {
        padding: 12px 20px;
    }

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

    .dropdown-menu {
        position: static;
        box-shadow: none;
        border-top: 1px solid var(--border-color);
        padding-left: 20px;
        transform: none;
        opacity: 1;
        visibility: visible;
        background-color: #fcfcfc;
        border-radius: 0;
    }

    .header-actions {
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 15px;
        gap: 10px;
    }

    .search-box input {
        width: 100px;
    }

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

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

    .social-links {
        justify-content: center;
    }

    .newsletter-form {
        flex-direction: column;
        align-items: stretch;
    }

    .newsletter-form input[type="email"],
    .newsletter-form .btn-subscribe {
        border-radius: 5px;
        margin-bottom: 10px;
    }

    .footer-bottom .container {
        flex-direction: column;
        gap: 15px;
    }

    .legal-links {
        flex-direction: column;
        gap: 10px;
    }

    .back-to-top {
        bottom: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }

    .search-box {
        width: 100%;
    }
    .search-box input {
        width: calc(100% - 40px);
    }
}

/* 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-width: 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;
  }
}
