/* 历史文件 */
.history-list {
    flex: 1;
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
}

.history-item:hover {
    background: var(--input-bg);
}

.history-delete-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--error);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.history-item:hover .history-delete-btn {
    display: flex;
}

.history-delete-btn:hover {
    background: var(--error);
    color: white;
}

.history-item .file-icon {
    width: 40px;
    height: 40px;
    background: rgba(0, 113, 227, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    margin-right: 14px;
    flex-shrink: 0;
}

.history-item .file-info {
    flex: 1;
    height: 100%;
    min-width: 0;
}

.history-item .file-name {
    font-weight: 500;
    font-size: 15px;
    color: var(--text-primary);
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.history-item .file-meta {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== 文件夹侧边栏样式 ===== */

.history-with-folders {
    display: flex;
    gap: 0;
    height: 100%;
    min-height: 0;
}

.folder-sidebar {
    width: 180px;
    min-width: 0;
    border-right: 1px solid var(--border);
    padding: 12px;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.folder-sidebar.collapsed {
    width: 40px;
    padding: 12px 8px;
}

.folder-sidebar.collapsed .folder-header span,
.folder-sidebar.collapsed .folder-add-btn,
.folder-sidebar.collapsed .folder-list {
    flex: 1;
    display: none;
}

.folder-sidebar.collapsed .folder-header {
    justify-content: center;
    padding: 0;
}

.folder-toggle-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.folder-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.folder-sidebar.collapsed .folder-toggle-btn {
    transform: rotate(180deg);
}

.folder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 12px 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.folder-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.folder-add-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.folder-add-btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.folder-list {
    flex: 1;
    height: 100%;
    overflow-y: auto;
}

.folder-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.folder-item:hover {
    background: var(--bg-hover);
}

.folder-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.folder-item-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.folder-item-name {
    flex: 1;
    height: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-item-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-gradient-start);
    padding: 2px 6px;
    border-radius: 10px;
}

.folder-item.active .folder-item-count {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.history-list-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

/* 文件夹右键菜单 */
.folder-context-menu {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 4px;
    z-index: 1000;
    min-width: 120px;
}

.folder-context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s ease;
}

.folder-context-menu-item:hover {
    background: var(--bg-hover);
}

.folder-context-menu-item.danger {
    color: #ef4444;
}

.folder-context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* 创建文件夹对话框 */
.folder-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    z-index: 1001;
    width: 320px;
}

.folder-dialog h3 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
}

.folder-dialog input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.folder-dialog input:focus {
    outline: none;
    border-color: var(--primary);
}

.folder-dialog-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.folder-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

/* ===== 科技风历史记录样式 ===== */

/* 搜索框 - Apple 风格 */
.tech-search-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--input-bg);
    border: none;
    border-radius: 10px;
    position: relative;
    transition: all 0.2s ease;
}

.tech-search-wrapper::before {
    display: none;
}

.tech-search-wrapper:focus-within::before {
    display: none;
}

