/* 前端优化增强样式 */

/* Toast消息样式 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* 搜索建议样式 */
.search-suggestions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.search-suggestions h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #495057;
    text-align: center;
}

.suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.suggestion-tag {
    background: #e9ecef;
    color: #495057;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.suggestion-tag:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

/* 标签计数样式 */
.tab-count {
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 4px;
    min-width: 18px;
    text-align: center;
}

.tab-item.active .tab-count {
    background: white;
    color: var(--primary);
}

/* 加载进度条样式 */
.loading-progress {
    width: 100%;
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-2));
    border-radius: 2px;
    width: 0%;
    transition: width 2s ease-out;
}

/* 错误状态样式 */
.loading-content.error {
    color: var(--error);
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 成功状态样式 */
.loading-content.success {
    color: var(--success);
}

/* 键盘快捷键提示 */
.keyboard-shortcuts {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.keyboard-shortcuts.show {
    opacity: 1;
}

.keyboard-shortcuts kbd {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    margin: 0 2px;
}

/* 搜索框焦点增强 */
#searchInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
    transition: all var(--transition-normal);
}

/* 按钮点击效果 */
.btn-copy:active,
.btn-page:active,
#searchBtn:active {
    transform: scale(0.98);
}

/* 资源项悬停增强 */
.resource-item:hover {
    border-color: #c7d2fe;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.12);
    transform: translateY(-2px) translateZ(0);
    transition: all var(--transition-normal);
}

/* 标签切换动画 */
.tab-item {
    transition: all var(--transition-fast);
}

.tab-item:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    transform: translateY(-1px);
}

.tab-item.active {
    background: #eef2ff;
    color: var(--primary);
    border-color: #c7d2fe;
    box-shadow: 0 2px 8px rgba(79,70,229,0.12);
}

/* 分页按钮增强 */
.btn-page {
    transition: all var(--transition-fast);
}

.btn-page:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px) translateZ(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-page.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 响应式优化 */
@media (max-width: 768px) {
    .keyboard-shortcuts {
        display: none;
    }
    
    .search-suggestions {
        margin-top: 10px;
        padding-top: 10px;
    }
    
    .suggestion-tags {
        gap: 6px;
    }
    
    .suggestion-tag {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text: #f1f5f9;
        --text-muted: #94a3b8;
        --border: #334155;
        --bg-soft: #1e293b;
    }
    
    body {
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    }
    
    .search-section,
    .results-section,
    .api-info {
        background: #1e293b;
        color: var(--text);
    }
    
    .resource-item {
        background: #1e293b;
        border-color: #334155;
        color: var(--text);
    }
    
    .resource-item:hover {
        border-color: #475569;
        background: #334155;
    }
    
    .search-suggestions {
        border-top-color: #334155;
    }
    
    .suggestion-tag {
        background: #334155;
        color: var(--text);
    }
    
    .suggestion-tag:hover {
        background: var(--primary);
        color: white;
    }
}
