/* 全局 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: #ffffff;
    color: #000000;
    line-height: 1.6;
}

a {
    color: #000000;
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: #666666;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部*/
header {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-menu .nav-link {
    color: #000000;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s;
}

.user-menu .nav-link:hover {
    color: #666666;
}

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

.user-menu .user-name {
    font-size: 14px;
    font-weight: 500;
}

.user-menu .logout-btn {
    background: none;
    border: none;
    color: #666666;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.3s;
}

.user-menu .logout-btn:hover {
    color: #000000;
}

/* 用户下拉菜单样式 */
.user-menu .user-dropdown {
    position: relative;
    display: inline-block;
}

.user-menu .user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.user-menu .user-dropdown-toggle:hover {
    background-color: #f9f9f9;
}

.user-menu .user-dropdown-toggle i {
    font-size: 12px;
    transition: transform 0.3s;
}

.user-menu .user-dropdown.active .user-dropdown-toggle i {
    transform: rotate(180deg);
}

.user-menu .user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    min-width: 180px;
    padding: 10px 0;
    margin-top: 5px;
    z-index: 1000;
    display: none;
}

.user-menu .user-dropdown.active .user-dropdown-menu {
    display: block;
}

.user-menu .user-dropdown-item {
    display: block;
    padding: 10px 15px;
    font-size: 14px;
    color: #000000;
    text-decoration: none;
    transition: background-color 0.3s;
}

.user-menu .user-dropdown-item:hover {
    background-color: #f9f9f9;
}

