/* ===== 历史记录面板 ===== */
.history-panel {
    display: none;
    position: fixed;
    right: 20px;
    top: 70px;
    width: 380px;
    max-height: 65vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid #e5e7eb;
    z-index: 1000;
    flex-direction: column;
    overflow: hidden;
}

.history-panel.show {
    display: flex;
}

.history-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fafbfc;
}

.history-panel .panel-header span {
    font-weight: 600;
    font-size: 15px;
    color: #1a1a2e;
}

.history-panel .panel-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-panel .panel-header-actions .delete-mode-btn {
    padding: 4px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.history-panel .panel-header-actions .delete-mode-btn:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #dc2626;
}

.history-panel .panel-header-actions .delete-mode-btn.active {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

.history-panel .panel-header-actions .delete-mode-btn.active:hover {
    background: #b91c1c;
}

.history-panel .panel-header-actions .close-panel-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6b7280;
    padding: 0 4px;
    transition: color 0.2s;
}

.history-panel .panel-header-actions .close-panel-btn:hover {
    color: #1f2937;
}

/* 历史列表 */
.history-list {
    padding: 4px 0;
    overflow-y: auto;
    max-height: 400px;
    flex: 1;
}

.history-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    transition: background 0.15s;
}

.history-item:hover {
    background: #f8fafc;
}

.history-item .history-content {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item .history-time {
    font-size: 10px;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ✕ 删除按钮 - 默认隐藏 */
.history-item .delete-btn {
    background: none;
    border: none;
    font-size: 13px;
    cursor: pointer;
    color: #9ca3af;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
    display: none;
}

/* 删除模式开启时显示 */
.history-panel.delete-mode .history-item .delete-btn {
    display: block;
}

.history-item .delete-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.history-empty {
    padding: 30px 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* 滚动条 */
.history-list::-webkit-scrollbar {
    width: 4px;
}

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

.history-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
