:root {
    --sidebar-width-collapsed: 64px;
    --sidebar-width-expanded: 280px;
    --sidebar-item-height: 60px;
    --primary-color: #000037;
    --primary-dark: #000024;
    --primary-light: #1a1a50;
    --secondary-color: #333366;
    --bg-color: #f8f9fa;
    --text-color: #333;
    --border-color: #e0e0e0;
    --transition-speed: 0.3s;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Barlow', sans-serif;
    user-select: none;
}

/* 允许选择数字相关信息 */
.product-code,
.product-id,
.filter-count,
.meta-value,
.attribute-value,
.page-btn,
.spec-item span:last-child {
    user-select: text;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 顶部导航 */
.main-header {
    background: var(--primary-color);
    color: white;
}
.header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.sidebar-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: transform var(--transition-speed) ease;
}
.sidebar-toggle:hover {
    transform: scale(1.1);
}
.brand {
    font-size: 18px;
    font-weight: bold;
}

.logo-image {
    height: 80px;
    width: auto;
}

/* 头部搜索样式 */
.header-search {
    flex: 1;
    max-width: 900px;
    margin: 0 20px;
    min-width: 0;
}

#headerSearchForm {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 4px 12px;
    transition: all 0.3s ease;
}

#headerSearchForm:hover {
    background: rgba(255, 255, 255, 0.3);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    padding: 8px 12px;
    font-size: 14px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* ========== 核心：侧边栏布局 ========== */