.user-menu .user-dropdown-divider {
    height: 1px;
    background-color: #f0f0f0;
    margin: 8px 0;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.close-modal {
    font-size: 24px;
    cursor: pointer;
    color: #666666;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #000000;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #000000;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

.cancel-btn, .submit-btn {
    padding: 10px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.cancel-btn {
    background-color: #ffffff;
    color: #666666;
}

.cancel-btn:hover {
    background-color: #f9f9f9;
}

.submit-btn {
    background-color: #000000;
    color: #ffffff;
    border-color: #000000;
}

.submit-btn:hover {
    background-color: #333333;
}

/* 加载和空状态样式 */
.loading-state,
.empty-state {
    width: 100%;
    text-align: center;
    padding: 50px 0;
    color: #666;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

/* 搜索框样式*/
.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 0;
    font-size: 14px;
    color: #000000;
    outline: none;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: #000000;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666666;
    cursor: pointer;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    max-height: 300px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.search-result-item {
    padding: 10px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f9f9f9;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-name {
    font-size: 14px;
    margin-bottom: 3px;
}

.search-result-price {
    font-size: 13px;
    color: #666666;
}

.search-empty {
    padding: 20px;
    text-align: center;
    color: #666666;
    font-size: 14px;
}

/* 购物车样式 - Hover展开 */
.shopping-cart {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.cart-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-badge {
    background-color: #000000;
    color: #ffffff;
    font-size: 12px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 380px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    padding: 25px;
    margin-top: 15px;
    /* display: none; */
    z-index: 101;
    /* 关键：1秒停留的过渡效果 */
    /* transition: opacity 0.3s ease, visibility 0.3s ease 1s; */
    opacity: 0;
    visibility: hidden;
}

/* 鼠标悬浮购物车时显示下拉框
.shopping-cart:hover .cart-dropdown,
/* 鼠标悬浮下拉框时保持显示（1秒停留） */
/* .cart-dropdown:hover {
    display: block;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
} */

/* 购物车离开时延迟1秒隐藏 */
/* .shopping-cart .cart-dropdown {
    transition-delay: 1.4s;
}  */


.cart-items {
    max-height: 350px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.cart-item-details {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.cart-item-thumbnail {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #f0f0f0;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-size: 14px;
    margin-bottom: 5px;
}

.cart-item-price {
    font-size: 14px;
    font-weight: 500;
}

.cart-item-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.cart-item-quantity {
    width: 55px;
    padding: 6px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.cart-item-remove {
    color: #999999;
    cursor: pointer;
    font-size: 13px;
    text-decoration: underline;
}

.cart-item-remove:hover {
    color: #000000;
}

.cart-empty {
    text-align: center;
    padding: 40px 0;
    color: #666666;
    font-size: 15px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 20px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.checkout-btn {
    width: 100%;
    padding: 12px;
    background-color: #000000;
    color: #ffffff;
    border: none;
    border-radius: 0;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkout-btn:hover {
    background-color: #333333;
}

/* 主页面布局 - 左侧分类+右侧产品 */
.main-layout {
    display: flex;
    gap: 30px;
    padding: 30px 0;
    /* 让布局容器占满可用高度，避免滚动冲突..? */
    min-height: calc(100vh - 200px); /* 减去header和footer高度 */
}

/* 左侧分类列表 - List of categories */
.category-sidebar {
    width: 220px;
    /* 固定高度，不随页面滚动 */
    max-height: calc(100vh - 240px); /* 适配视口高度，留出头部/底部空间 */
    /* 溢出时显示垂直滚动条 */
    overflow-y: auto;
    /* 固定定位改为粘性定位（也可直接fixed），保证独立滚动 */
    position: sticky;
    top: 20px; /* 距离顶部20px，滚动时固定 */
    /* 美化滚动条 */
    scrollbar-width: thin;
    scrollbar-color: #e0e0e0 #f9f9f9;
    /* 防止宽度塌陷 */
    flex-shrink: 0;

    /* padding-top: 10px; */
}

.category-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;

    /* 固定标题，仅列表滚动(可以不要） */
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 1;
}

.category-list {
    list-style: none;
}

.category-item {
    margin-bottom: 15px;
}

.category-link {
    font-size: 15px;
    display: block;
    padding: 5px 0;
    position: relative;
}

.category-link:hover, .category-link.active {
    color: #000000;
    font-weight: 500;
}

.category-link.active::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 20px;
    height: 2px;
    background-color: #000000;
}

/* *********************右侧产品区域*********************** */
.product-content {
    flex: 1;
}

/* breadcrumb导航 */
.breadcrumb {
    padding: 10px 0 20px;
    font-size: 13px;
    color: #666666;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 25px;
}

.breadcrumb a {
    color: #666666;
    margin: 0 5px;
}

.breadcrumb a:hover {
    color: #000000;
    text-decoration: underline;
}

.breadcrumb span {
    color: #999999;
}

/* 产品列表样式 - Flexbox+黑白卡片 */
.product-section {
    padding: 10px 0 40px;
}

.section-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: flex-start;
}

.product-card {
    background-color: #ffffff;
    border: 1px solid #f0f0f0;
    width: calc(25% - 22.5px);
    overflow: hidden;
    transition: all 0.3s ease;
}

.product-card:hover {
    border-color: #e0e0e0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.03);
    transform: translateY(-2px);
}

.product-thumbnail {
    width: 100%;
    height: 300px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-thumbnail {
    opacity: 0.9;
}

.product-info {
    padding: 15px;
}

.product-name {
    font-size: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    height: 36px;
    overflow: hidden;
}

.product-name:hover {
    text-decoration: underline;
}

.product-price {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.add-to-cart-btn {
    width: 100%;
    padding: 9px;
    background-color: #ffffff;
    color: #000000;
    border: 1px solid #000000;
    border-radius: 0;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-to-cart-btn:hover {
    background-color: #000000;
    color: #ffffff;
}

/* ***********************************产品详情页******************************** */
/* ========== 产品轮播样式 ========== */
.product-image-slider {
    width: 55%;
    position: relative;
    /* 设置固定宽高比 */
    aspect-ratio: 1 / 1.2;
    /* 兜底：限制最大高度，避免超出页面 */
    max-height: 80vh;
    overflow: hidden;
}

.product-image-slider .swiper {
    width: 100%;
    height: 100%;
}

.product-slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid #f0f0f0;
}

/* 分页指示器 */
.swiper-pagination {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.swiper-bullet {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.swiper-bullet-active {
    background-color: #000000;
    width: 20px;
    border-radius: 5px;
}

/* 导航箭头 */
.swiper-button-prev,
.swiper-button-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
    background-color: #000000;
    color: #ffffff;
}

.swiper-button-prev {
    left: 15px;
}

.swiper-button-next {
    right: 15px;
}

/* 箭头图标（Font Awesome替代默认图标） */
.swiper-button-prev::after,
.swiper-button-next::after {
    content: '';
}

.swiper-button-prev::before {
    content: '\f053';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
}

.swiper-button-next::before {
    content: '\f054';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .product-image-slider {
        width: 100%;
    }

    .swiper-button-prev,
    .swiper-button-next {
        width: 30px;
        height: 30px;
    }

    .swiper-button-prev {
        left: 10px;
    }

    .swiper-button-next {
        right: 10px;
    }
}

.product-detail {
    padding: 20px 0;
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.product-full-image {
    width: 50%;
    height: auto;
    border: 1px solid #f0f0f0;
}

.product-detail-info {
    width: 45%;
    padding-top: 10px;
}

.product-detail-name {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    line-height: 1.3;
}

.product-detail-price {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.product-detail-description {
    margin-bottom: 30px;
    line-height: 1.7;
    font-size: 15px;
    color: #333333;
}

.product-detail-description ul {
    margin-left: 20px;
    margin-top: 10px;
}

.product-detail-description li {
    margin-bottom: 8px;
}

.product-detail-add-to-cart {
    padding: 12px 24px;
    font-size: 15px;
    width: auto;
}

/* 页脚 */
footer {
    background-color: #f9f9f9;
    padding: 50px 0;
    margin-top: 50px;
    border-top: 1px solid #f0f0f0;
}

.footer-content {
    text-align: center;
    font-size: 13px;
    color: #666666;
}

.footer-logo {
    font-size: 18px;
    font-weight: 600;
    color: #000000;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-text {
    margin-bottom: 10px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .product-card {
        width: calc(33.333% - 20px);
    }
}

@media (max-width: 992px) {
    .main-layout {
        flex-direction: column;
        min-height: auto;
    }

    .category-sidebar {
        width: 100%;
        margin-bottom: 20px;
        max-height: none;
        position: static;
        overflow-y: hidden;
        overflow-x: auto;
    }

    .category-list {
        display: flex;
        gap: 20px;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .category-item {
        margin-bottom: 0;
        white-space: nowrap;
    }

    .category-title {
        position: static;
    }
}

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

    .search-container {
        order: 3;
        width: 100%;
        max-width: none;
        margin-top: 15px;
    }

    .product-card {
        width: calc(50% - 15px);
    }

    .product-detail {
        flex-direction: column;
        gap: 30px;
    }

    .product-full-image, .product-detail-info {
        width: 100%;
    }

    .cart-dropdown {
        width: 100%;
        max-width: 350px;
    }
}

@media (max-width: 576px) {
    .product-card {
        width: 100%;
    }

    .product-thumbnail {
        height: 250px;
    }
}