/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
    /* 页面加载动画 */
    opacity: 0;
    transition: opacity 0.5s ease;
}

body.loaded {
    opacity: 1;
}

/* 页面容器 */
.page-container {
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 导航栏样式 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* 导航栏滚动效果 */
.header.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.navbar {
    padding: 1rem 0;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* 品牌标识 */
.brand a {
    font-size: 1.8rem;
    font-weight: 700;
    color: #222;
    text-decoration: none;
}

/* 导航链接 */
.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: #555;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #000;
}

/* 用户操作按钮 */
.user-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.action-btn {
    color: #555;
    text-decoration: none;
    font-size: 1.1rem;
    position: relative;
    transition: color 0.3s ease;
}

.action-btn:hover {
    color: #000;
}

.cart-count {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: #000;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 50%;
    min-width: 20px;
    text-align: center;
}

/* 语言切换按钮 */
.lang-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.lang-btn:hover {
    background-color: #000;
    transform: scale(1.05);
}

.lang-btn .lang-en,
.lang-btn .lang-zh {
    display: block;
    transition: opacity 0.3s ease;
}

/* 语言元素的隐藏类样式 - 确保只显示一种语言 */
.hidden, .lang-zh.hidden, .lang-en.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* 确保只有非隐藏的语言元素可见 */
.lang-en:not(.hidden), .lang-zh:not(.hidden) {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 屏幕阅读器专用文本（不可见但可访问） */
.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;
}

/* 汉堡菜单 */
.menu-toggle {
    display: none;
    cursor: pointer;
    position: relative;
    width: 30px;
    height: 24px;
    transition: transform 0.3s ease;
}

.bar {
    display: block;
    width: 100%;
    height: 3px;
    margin: 5px auto;
    background-color: #333;
    transition: all 0.3s ease;
}

/* 汉堡菜单动画 */
.bar:nth-child(1).active {
    transform: rotate(45deg) translate(5px, 8px);
}

.bar:nth-child(2).active {
    opacity: 0;
}

.bar:nth-child(3).active {
    transform: rotate(-45deg) translate(5px, -8px);
}

/* 主内容区域 */
.main-content {
    flex: 1;
    padding: 2rem;
}

/* 页面标题 */
.page-title {
    margin-bottom: 2rem;
    text-align: center;
}

.page-title h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #222;
}

/* 筛选区域 */
.filters-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 3rem;
    align-items: flex-start;
}

/* 筛选组 */
.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 1rem;
}

/* 筛选选项 */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.filter-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    padding-left: 28px;
    user-select: none;
    color: #555;
}

.filter-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.filter-option:hover input ~ .checkmark {
    border-color: #999;
}

.filter-option input:checked ~ .checkmark {
    background-color: #000;
    border-color: #000;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.filter-option input:checked ~ .checkmark:after {
    display: block;
}

.filter-option input:checked {
    animation: checkboxChecked 0.3s ease;
}

@keyframes checkboxChecked {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.filter-option .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}

.filter-text {
    font-size: 1rem;
}

/* 价格范围 */
.price-range {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.price-inputs {
    display: flex;
    gap: 1rem;
}

.price-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.price-field label {
    font-size: 0.9rem;
    color: #555;
}

.price-field input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.price-field input:focus {
    outline: none;
    border-color: #000;
}

/* 应用筛选按钮 */
.apply-filter-btn {
    background-color: #333;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    align-self: flex-start;
}

.apply-filter-btn:hover {
    background-color: #000;
}

.apply-filter-btn.clicked {
    transform: scale(0.98);
}

/* 排序选项 */
.sort-options {
    width: 100%;
}

.sort-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease, transform 0.1s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.sort-select:focus {
    outline: none;
    border-color: #000;
}

.sort-select.changed {
    border-color: #000;
    animation: sortSelectChanged 0.3s ease;
}

@keyframes sortSelectChanged {
    0% {
        border-color: #ddd;
    }
    50% {
        border-color: #000;
        transform: scale(1.02);
    }
    100% {
        border-color: #000;
    }
}

/* 重置筛选按钮 */
.reset-filter-btn {
    background-color: #f2f2f2;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reset-filter-btn:hover {
    background-color: #e0e0e0;
    border-color: #999;
}

.reset-filter-btn.resetting {
    animation: resetButtonPulse 0.5s ease;
}

@keyframes resetButtonPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        background-color: #e0e0e0;
    }
}