.app-container {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

/* 侧边栏容器：绝对定位，最小宽度=Icon宽度 */
.sidebar-container {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    display: flex;
    background: var(--bg-color);
    z-index: 100;
    min-width: var(--sidebar-width-collapsed);
    width: auto;
    box-shadow: var(--shadow-md);
}

/* ========== 终极修复：一级目录Icon完全显示 ========== */
.sidebar-level-1 {
    width: var(--sidebar-width-collapsed);
    height: 100%;
    overflow: visible;
    background: var(--primary-color);
    color: white;
    transition: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    box-shadow: var(--shadow-sm);
}

/* 一级目录展开状态：仅修改宽度，其他不变 */
.sidebar-level-1.expand {
    width: var(--sidebar-width-expanded);
    transition: width var(--transition-speed) ease;
}

/* 一级目录项：专门适配Icon显示 */
.level-1-item {
    cursor: pointer;
    height: var(--sidebar-item-height);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    transition: all var(--transition-speed) ease;
    border-radius: 0;
}
.level-1-item:hover {
    background-color: var(--primary-dark);
    transform: translateX(4px);
}
.level-1-item.active {
    background-color: var(--primary-dark);
    box-shadow: inset 4px 0 0 #ffffff;
}

/* 一级目录标题容器：彻底修复Icon布局 */
.level-1-title {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    justify-content: center;
    gap: 0;
    transition: all var(--transition-speed) ease;
}

/* 展开状态：调整布局显示文字和箭头 */
.sidebar-level-1.expand .level-1-title {
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
}

/* ========== Icon专属样式：确保100%显示 ========== */
.level-1-title .icon-wrapper {
    width: var(--sidebar-width-collapsed);
    height: var(--sidebar-item-height);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: visible;
    transition: all var(--transition-speed) ease;
}

.level-1-title .icon-wrapper i {
    font-size: 26px;
    color: #ffffff;
    vertical-align: middle;
    line-height: 1;
    transition: transform var(--transition-speed) ease;
}

.level-1-item:hover .icon-wrapper i {
    transform: scale(1.1);
}

/* 一级目录文字：折叠时完全隐藏（不占空间） */
.level-1-title .text-wrapper {
    display: none;
    white-space: nowrap;
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.sidebar-level-1.expand .level-1-title .text-wrapper {
    display: block;
    animation: fadeIn var(--transition-speed) ease;
}

/* 一级目录箭头：折叠时完全隐藏 */
.level-1-title .chevron-wrapper {
    display: none;
    width: 24px;
    flex-shrink: 0;
    transition: transform var(--transition-speed) ease;
}

.sidebar-level-1.expand .level-1-title .chevron-wrapper {
    display: block;
    animation: fadeIn var(--transition-speed) ease;
}

.level-1-item:hover .chevron-wrapper i {
    transform: translateX(4px);
}

/* 二/三级目录：默认收起 */
.sidebar-level-2,
.sidebar-level-3 {
    width: 0;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border-right: 1px solid var(--border-color);
    transition: width var(--transition-speed) ease;
    box-shadow: var(--shadow-sm);
}

.sidebar-level-2.show,
.sidebar-level-3.show {
    width: var(--sidebar-width-expanded);
    min-width: var(--sidebar-width-expanded);
}

/* 二/三级目录内部样式 */
        .back-btn {
            width: 100%;
            padding: 16px 24px;
            background: #f8f9fa;
            border: none;
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            font-weight: 500;
            text-align: left;
            transition: all var(--transition-speed) ease;
            font-size: 14px;
            color: var(--text-color);
        }
        .back-btn:hover {
            background-color: #e3f2fd;
            color: var(--primary-color);
            transform: translateX(4px);
        }
        .back-btn i {
            transition: transform var(--transition-speed) ease;
        }
        .back-btn:hover i {
            transform: translateX(-4px);
        }
        .level-2-item,
        .level-3-item {
            padding: 16px 24px;
            border-bottom: 1px solid var(--border-color);
            cursor: pointer;
            transition: all var(--transition-speed) ease;
            position: relative;
        }
        .level-2-item:hover,
        .level-3-item:hover {
            background-color: #f5f9ff;
            transform: translateX(4px);
        }
        .level-2-item::before,
        .level-3-item::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            width: 3px;
            background-color: transparent;
            transition: background-color var(--transition-speed) ease;
        }
        .level-2-item:hover::before,
        .level-3-item:hover::before {
            background-color: var(--primary-color);
        }
        .level-2-title,
        .level-3-title {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 15px;
            font-weight: 500;
        }
        .level-2-title i,
        .level-3-title i {
            transition: transform var(--transition-speed) ease;
            color: var(--primary-color);
        }
        .level-2-item:hover .level-2-title i,
        .level-3-item:hover .level-3-title i {
            transform: translateX(4px);
        }
        .filter-checkbox {
            margin-right: 12px;
            width: 18px;
            height: 18px;
            accent-color: var(--primary-color);
            cursor: pointer;
            transition: transform var(--transition-speed) ease;
        }
        .filter-checkbox:hover {
            transform: scale(1.1);
        }
        .filter-count {
            color: var(--primary-dark);
            font-size: 13px;
            font-weight: 500;
            background: #e3f2fd;
            padding: 4px 10px;
            border-radius: 12px;
            transition: all var(--transition-speed) ease;
        }
        .level-3-item:hover .filter-count {
            background: var(--primary-color);
            color: white;
            transform: scale(1.05);
        }

/* 主内容区：占据整个页面宽度 */
.main-content {
    flex: 1;
    padding-left: 0;
    overflow-y: auto;
    background: #f8f8f8;
}

.content-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 0;
    color: var(--text-color);
}

/* 高级搜索区样式优化 */
.search-section {
    background: #ffffff;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #f0f0f0;
}

