/* Basic Reset & Global Styles */
:root {
    --primary-color: #007bff; /* Blue */
    --secondary-color: #6c757d; /* Gray */
    --accent-color: #28a745; /* Green */
    --text-color: #343a40; /* Darker text */
    --light-bg: #f8f9fa;
    --dark-bg: #212529;
    --border-color: #dee2e6;
    --font-family-base: 'Arial', sans-serif;
    --font-family-heading: 'Helvetica Neue', sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-family-base);
    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 20px;
}

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

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

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 0.5em;
}

/* Header Styles */
.main-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1000;
}

.header-top-bar {
    background-color: var(--dark-bg);
    color: #e9ecef;
    padding: 10px 0;
    font-size: 0.8em;
}

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

.top-bar-left a, .top-bar-right a, .language-selector select {
    color: #e9ecef;
    margin-right: 18px;
    transition: color 0.3s ease;
}

.top-bar-left a:hover, .top-bar-right a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.language-selector select {
    background: var(--dark-bg);
    border: 1px solid #495057;
    padding: 5px 8px;
    border-radius: 5px;
    color: #e9ecef;
    appearance: none;
    cursor: pointer;
}

.header-main-nav {
    padding: 15px 0;
}

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

.logo img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.primary-navigation {
    flex-grow: 1;
    text-align: center;
    margin: 0 20px;
}

