
/*区分聊天*/
.content{
	width: 100%;
    padding-left: 0px;
}

.me{
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    clear: both;
    margin-bottom: 20px;
}

.me .user-img {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 4px;
    background-color: #155EEF;
    margin-right: 0;
}

.me .user-img img {
    width: 26px;
    height: 26px;
}

.me p {
    text-align: right;
}

.me span{
    background: #E1EFFD;
    padding: 14px;
    border-radius:4px;
    margin-right: 12px;
    max-width: calc(100% - 108px);
    position: relative;
    font-size: 14px;
    line-height: 20px;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/*master*/
.master{
    /* width: 570px; */
    display: block;
    clear: both;
    overflow: hidden;
    /*float:left;*/
    margin-bottom: 20px;
    position: relative;
}

.master img {
    float: left;
    background-color: #FEEAD5;
    border-radius: 4px;
    width: 42px;
    height: 42px;
}

.master > p {
    margin: 0;
    float: left;
    position: absolute;
    left: 54px;
    font-size: 14px;
    font-weight: 500;
}

.master span{
    background: #F3F3F5;
    padding: 14px;
    border-radius: 4px;
    float: left;
    margin: 23px 0 0 12px;
    max-width: calc(100% - 108px);
    position: relative;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 20px;
}

.master span::before,
.other span::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 12px;
    border: 5px solid transparent;
    border-right-color: #F3F3F5;
}

.me > span:not(.user-img)::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 12px;
    border: 5px solid transparent;
    border-left-color: #E1EFFD;
}