/* 产品网格 */
.products-section {
    margin-bottom: 3rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

/* 产品卡片样式 */
.product-card {
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* 产品卡片悬停效果 */
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* 产品图片容器 */
.product-image-container {
    position: relative;
    overflow: hidden;
    padding-top: 75%; /* 4:3 宽高比 */
    cursor: pointer;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* 快速查看按钮 - 仅在悬停时显示 */
.quick-view-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 2;
}

.product-card:hover .quick-view-btn {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.quick-view-btn:hover {
    background-color: #fff;
    transform: translate(-50%, -50%) scale(1.05);
}

/* 库存状态标签 */
.product-stock {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.in-stock {
    background-color: #4CAF50;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.out-stock {
    background-color: #f44336;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.product-card:hover .in-stock {
    background-color: #28a745;
}

/* 产品信息区域 */
.product-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: padding 0.3s ease;
}

.product-card:hover .product-info {
    padding: 1.5rem 1.5rem 1.75rem;
}

.product-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease, transform 0.3s ease;
}

.product-title:hover {
    color: #000;
    transform: translateX(2px);
}

.product-price {
    margin-bottom: 1rem;
}

.price {
    font-size: 1.4rem;
    font-weight: 700;
    color: #000;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

/* 原价（如果有折扣） */
.original-price {
    font-size: 1rem;
    color: #999;
    text-decoration: line-through;
    margin-left: 8px;
    font-weight: normal;
}

/* 折扣标签 */
.discount-badge {
    background-color: #ff4757;
    color: white;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 500;
}

/* 添加购物车按钮 */
.add-to-cart {
    background-color: #333;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: auto;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.add-to-cart::before {
    content: "🛒";
    font-size: 16px;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.add-to-cart:hover {
    background-color: #000;
    transform: scale(1.03);
}

.add-to-cart:hover::before {
    opacity: 1;
    transform: translateX(0);
}

.add-to-cart:active {
    transform: scale(0.98);
}

/* 添加到购物车按钮动画 */
.add-to-cart.adding-to-cart {
    animation: addToCartPulse 0.6s ease;
}

@keyframes addToCartPulse {
    0% {
        transform: scale(1);
        background-color: #333;
    }
    50% {
        transform: scale(1.05);
        background-color: #000;
    }
    100% {
        transform: scale(1);
        background-color: #333;
    }
}

/* 通知提示框样式 */
.notification {
    position: fixed;
    top: 80px;
    right: -400px;
    background-color: #333;
    color: #fff;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transition: right 0.3s ease;
    max-width: 350px;
}

.notification.show {
    right: 20px;
}

/* 页脚样式 */
.footer {
    background-color: #222;
    color: #f9f9f9;
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
}

.footer-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.footer-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-text {
    color: #ccc;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #ccc;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #fff;
}

.footer-contact {
    color: #ccc;
    margin-bottom: 0.5rem;
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #444;
    text-align: center;
    color: #ccc;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .navbar-container {
        padding: 0 1.5rem;
    }
    
    .nav-links {
        gap: 1.5rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .page-title h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: #fff;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
    }
    
    .nav-links.active {
        left: 0;
    }
    
    .nav-links a {
        padding: 1rem 0;
        width: 100%;
        display: block;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-row {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .filter-group, .sort-options, .reset-filter-btn {
        margin-bottom: 15px;
        width: 100%;
    }
    
    .page-title h1 {
        font-size: 1.75rem;
    }
    
    .user-actions {
        gap: 1rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 25px;
    }
}

@media (max-width: 576px) {
    .page-title h1 {
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-container {
        padding: 0 1.5rem;
    }
    
    .user-actions {
        gap: 10px;
    }
    
    .action-btn {
        font-size: 14px;
    }
    
    .add-to-cart {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .product-title {
        font-size: 16px;
    }
    
    .price {
        font-size: 18px;
    }
    
    .filter-container {
        padding: 10px;
    }
    
    .apply-filter-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .sort-select {
        padding: 8px;
        font-size: 14px;
    }
    
    .reset-filter-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    .navbar {
        height: auto;
        min-height: 60px;
        padding: 10px 0;
    }
    
    .navbar-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .brand {
        margin-bottom: 10px;
        text-align: center;
    }
    
    .user-actions {
        margin-top: 10px;
        justify-content: center;
    }
    
    .menu-toggle {
        position: absolute;
        top: 15px;
        left: 15px;
    }
    
    .nav-links {
        top: 120px;
    }
    
    .page-title {
        margin: 20px 0;
    }
    
    .page-title h1 {
        font-size: 1.25rem;
    }
}

/* 加载动画 */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: #555;
    font-size: 1.1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.loading-spinner::after {
    content: "";
    width: 20px;
    height: 20px;
    border: 3px solid #ddd;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 错误提示 */
.error {
    color: #f44336;
    text-align: center;
    padding: 1rem;
    background-color: #ffebee;
    border-radius: 4px;
}

/* 无产品提示 */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #777;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 1px dashed #ddd;
}