.primary-navigation .nav-list {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.primary-navigation .nav-link {
    color: var(--text-color);
    font-weight: 600;
    padding: 10px 0;
    display: block;
    position: relative;
}

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

.primary-navigation .nav-link:hover::after {
    width: 100%;
}

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

.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    z-index: 1001;
    min-width: 200px;
    padding: 10px 0;
    border-radius: 6px;
    top: 100%; /* Position below the parent link */
    left: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.dropdown:hover .dropdown-menu, .dropdown-toggle[aria-expanded="true"] + .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

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

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

.search-box {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.search-box:focus-within {
    border-color: var(--primary-color);
}

.search-box input {
    border: none;
    padding: 10px 18px;
    outline: none;
    width: 180px;
    font-size: 0.9em;
}

.search-box button {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s ease;
}

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

.cart-icon {
    position: relative;
    font-size: 1.5em;
    color: var(--text-color);
}

.cart-count {
    background-color: #dc3545;
    color: #fff;
    border-radius: 50%;
    padding: 3px 8px;
    font-size: 0.75em;
    position: absolute;
    top: -10px;
    right: -10px;
    min-width: 20px;
    text-align: center;
    line-height: 1;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-profile .avatar {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.user-profile .username {
    font-weight: 600;
    color: var(--text-color);
}

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

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

/* Footer Styles */
.main-footer {
    background-color: var(--dark-bg);
    color: #e9ecef;
    padding: 50px 0 25px;
    font-size: 0.9em;
    margin-top: 40px;
}

.footer-widgets {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 30px;
}

.footer-col {
    flex: 1;
    min-width: 280px;
    margin-bottom: 30px;
    padding-right: 25px;
}

.footer-col:last-child {
    padding-right: 0;
}

.footer-col .widget-title {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: bold;
    border-bottom: 2px solid rgba(255,255,255,0.15);
    padding-bottom: 10px;
}

.footer-col p, .footer-col address {
    margin-bottom: 12px;
    line-height: 1.8;
}

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

.footer-col a:hover {
    color: #fff;
    text-decoration: underline;
}

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

.social-links a {
    display: inline-block;
    color: #fff;
    font-size: 1.6em;
    margin-right: 20px;
    transition: transform 0.3s ease-in-out, color 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-5px);
    text-decoration: none;
}

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

.newsletter-form input[type="email"] {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid #495057;
    border-radius: 5px 0 0 5px;
    background-color: #343a40;
    color: #fff;
    outline: none;
    font-size: 0.9em;
}

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

.newsletter-form .subscribe-btn {
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

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

.payment-methods, .certifications {
    margin-top: 30px;
}

.payment-methods img, .certifications img {
    margin-right: 12px;
    margin-bottom: 8px;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.payment-methods img:hover, .certifications img:hover {
    opacity: 1;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 25px;
    text-align: center;
    font-size: 0.85em;
}

.footer-bottom .copyright, .footer-bottom .powered-by {
    margin-bottom: 10px;
    color: #adb5bd;
}

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

/* Responsive adjustments */
@media (max-width: 1024px) {
    .primary-navigation .nav-list {
        gap: 20px;
    }
    .header-actions {
        gap: 20px;
    }
    .footer-col {
        min-width: 220px;
    }
}

@media (max-width: 992px) {
    .header-main-nav .container {
        flex-wrap: wrap;
    }
    .primary-navigation {
        order: 3; /* Move navigation below logo and actions */
        flex-basis: 100%;
        margin-top: 15px;
    }
    .primary-navigation .nav-list {
        justify-content: flex-start;
        gap: 15px;
    }
    .header-actions {
        order: 2;
        margin-left: auto;
    }
    .search-box input {
        width: 120px;
    }
    .footer-col {
        flex: 0 0 48%; /* Two columns */
        padding-right: 15px;
    }
    .footer-col:nth-child(2n) {
        padding-right: 0;
    }
}

@media (max-width: 768px) {
    .header-top-bar .container {
        flex-direction: column;
        text-align: center;
    }
    .top-bar-left, .top-bar-right {
        margin-bottom: 10px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .top-bar-left a, .top-bar-right a, .language-selector select {
        margin-right: 0;
    }
    .header-main-nav .container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .logo {
        order: 1;
    }
    .menu-toggle {
        display: block;
        order: 2;
    }
    .header-actions {
        order: 3;
        flex-basis: 100%;
        justify-content: space-around;
        margin-top: 15px;
        gap: 10px;
    }
    .search-box {
        flex-grow: 1;
        width: auto;
    }
    .search-box input {
        width: 100%;
    }
    .primary-navigation {
        order: 4;
        flex-basis: 100%;
        margin-top: 0;
    }
    .primary-navigation .nav-list {
        flex-direction: column;
        display: none; /* Hidden by default for mobile */
        text-align: left;
        width: 100%;
        background-color: #fff;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
        position: absolute;
        left: 0;
        right: 0;
        top: 100%; /* Position below the header main nav */
    }
    .primary-navigation .nav-list.active {
        display: flex;
    }
    .primary-navigation .nav-item {
        border-bottom: 1px solid var(--border-color);
    }
    .primary-navigation .nav-item:last-child {
        border-bottom: none;
    }
    .primary-navigation .nav-link {
        padding: 12px 20px;
    }
    .dropdown-menu {
        position: static;
        box-shadow: none;
        border-radius: 0;
        padding: 0 0 0 20px;
        background-color: var(--light-bg);
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    .dropdown-menu li a {
        padding: 8px 20px;
    }
    .footer-widgets {
        flex-direction: column;
    }
    .footer-col {
        min-width: 100%;
        padding-right: 0;
    }
    .footer-bottom .copyright, .footer-bottom .powered-by {
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    .search-box {
        width: 100%;
        margin-bottom: 10px;
    }
    .user-profile {
        margin-left: auto;
        margin-right: auto;
    }
    .footer-col {
        text-align: center;
    }
    .footer-col .widget-title {
        text-align: center;
    }
    .social-links {
        text-align: center;
    }
    .newsletter-form {
        flex-direction: column;
        align-items: stretch;
    }
    .newsletter-form input[type="email"] {
        border-radius: 5px;
        margin-bottom: 10px;
    }
    .newsletter-form .subscribe-btn {
        border-radius: 5px;
    }
}
/* 移动端内容区防溢出（系统追加，请勿删除） */
@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;
  }
}
