/**
 * AI创作坊 · 聊天区样式（发送进度条、用户消息中的图片/视频缩略图）
 * 独立命名空间 ai-workshop-*，不与其他面板共用，保证面板独立性
 * 字体：Microsoft YaHei，符合项目字体规范
 */

/* ---------- 发送进度条（位于输入区域上方，显示时占满一行，避免影响输入框布局） ---------- */
.ai-workshop-send-progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    width: 100%;
    flex-shrink: 0;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-size: 12px;
    color: #aaa;
}

.ai-workshop-send-progress-wrap[hidden] {
    display: none !important;
}

.ai-workshop-send-progress-bar {
    flex: 1;
    height: 4px;
    min-width: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.ai-workshop-send-progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: 30%;
    background: #6b8cff;
    border-radius: 2px;
    animation: ai-workshop-progress-indeterminate 1s ease-in-out infinite;
}

@keyframes ai-workshop-progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.ai-workshop-send-progress-text {
    flex-shrink: 0;
    font-size: 11px;
    color: #888;
}

/* ---------- 选中节点提示（输入区上方，发送时随消息带给 AI） ---------- */
.ai-workshop-chat-selected-nodes-hint {
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-size: 11px;
    color: #6b8cff;
    margin-bottom: 4px;
    flex-shrink: 0;
}

.ai-workshop-chat-selected-nodes-hint[hidden] {
    display: none !important;
}

/* ---------- 用户消息中的图片/视频缩略图（聊天记录内） ---------- */
.ai-workshop-chat-media-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    list-style: none;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
    margin-bottom: 0;
}

.ai-workshop-chat-media-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.ai-workshop-chat-media-item img,
.ai-workshop-chat-media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.ai-workshop-chat-media-item.is-video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-size: 11px;
    color: #888;
    cursor: pointer;
}

/* 缩略图点击后的大图/视频预览遮罩（本面板独立） */
.ai-workshop-media-preview-mask {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

.ai-workshop-media-preview-mask img,
.ai-workshop-media-preview-mask video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ai-workshop-media-preview-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.ai-workshop-media-preview-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---------- Debug 上下文调试浮动窗（临时组件，点击画布「Debug聊天」打开，仅关闭按钮关闭） ---------- */
.ai-workshop-debug-panel {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: var(--ai-workshop-debug-width, 360px);
    max-width: 90vw;
    height: 70vh;
    max-height: 600px;
    box-sizing: border-box;
    background: rgba(24, 26, 31, 0.98);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-size: 12px;
    color: #ddd;
}
.ai-workshop-debug-panel.is-dragging {
    transition: none;
}

/* 右侧拖拽调整宽度手柄 */
.ai-workshop-debug-resize {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: col-resize;
    z-index: 2;
}
.ai-workshop-debug-resize:hover,
.ai-workshop-debug-resize:active {
    background: rgba(107, 140, 255, 0.12);
}
.ai-workshop-debug-resize::after {
    content: '';
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 40px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.15);
    pointer-events: none;
}

/* 向左折叠收起：宽度收窄为窄条，右侧固定 */
.ai-workshop-debug-panel[data-collapsed="true"] {
    width: 40px;
    min-width: 40px;
}
.ai-workshop-debug-panel[data-collapsed="true"] .ai-workshop-debug-resize {
    display: none;
}
.ai-workshop-debug-panel[data-collapsed="true"] .ai-workshop-debug-header {
    padding: 6px 4px;
    flex-direction: column;
    gap: 4px;
}
.ai-workshop-debug-panel[data-collapsed="true"] .ai-workshop-debug-title {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 11px;
    white-space: nowrap;
}

.ai-workshop-debug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}
.ai-workshop-debug-header .ai-workshop-debug-header-drag {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.ai-workshop-debug-title {
    font-size: 12px;
    font-weight: 600;
    color: #f0f0f0;
}

/* 关闭按钮：仅通过此按钮关闭，点击窗口外不关闭 */
.ai-workshop-debug-close-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    margin-left: 6px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: #c0c0c0;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.ai-workshop-debug-close-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}
.ai-workshop-debug-close-btn:active {
    transform: scale(0.95);
}

.ai-workshop-debug-toggle-btn {
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.2);
    color: #e0e0e0;
    font-size: 11px;
    cursor: pointer;
}

.ai-workshop-debug-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.ai-workshop-debug-body {
    flex: 1;
    overflow: auto;
    padding: 6px 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) rgba(255, 255, 255, 0.04);
}
.ai-workshop-debug-body::-webkit-scrollbar {
    width: 6px;
}
.ai-workshop-debug-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
}
.ai-workshop-debug-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}
.ai-workshop-debug-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

