/* 三级商品类目选择器样式 - 水平级联展开版本 */

/* 类目选择器容器 */
.category-selector-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
}

/* 触发按钮样式 */
.category-trigger-btn {
    padding: 6px 12px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-align: left;
}

.category-trigger-btn:hover {
    background-color: #e9ecef;
    border-color: #007bff;
}

.category-trigger-btn:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* 全选选项样式已移除 */


/* 类目面板样式 */
.category-panel {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: auto;
    min-width: 500px;
    margin-top: 5px;
    animation: slideDown 0.2s ease;
}

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

/* 搜索区域样式 */
.category-search-area {
    padding: 15px;
    border-bottom: 1px solid #eee;
    position: relative;
}

/* 搜索输入框样式 - 支持多实例 */
.category-search-input,
#category-search-input {
    width: 100%;
    padding: 10px 36px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

.category-search-input:focus,
#category-search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
    background-color: #fff;
}

.category-search-input::placeholder,
#category-search-input::placeholder {
    color: #999;
    font-size: 13px;
}

/* 搜索结果样式 */
.search-results {
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1001;
    margin-top: 5px;
}

.search-result-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
}

/* 加载和错误状态样式 */
.search-loading,
.search-empty,
.search-error,
.category-loading,
.category-empty,
.category-error {
    padding: 10px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.search-error,
.category-error {
    color: #dc3545;
}

/* 分类内容区域 */
.category-content {
    display: flex;
    min-height: 200px;
}

/* 分类级别面板样式 */
.category-level-panel {
    min-width: 180px;
    max-width: 250px;
    border-right: 1px solid #eee;
    max-height: 500px; /* 限制最大高度，约9个分类项的高度 */
    overflow-y: auto; /* 当内容超出时显示垂直滚动条 */
    transition: all 0.3s ease;
}

.category-level-panel:last-child {
    border-right: none;
}

/* 分类项样式 */
.category-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f5f5f5;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-item:hover {
    background-color: #f8f9fa;
    color: #007bff;
    padding-left: 20px;
}

.category-item.selected {
    background-color: #e3f2fd;
    color: #007bff;
    font-weight: 500;
    border-left: 3px solid #007bff;
    padding-left: 13px;
}

.category-item.selected:hover {
    background-color: #bbdefb;
    padding-left: 17px;
}

/* 滚动条样式 */
.category-level-panel::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.category-level-panel::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.category-level-panel::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.category-level-panel::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .category-selector-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .category-trigger-btn {
        width: 100%;
    }

    .category-all-option {
        justify-content: center;
    }

    .category-panel {
        left: 0;
        right: 0;
        min-width: auto;
        width: 100%;
    }

    .category-content {
        flex-direction: column;
    }

    .category-level-panel {
        min-width: auto;
        max-width: none;
        border-right: none;
        border-bottom: 1px solid #eee;
        max-height: 150px;
    }

    .category-level-panel:last-child {
        border-bottom: none;
    }
}

/* 动画效果增强 */
.category-level-panel {
    animation: fadeIn 0.3s ease;
}

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

/* 交互反馈增强 */
.category-item {
    position: relative;
}

.category-item::after {
    content: '>';
    position: absolute;
    right: 16px;
    opacity: 0;
    transition: all 0.2s ease;
}

.category-item:hover::after {
    opacity: 0.5;
}

.category-item.selected::after {
    opacity: 1;
    color: #007bff;
}