.search-form {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.form-group {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* 确保按钮区域不会被挤压 */
.search-form .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.form-group label {
    display: inline-block;
    font-weight: 600;
    color: #444444;
    font-size: 1rem;
    white-space: nowrap;
    min-width: 80px;
}

.form-control {
    flex: 1;
    padding: 0.8rem 2.5rem 0.8rem 1.2rem;
    border: 1px solid #dddddd;
    border-radius: 4px;
    background-color: #ffffff;
    color: #333333;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

/* 禁用状态样式 */
.form-control:disabled {
    background-color: #f8f8f8;
    color: #999999;
    cursor: not-allowed;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* 为select元素添加placeholder样式 */
select.form-control option[value=""] {
    color: #999999;
    font-style: italic;
}

select.form-control:not(:focus) option[value=""] {
    display: block;
}

select.form-control option:not([value=""]) {
    color: #333333;
    font-style: normal;
}

.product-card {
    background: #ffffff;
    border-radius: 6px;
    padding: 0.8rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    border: 1px solid #f0f0f0;
    transition: box-shadow 0.2s ease;
}

.product-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.product-img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain;
    background: #fafafa;
    border-radius: 4px;
    /* padding: 15px; */
}

.product-code {
    font-size: 0.95rem;
    /* font-weight: 700; */
    color: var(--primary-dark);
}

.product-title {
    color: #555555;
    font-size: 0.95rem;
    /* line-height: 1.5; */
}

.product-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-specs {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.product-specs span {
    color: #444444;
    font-size: 0.9rem;
    user-select: text;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    /* padding: 0.6rem 0; */
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
}

.spec-item span:first-child {
    color: #666666;
    font-weight: 500;
}

.spec-item span:last-child {
    color: #444444;
}

.product-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.8rem;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 3rem;
}

.page-btn {
    padding: 0.8rem 1.2rem;
    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 4px;
    cursor: pointer;
    color: #555555;
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: #ffcc00;
    color: var(--primary-dark);
    transition: background-color 0.2s ease;
}

.btn-secondary:hover {
    background-color: #ffd633;
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 1rem;
    border: 1px solid #f0f0f0;
}

.filter-bar div {
    color: #555555;
    font-size: 0.95rem;
}

.sort-options {
    display: none;
    gap: 1.2rem;
}

.sort-options label {
    color: #555555;
    font-weight: 500;
}

.sort-options select {
    padding: 0.6rem 1rem;
    border: 1px solid #dddddd;
    border-radius: 4px;
    background-color: #ffffff;
    color: #333333;
    font-size: 0.95rem;
}

.results-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
}

footer {
    background-color: var(--primary-color);
    color: #e0e0e0;
    padding: 1.5rem 2rem;
    text-align: center;
    font-size: 0.95rem;
    margin-top: auto;
    position: relative;
    z-index: 10;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .results-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .results-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar-level-1.expand {
        width: 240px;
    }
    .sidebar-level-2.show,
    .sidebar-level-3.show {
        width: 240px;
        min-width: 240px;
    }
    
    /* 头部搜索响应式 */
    .header-search {
        max-width: none;
        margin: 10px auto;
        order: 2;
        width: calc(100% - 30px);
        flex: none;
    }
    
    .header-container {
        flex-wrap: wrap;
        gap: 0;
        padding: 5px 15px;
        justify-content: center;
    }
    
    .logo {
        order: 1;
        flex-shrink: 0;
        margin: 0 auto;
    }
    
    .logo-image {
        height: 40px;
        margin: 5px;
    }
    
    .sidebar-toggle {
        order: 3;
    }
    
    .results-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .results-list {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 暂无图片样式 */
.no-image {
    width: 100%;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    color: #999;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid #f0f0f0;
}

/* 产品详情页暂无图片样式 */
.no-image-detail {
    width: 100%;
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    color: #999;
    font-size: 18px;
    border-radius: 4px;
    border: 1px solid #f0f0f0;
}

/* 保修图片样式 */
.warranty-image {
    width: 120px;
    border-radius: 5px;
    margin-top: 10px;
}

/* 缩略图暂无图片样式 */
.no-image-thumbnail {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    color: #999;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #f0f0f0;
    cursor: pointer;
    margin-right: 10px;
    text-align: center;
    padding: 10px;
    box-sizing: border-box;
}

.no-image-thumbnail:hover {
    background: #f0f0f0;
    border-color: #e0e0e0;
}