/**
 * RFJ Search Dropdown Component Styles
 *
 * 搜索下拉组件样式 - 深色科技风格
 * 与 style.css / categories.css 主题一致
 */

/* ==================== 下拉容器 ==================== */
.rfj-search-dropdown {
    position: absolute;
    z-index: 9999;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-height: 420px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
}

/* ==================== 列表容器 ==================== */
.rfj-sd-list {
    padding: 0;
    margin: 0;
}

/* ==================== 分类区块 ==================== */
.rfj-sd-section {
    border-bottom: 1px solid var(--border-color);
}

.rfj-sd-section:last-child {
    border-bottom: none;
}

/* ==================== 区块标题 ==================== */
.rfj-sd-section-header {
    cursor: pointer;
    padding: 0.625rem 1rem;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.85rem;
    line-height: 1.4;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    border-bottom: 1px solid var(--border-color);
}

.rfj-sd-section-header:last-child {
    border-bottom: none;
}

.rfj-sd-section-header:hover {
    background: var(--bg-card-hover);
}

.rfj-sd-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==================== 项目列表 ==================== */
.rfj-sd-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rfj-sd-item {
    line-height: 1;
    border-bottom: 1px solid var(--border-color);
}

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

.rfj-sd-item-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem 0.625rem 1.5rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
}

.rfj-sd-item-link:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%);
    color: var(--primary-color);
    padding-left: 1.75rem;
}

.rfj-sd-item-link .rfj-sd-icon {
    margin-right: 0.5rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ==================== 底部更多 ==================== */
.rfj-sd-footer {
    padding: 0.75rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.rfj-sd-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    width: 100%;
}

.rfj-sd-more-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-hover);
}

.rfj-sd-more-btn .rfj-sd-icon {
    opacity: 0.8;
}

/* ==================== 加载状态 ==================== */
.rfj-sd-loading {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.rfj-sd-loading .rfj-sd-icon {
    animation: rfj-sd-spin 0.8s linear infinite;
}

@keyframes rfj-sd-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== 错误状态 ==================== */
.rfj-sd-error {
    padding: 1rem;
    text-align: center;
    color: #ef4444;
    font-size: 0.9rem;
}

/* ==================== 无结果状态 ==================== */
.rfj-sd-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==================== 图标 ==================== */
.rfj-sd-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .rfj-search-dropdown {
        position: fixed;
        left: 1rem !important;
        right: 1rem !important;
        width: auto !important;
        max-width: none;
        max-height: 60vh;
        border-radius: var(--radius-xl);
    }
}

/* ==================== 暗色主题支持（默认就是暗色） ==================== */
@media (prefers-color-scheme: dark) {
    .rfj-search-dropdown {
        background: var(--bg-card);
        border-color: var(--border-color);
    }
}

/* ===== 头部导航搜索下拉框 ===== */
.header-search-wrapper .rfj-search-dropdown {
    top: calc(100% + 8px);
    right: 0;
    border-radius: var(--radius-lg);
    max-width: 400px;
}

/* ===== 分类页搜索框下拉 ===== */
.categories-search-box .rfj-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
}

@media (max-width: 768px) {
    .categories-search-box .rfj-search-dropdown {
        position: fixed;
        top: auto;
        bottom: 1rem;
        left: 1rem;
        right: 1rem;
        width: auto;
        max-width: none;
        max-height: 50vh;
    }
}