.tech-search-wrapper:focus-within {
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.tech-search-icon {
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.tech-search-wrapper:focus-within .tech-search-icon {
    color: var(--primary);
}

.tech-search-input {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-primary);
    outline: none;
}

.tech-search-input::placeholder {
    color: var(--text-muted);
}

.tech-clear-btn {
    padding: 6px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tech-clear-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

.tech-search-glow {
    display: none;
}

.tech-search-wrapper:focus-within .tech-search-glow {
    display: none;
}

/* 搜索高亮样式 */
.search-highlight {
    background: linear-gradient(120deg, rgba(59, 130, 246, 0.3) 0%, rgba(59, 130, 246, 0.2) 100%);
    color: var(--text-primary);
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 500;
}

/* 搜索匹配片段 */
.match-snippet {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 通知设置样式 */
.notification-setting {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.notification-setting:last-child {
    margin-bottom: 0;
}

.notification-setting label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.notification-setting input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* 历史记录收藏按钮 - Apple 风格 */
.history-star-btn {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.history-item:hover .history-star-btn {
    display: flex;
}

.history-star-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--warning);
}

.history-star-btn.starred {
    display: flex;
    color: var(--warning);
}

.history-star-btn.starred:hover {
    background: rgba(255, 159, 10, 0.1);
}

/* 历史记录标签 - Apple 风格 */
.history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.history-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(0, 113, 227, 0.1);
    color: var(--primary);
    border: none;
    border-radius: 980px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-tag::before {
    display: none;
}

.history-tag:hover {
    background: rgba(0, 113, 227, 0.15);
}

.history-tag:hover::before {
    display: none;
}

.history-tag .tag-remove {
    display: none;
    width: 12px;
    height: 12px;
    margin-left: 2px;
    opacity: 0.7;
}

.history-tag:hover .tag-remove {
    display: block;
}

/* 历史记录筛选工具栏 - Apple 风格 */
.history-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding: 0;
    background: transparent;
    border: none;
}

.history-toolbar::before {
    display: none;
}

.history-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 400;
    background: var(--input-bg);
    border: none;
    border-radius: 980px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-filter-btn::after {
    display: none;
}

.history-filter-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.history-filter-btn:hover::after {
    display: none;
}

.history-filter-btn.active {
    background: var(--primary);
    color: white;
}

.history-filter-btn svg {
    width: 14px;
    height: 14px;
}

.history-sort-select {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 400;
    background: var(--input-bg);
    border: none;
    border-radius: 980px;
    color: var(--text-secondary);
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2386868b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}

.history-sort-select:hover, .history-sort-select:focus {
    background: rgba(0, 0, 0, 0.08);
}

/* 标签输入框 - Apple 风格 */
.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    background: var(--input-bg);
    border: none;
    border-radius: 10px;
    min-height: 36px;
    align-items: center;
    transition: all 0.2s ease;
}

.tag-input-container:focus-within {
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.tag-input-container .tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--primary);
    color: white;
    border-radius: 980px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tag-input-container .tag-chip .remove-chip {
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.tag-input-container .tag-chip .remove-chip:hover {
    opacity: 1;
}

.tag-input-container input {
    height: 100%;
    min-width: 80px;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* 拖拽排序样式 - Apple 风格 */
.history-item.dragging {
    opacity: 0.6;
    background: var(--input-bg);
    box-shadow: var(--shadow-md);
}

.history-item.drag-over {
    border-top: 2px solid var(--primary);
}

.history-item .drag-handle {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: rgba(0, 113, 227, 0.5);
    cursor: grab;
    opacity: 0;
    transition: all 0.3s ease;
}

.history-item:hover .drag-handle {
    opacity: 1;
}

.history-item .drag-handle:hover {
    color: var(--primary);
    filter: drop-shadow(0 0 4px rgba(0, 113, 227, 0.5));
}

.history-item.dragging .drag-handle {
    cursor: grabbing;
}

/* 标签管理弹窗 - 全息界面 */
.tag-manager-popup {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 280px;
    background: var(--card-bg);
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    padding: 16px;
    z-index: 100;
    animation: popupSlideIn 0.2s ease;
}

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

.tag-manager-popup::before {
    display: none;
}

.tag-manager-popup h4 {
    margin: 0 0 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tag-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.tag-suggestion {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(0, 113, 227, 0.1);
    color: var(--primary);
    border: none;
    border-radius: 980px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-suggestion:hover {
    background: rgba(0, 113, 227, 0.15);
}

/* 历史项目样式 - Apple 风格 */
.history-item {
    position: relative;
    transition: background 0.2s ease;
}

.history-item::before {
    display: none;
}

.history-item:hover::before {
    display: none;
}

.history-item:hover {
    background: var(--input-bg);
}

.history-item .file-icon {
    background: rgba(0, 113, 227, 0.1);
    border: none;
}

.history-item:hover .file-icon {
    background: rgba(0, 113, 227, 0.15);
}

.history-item::after {
    display: none;
}

.history-item:hover::after {
    display: none;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}