/* 流式输出样式 */
.streaming-content::after {
    content: '▋';
    animation: blink 1s infinite;
    color: #155EEF;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

/*other*/
.other{
    display: block;
    clear: both;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.other img {
    float: left;
    background-color: #FEEAD5;
    border-radius: 4px;
    width: 42px;
    height: 42px;
    padding: 6px;
}

.other > p {
    margin: 0;
    float: left;
    position: absolute;
    left: 54px;
    font-size: 14px;
    font-weight: 500;
}

.other span{
    background: #F3F3F5;
    padding: 14px;
    border-radius: 4px;
    float: left;
    margin: 23px 0 0 12px;
    max-width: calc(100% - 108px);
    position: relative;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 20px;
}

.other span section{
    color: #155EEF;
}

/* Markdown body styles for chat messages */
.master span.markdown-body,
.other span.markdown-body {
    white-space: normal;
}

.markdown-body p {
    margin: 0 0 8px 0;
}

.markdown-body p:last-child {
    margin-bottom: 0;
}

.markdown-body pre {
    background: #f6f8fa;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

.markdown-body code {
    background: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 13px;
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

.markdown-body ul, .markdown-body ol {
    padding-left: 20px;
    margin: 8px 0;
}

.markdown-body blockquote {
    border-left: 3px solid #ddd;
    padding-left: 10px;
    color: #666;
    margin: 8px 0;
}

.markdown-body table {
    border-collapse: collapse;
    margin: 8px 0;
}

.markdown-body th, .markdown-body td {
    border: 1px solid #ddd;
    padding: 6px 10px;
}

.markdown-body th {
    background: #f6f8fa;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin: 12px 0 8px 0;
    line-height: 1.4;
}

.markdown-body h1 { font-size: 1.3em; }
.markdown-body h2 { font-size: 1.2em; }
.markdown-body h3 { font-size: 1.1em; }

#agent_log_close_id {
    background-color: transparent;
    border: none;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

/* 消息评价功能样式 */
/* 消息评价状态样式 - 替代原有的评价按钮样式 */

/* 好评消息样式 - 自然绿色 */
.master.message-rating-good {
    background: linear-gradient(135deg, rgba(240, 253, 244, 0.3) 0%, transparent 100%);
    border-left: 3px solid #22c55e;
    padding-left: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.master.message-rating-good:hover {
    background: linear-gradient(135deg, rgba(240, 253, 244, 0.5) 0%, transparent 100%);
    border-left-color: #16a34a;
}

.master.message-rating-good span {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* 差评消息样式 - 自然红色 */
.master.message-rating-bad {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.3) 0%, transparent 100%);
    border-left: 3px solid #ef4444;
    padding-left: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.master.message-rating-bad:hover {
    background: linear-gradient(135deg, rgba(254, 242, 242, 0.5) 0%, transparent 100%);
    border-left-color: #dc2626;
}

.master.message-rating-bad span {
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* 消息评价指示器样式 */
.message-rating-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    margin-left: 8px;
    animation: fadeIn 0.3s ease;
    vertical-align: middle;
}

.message-rating-indicator.good {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}

.message-rating-indicator.bad {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* 消息评价按钮容器样式 */
.message-rating-container {
    margin-top: 4px;
    margin-left: 54px;
    clear: both;
    position: relative;
}

.message-rating-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.message-rating-actions:hover {
    opacity: 1;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #5f6368;
}

.btn-icon:hover:not(:disabled) {
    background-color: #f1f3f4;
    color: #202124;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 激活状态（点赞/点踩后） */
.btn-icon.active svg {
    fill: currentColor;
    animation: icon-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-icon.active.like,
.btn-icon.active.dislike {
    color: #155EEF;
}

@keyframes icon-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* 移除旧的反馈文字样式 */
.rating-feedback {
    display: none !important;
}
.feedback-panel {
    display: none;
    margin-top: 10px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 485px;
    overflow: hidden;
    font-family: inherit;
    z-index: 100;
    animation: fadeIn 0.2s ease-out;
    float: left;
    clear: both;
}

/* Reset styles */
.feedback-panel span {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    float: none !important;
    max-width: none !important;
    position: static !important;
    display: inline !important;
    color: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    border-radius: 0 !important;
}

.feedback-header {
    padding: 16px 20px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
}

.feedback-header span {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.feedback-close {
    cursor: pointer;
    color: #9ca3af;
    font-size: 20px;
    line-height: 1;
    transition: color 0.2s;
    background: transparent;
}

.feedback-close:hover {
    color: #4b5563;
}

/* 第一行：包含选项标签和（可能的）提交按钮 */
.feedback-row-1 {
    padding: 0 20px 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.feedback-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1; /* 占据剩余空间 */
}

.feedback-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px; /* 移除垂直 padding，靠 height 和 align-items 居中 */
    height: 36px; /* 与提交按钮高度保持一致 */
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px; /* 统一圆角 */
    font-size: 13px; /* 略微调大字体与按钮一致 */
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
    box-sizing: border-box;
}

.feedback-option:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.feedback-option.selected {
    background-color: #eff6ff;
    border-color: #155EEF;
    color: #155EEF;
    font-weight: 500;
}

/* 第二行：输入框区域（仅在选中“其他”时显示） */
.feedback-row-2 {
    display: none;
    padding: 0 20px 16px;
    align-items: center;
    gap: 12px;
}

/* 输入框栏：灰色背景长条 */
.feedback-input-wrapper {
    flex: 1;
    display: flex;
    background-color: #f3f4f6;
    border-radius: 6px; /* 统一圆角 */
    padding: 4px 12px;
    align-items: center;
}

.feedback-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 13px;
    outline: none;
    color: #1f2937;
    height: 32px;
    font-family: inherit;
}

.feedback-input::placeholder {
    color: #9ca3af;
}

/* 提交按钮：位置动态变化 */
.feedback-submit-btn {
    display: none; /* 默认隐藏，选中任意项后显示 */
    background-color: #155EEF;
    color: white;
    border: none;
    padding: 0 25px;
    border-radius: 6px; /* 统一圆角 */
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    height: 36px; /* 略高于输入框 */
    white-space: nowrap;
    flex-shrink: 0;
}

.feedback-submit-btn:hover {
    background-color: #104ab5;
    box-shadow: 0 2px 4px rgba(21, 94, 239, 0.2);
}



/* 评价反馈提示样式 */
.rating-feedback {
    position: absolute;
    bottom: -35px;
    left: 0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 10;
    animation: fadeInUp 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.rating-feedback.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.rating-feedback.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .master.message-rating-good,
    .master.message-rating-bad {
        margin-left: 0;
        padding-left: 6px;
        border-left-width: 2px;
    }

    .message-rating-indicator {
        width: 18px;
        height: 18px;
        font-size: 11px;
        margin-left: 6px;
    }

    .message-rating-container {
        margin-left: 20px;
    }

    .btn-icon {
        padding: 4px;
    }

    .rating-comment {
        flex-basis: 100%;
        min-width: 100%;
    }

    .rating-feedback {
        font-size: 10px;
        bottom: -30px;
        left: 10px;
        right: 10px;
    }
}

/* ========== Node Restart Buttons ========== */

.node-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 4px 0;
    padding-left: 20px;
}

.node-actions .btn-restart,
.node-actions .btn-edit-restart {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-weight: 500;
}

.node-actions .btn-restart:hover {
    background: #eff6ff;
    border-color: #155EEF;
    color: #155EEF;
}

.node-actions .btn-edit-restart:hover {
    background: #fff7ed;
    border-color: #f59e0b;
    color: #d97706;
}

.node-action-icon {
    font-size: 11px;
}

/* ========== Restart Edit Modal ========== */

.restart-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}

.restart-modal {
    background: #fff;
    border-radius: 10px;
    width: 90%;
    max-width: 620px;
    max-height: 80vh;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.restart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.restart-modal-header span {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.restart-modal-close {
    background: transparent;
    border: none;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s;
}

.restart-modal-close:hover {
    color: #4b5563;
}

.restart-modal-body {
    padding: 16px 20px;
    flex: 1;
    overflow-y: auto;
}

.restart-modal-hint {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 10px;
}

#restart-output-editor {
    width: 100%;
    min-height: 240px;
    max-height: 50vh;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #1f2937;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

#restart-output-editor:focus {
    border-color: #155EEF;
    box-shadow: 0 0 0 2px rgba(21, 94, 239, 0.12);
}

.restart-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px 16px;
    border-top: 1px solid #f0f0f0;
}

#restart-modal-cancel {
    padding: 8px 20px;
    background: #f3f4f6;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

#restart-modal-cancel:hover {
    background: #e5e7eb;
}

#restart-modal-confirm {
    padding: 8px 24px;
    background: #155EEF;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

#restart-modal-confirm:hover {
    background: #104ab5;
    box-shadow: 0 2px 6px rgba(21, 94, 239, 0.25);
}

/* ── JSON Editor ── */
.json-editor-btn {
    position: absolute;
    left: 52px;
    bottom: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.json-editor-btn img {
    width: 22px;
    height: 22px;
}

.querys-btn {
    position: absolute;
    left: 87px;
    bottom: 17px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.querys-btn img {
    width: 21px;
    height: 21px;
}

.querys-panel {
    position: absolute;
    bottom: 56px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 100;
    padding: 12px 16px;
    max-height: 240px;
    overflow-y: auto;
}

.querys-panel-header {
    margin-bottom: 8px;
}

.querys-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.querys-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.querys-list li {
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    line-height: 1.5;
    word-break: break-word;
    transition: background 0.15s;
}

.querys-list li:last-child {
    margin-bottom: 0;
}

.querys-list li:hover {
    background: #f0f4ff;
}

.json-editor-panel {
    position: absolute;
    bottom: 56px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 100;
    padding: 16px;
}

.json-editor-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.json-editor-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.json-editor-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.json-editor-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.json-editor-field label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
}

.json-editor-field textarea {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
}

.json-editor-field textarea:focus {
    outline: none;
    border-color: #155EEF;
}

.json-editor-error {
    font-size: 11px;
    color: #e53e3e;
    margin-top: 4px;
}

.json-editor-error:empty {
    display: none;
}

.json-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.json-editor-btn-cancel,
.json-editor-btn-clear,
.json-editor-btn-apply {
    padding: 5px 16px;
    font-size: 13px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.json-editor-btn-cancel {
    background: #f3f3f5;
    color: #333;
}

.json-editor-btn-cancel:hover {
    background: #e8e8ea;
}

.json-editor-btn-clear {
    background: #f3f3f5;
    color: #333;
    margin-right: auto;
}

.json-editor-btn-clear:hover {
    background: #e8e8ea;
}

.json-editor-btn-apply {
    background: #155EEF;
    color: #fff;
}

.json-editor-btn-apply:hover {
    background: #104ab5;
}

.rerun-divider {
    display: flex;
    align-items: center;
    margin: 16px 0;
    padding: 0 12px;
    list-style: none;
}

.rerun-divider::before,
.rerun-divider::after {
    content: '';
    flex: 1;
    border-top: 1px dashed #b0b8c9;
}

.rerun-divider-label {
    flex-shrink: 0;
    padding: 2px 12px;
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 10px;
    margin: 0 10px;
}

#chatbox li.me:hover,
#chatbox li.master:hover,
#chatbox li.other:hover {
    background: rgba(0, 0, 0, 0.02);
    cursor: pointer;
    border-radius: 8px;
}

.node-actions .btn-locate {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 12px;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.node-actions .btn-locate:hover {
    border-color: #f59e0b;
    color: #b45309;
    background: #fffbeb;
}