.ai-workshop-debug-panel[data-collapsed="true"] .ai-workshop-debug-tabs,
.ai-workshop-debug-panel[data-collapsed="true"] .ai-workshop-debug-body,
.ai-workshop-debug-panel[data-collapsed="true"] .ai-workshop-debug-footer {
    display: none;
}

.ai-workshop-debug-list {
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
}

.ai-workshop-debug-item {
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.18);
    padding: 4px 6px;
}

.ai-workshop-debug-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.ai-workshop-debug-item-actions {
    display: flex;
    flex-shrink: 0;
    gap: 6px;
}

.ai-workshop-debug-item-header-left {
    flex: 1;
    min-width: 0;
}

.ai-workshop-debug-item-title {
    font-size: 11px;
    color: #f5f5f5;
    margin-bottom: 2px;
}

.ai-workshop-debug-item-summary {
    font-size: 10px;
    color: #999;
}

.ai-workshop-debug-item-copy-btn {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.25);
    color: #b0bec5;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-size: 11px;
    cursor: pointer;
}

.ai-workshop-debug-item-copy-btn:hover {
    background: rgba(107, 140, 255, 0.2);
    color: #a5b8ff;
    border-color: rgba(107, 140, 255, 0.35);
}

.ai-workshop-debug-item-payload {
    margin: 4px 0 0;
    padding: 4px 6px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    max-height: 160px;
    overflow: auto;
    font-size: 10px;
    line-height: 1.4;
    color: #cfd8dc;
    white-space: pre;
}

.ai-workshop-debug-footer {
    padding: 4px 8px 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-workshop-debug-footer-left {
    flex-shrink: 0;
}

.ai-workshop-debug-footer-right {
    flex: 1;
}

.ai-workshop-debug-footer-text {
    font-size: 11px;
    color: #b0bec5;
}

.ai-workshop-debug-context-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-workshop-debug-context-ring {
    width: 26px;
    height: 26px;
}

/* 调试面板内 payload 块滚动条：深色系 */
.ai-workshop-debug-item-payload {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) rgba(255, 255, 255, 0.04);
}
.ai-workshop-debug-item-payload::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.ai-workshop-debug-item-payload::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
}
.ai-workshop-debug-item-payload::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}
.ai-workshop-debug-item-payload::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Debug 面板 · Tab 切换（发送信息 / 收到信息 / 模拟回复） */
.ai-workshop-debug-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
}

.ai-workshop-debug-tab {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #999;
    font-size: 11px;
    cursor: pointer;
}

.ai-workshop-debug-tab:hover {
    color: #ccc;
    background: rgba(255, 255, 255, 0.06);
}

.ai-workshop-debug-tab.is-active {
    color: #a5b8ff;
    background: rgba(107, 140, 255, 0.15);
}

/* 仅当前选中的 Tab 对应面板显示；发送信息、收到信息面板下不显示模拟回复区域 */
.ai-workshop-debug-panel[data-active-tab="send"] .ai-workshop-debug-body-received,
.ai-workshop-debug-panel[data-active-tab="send"] .ai-workshop-debug-body-simulate {
    display: none !important;
}
.ai-workshop-debug-panel[data-active-tab="received"] .ai-workshop-debug-body[data-tab-panel="send"],
.ai-workshop-debug-panel[data-active-tab="received"] .ai-workshop-debug-body-simulate {
    display: none !important;
}
.ai-workshop-debug-panel[data-active-tab="simulate"] .ai-workshop-debug-body[data-tab-panel="send"],
.ai-workshop-debug-panel[data-active-tab="simulate"] .ai-workshop-debug-body-received {
    display: none !important;
}

.ai-workshop-debug-body-received .ai-workshop-debug-item-payload {
    max-height: 200px;
    white-space: pre-wrap;
    word-break: break-all;
}

.ai-workshop-debug-body-simulate {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

.ai-workshop-debug-simulate-hint {
    font-size: 11px;
    color: #999;
    line-height: 1.4;
    margin: 0;
}

.ai-workshop-debug-simulate-input {
    width: 100%;
    min-height: 100px;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.25);
    color: #e0e0e0;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    line-height: 1.4;
    resize: vertical;
    box-sizing: border-box;
}

.ai-workshop-debug-simulate-input::placeholder {
    color: #666;
}

.ai-workshop-debug-simulate-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid rgba(107, 140, 255, 0.4);
    background: rgba(107, 140, 255, 0.2);
    color: #a5b8ff;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-size: 12px;
    cursor: pointer;
}

.ai-workshop-debug-simulate-btn:hover {
    background: rgba(107, 140, 255, 0.3);
    color: #b8c8ff;
}

