/* Basic Reset & Typography */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --accent-color: #28a745;
    --text-color: #333;
    --light-bg: #f8f9fa;
    --dark-bg: #343a40;
    --border-color: #dee2e6;
    --font-family-sans: 'Arial', sans-serif;
    --font-family-serif: 'Georgia', serif;
}

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

html {
    scroll-behavior: smooth;
}

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

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

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

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    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: #fff;
    border-color: var(--primary-color);
}

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

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

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

.btn-subscribe {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    padding: 8px 15px;
    font-size: 0.9rem;
}

.btn-subscribe:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

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

.header-top-bar {
    background-color: var(--dark-bg);
    color: #f8f9fa;
    padding: 8px 0;
    font-size: 0.85rem;
}

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

.top-bar-left .top-link, .top-bar-right .welcome-msg {
    color: #dee2e6;
    margin-right: 15px;
}

.language-selector select {
    background-color: var(--dark-bg);
    color: #f8f9fa;
    border: 1px solid #6c757d;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.header-main-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px;
}

.logo img {
    height: 40px; /* Adjust as needed */
    width: auto;
}

.primary-navigation .nav-list {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.primary-navigation .nav-item {
    position: relative;
    margin: 0 15px;
}

.primary-navigation .nav-link {
    display: block;
    padding: 10px 0;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

.primary-navigation .nav-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.dropdown-menu, .sub-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,.1);
    list-style: none;
    min-width: 200px;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    border-radius: 5px;
    padding: 10px 0;
}

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

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

.dropdown-menu li a:hover, .sub-dropdown-menu li a:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

.sub-dropdown-menu {
    left: 100%;
    top: 0;
}

.menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.menu-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: 20px;
}

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

.search-container input {
    border: none;
    padding: 8px 12px;
    outline: none;
    width: 180px;
}

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

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

.cart-icon {
    position: relative;
    color: var(--text-color);
    font-size: 1.2rem;
    padding: 5px;
}

.cart-icon .cart-count {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: var(--accent-color);
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.75rem;
    line-height: 1;
}

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

.primary-navigation .nav-link.active-nav-link {
    color: var(--primary-color);
    font-weight: bold;
    border-bottom: 2px solid var(--primary-color);
}

/* Footer Styles */
.main-footer {
    background-color: var(--dark-bg);
    color: #dee2e6;
    padding: 40px 0 20px;
    font-size: 0.9rem;
}

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

.footer-col h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 15px;
    position: relative;
}

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

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

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

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

.footer-col ul li a {
    color: #dee2e6;
    transition: color 0.3s ease;
}

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

.social-icons {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.social-icons a {
    color: #fff;
    font-size: 1.3rem;
    width: 35px;
    height: 35px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.social-icons a:hover {
    background-color: var(--primary-color);
    color: #fff;
}

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

.newsletter-signup h4 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 1rem;
}

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

.newsletter-signup input[type="email"] {
    flex-grow: 1;
    padding: 8px 12px;
    border: 1px solid #6c757d;
    border-radius: 5px 0 0 5px;
    background-color: #495057;
    color: #fff;
    outline: none;
}

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

.newsletter-signup .btn-subscribe {
    border-radius: 0 5px 5px 0;
    padding: 8px 15px;
    white-space: nowrap;
}

.footer-bottom {
    border-top: 1px solid #495057;
    padding-top: 20px;
    text-align: center;
}

.footer-bottom p {
    margin-bottom: 5px;
    color: #adb5bd;
}

.footer-bottom a {
    color: #adb5bd;
}

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

.footer-bottom .separator {
    margin: 0 8px;
    color: #6c757d;
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .primary-navigation .nav-list {
        display: none; /* Hide on smaller screens by default */
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #fff;
        box-shadow: 0 4px 8px rgba(0,0,0,.1);
        padding: 10px 0;
        border-top: 1px solid var(--border-color);
    }

    .primary-navigation .nav-list.active {
        display: flex;
    }

    .primary-navigation .nav-item {
        margin: 0;
        border-bottom: 1px solid var(--light-bg);
    }

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

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

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

    .dropdown-menu li a, .sub-dropdown-menu li a {
        padding: 10px 30px;
    }

    .sub-dropdown-menu {
        margin-left: 40px;
    }

    .menu-toggle {
        display: block; /* Show menu toggle on smaller screens */
    }

    .header-main-nav .container {
        flex-wrap: wrap;
    }

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

    .search-container {
        flex-grow: 1;
        max-width: 300px;
    }

    .user-auth {
        display: none; /* Hide login/signup buttons on small screens, can be moved to menu */
    }

    .header-top-bar .container {
        flex-direction: column;
        gap: 5px;
    }

    .top-bar-left, .top-bar-right {
        width: 100%;
        text-align: center;
        display: flex;
        justify-content: center;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .footer-widgets .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-col h3::after {
        margin-left: auto;
        margin-right: auto;
    }

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

    .newsletter-signup form {
        flex-direction: column;
        gap: 10px;
    }

    .newsletter-signup input[type="email"] {
        border-radius: 5px;
    }

    .newsletter-signup .btn-subscribe {
        border-radius: 5px;
        width: 100%;
    }
}

/* Font Awesome for icons */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
