/**
 * AI创作坊面板 · 聊天基础样式
 * 消息区、头像气泡、Markdown、输入区、底部模型选择与发送/停止按钮
 * 独立命名空间 ai-workshop-*，不与其他面板共用，保证面板独立性
 * 字体：Microsoft YaHei，符合项目字体规范
 */

/* 中部聊天内容区域：微信式左右对话布局，可滚动 */
.ai-workshop-chat-body {
    flex: 1 1 auto;
    min-height: 0;
    border-radius: 10px;
    background-color: #18181b;
    padding: 8px 10px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
    /* 保证竖向滚动条可见 */
    scrollbar-width: thin;
    scrollbar-color: rgba(107, 140, 255, 0.5) rgba(255, 255, 255, 0.06);
}
.ai-workshop-chat-body::-webkit-scrollbar {
    width: 8px;
}
.ai-workshop-chat-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
}
.ai-workshop-chat-body::-webkit-scrollbar-thumb {
    background: rgba(107, 140, 255, 0.5);
    border-radius: 4px;
}
.ai-workshop-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 140, 255, 0.7);
}

.ai-workshop-chat-message {
    display: flex;
    /* 顶部对齐，让圆形头像（AI/我）位于气泡左上角/右上角 */
    align-items: flex-start;
    margin-bottom: 8px;
    max-width: 100%;
}

.ai-workshop-chat-message.is-ai {
    justify-content: flex-start;
}

/* 用户消息：气泡在左、头像在右，整体靠右，头像在气泡右上角 */
.ai-workshop-chat-message.is-user {
    justify-content: flex-end;
    flex-direction: row;
}

.ai-workshop-chat-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #2f3136;
    color: #ffffff;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
}

.ai-workshop-chat-message.is-user .ai-workshop-chat-avatar {
    margin-right: 0;
    margin-left: 6px;
    background-color: #6b8cff;
}

.ai-workshop-chat-bubble {
    max-width: 78%;
    border-radius: 10px;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.5;
}

.ai-workshop-chat-message.is-ai .ai-workshop-chat-bubble {
    background-color: #26272d;
    color: #f5f5f5;
}

.ai-workshop-chat-message.is-user .ai-workshop-chat-bubble {
    background-color: #6b8cff;
    color: #ffffff;
    text-align: right;
    margin-left: auto;
}

.ai-workshop-chat-name {
    font-size: 11px;
    opacity: 0.9;
    margin-bottom: 2px;
    display: none; /* 聊天名称不再单独显示，仅保留圆形头像上的文字 */
}

.ai-workshop-chat-message.is-user .ai-workshop-chat-name {
    text-align: right;
}

.ai-workshop-chat-message.is-user .ai-workshop-chat-text {
    text-align: right;
}

.ai-workshop-chat-text {
    font-size: 12px;
    word-break: break-word;
}

/* AI 消息内 Markdown 层级样式（标题、段落、列表） */
.ai-workshop-chat-text .ai-workshop-chat-md-h1,
.ai-workshop-chat-text .ai-workshop-chat-md-h2,
.ai-workshop-chat-text .ai-workshop-chat-md-h3 {
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-weight: bold;
    color: #f5f5f5;
    margin: 0.75em 0 0.35em;
    line-height: 1.3;
}

.ai-workshop-chat-text .ai-workshop-chat-md-h1 { font-size: 16px; }
.ai-workshop-chat-text .ai-workshop-chat-md-h2 { font-size: 14px; }
.ai-workshop-chat-text .ai-workshop-chat-md-h3 { font-size: 13px; }

.ai-workshop-chat-text .ai-workshop-chat-md-p {
    margin: 0.4em 0;
    line-height: 1.55;
}

.ai-workshop-chat-text .ai-workshop-chat-md-p:first-child { margin-top: 0; }
.ai-workshop-chat-text .ai-workshop-chat-md-p:last-child { margin-bottom: 0; }

.ai-workshop-chat-text .ai-workshop-chat-md-list {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.ai-workshop-chat-text .ai-workshop-chat-md-list li {
    margin: 0.25em 0;
    line-height: 1.5;
}

.ai-workshop-chat-text strong { font-weight: bold; color: #f5f5f5; }
.ai-workshop-chat-text em { font-style: italic; }
.ai-workshop-chat-text code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    padding: 0.15em 0.4em;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.25);
}

.ai-workshop-chat-input-area {
    margin-top: 2px;
}

.ai-workshop-chat-input {
    width: 100%;
    min-height: 60px;
    max-height: 96px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background-color: #141417;
    color: #f5f5f5;
    resize: vertical;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-size: 12px;
    line-height: 1.5;
    outline: none;
    box-sizing: border-box;
}

.ai-workshop-chat-input::placeholder {
    color: #777777;
}

.ai-workshop-chat-input:focus {
    border-color: rgba(107, 140, 255, 0.85);
    box-shadow: 0 0 0 1px rgba(107, 140, 255, 0.4);
}

/* 底部模型选择 + 发送按钮区域 */
.ai-workshop-chat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.ai-workshop-model-select-wrapper {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #cccccc;
}

.ai-workshop-model-select-label {
    white-space: nowrap;
}

.ai-workshop-model-select {
    flex: 1 1 auto;
    min-width: 0;
    height: 28px;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background-color: #141417;
    color: #f5f5f5;
    font-family: "Microsoft YaHei", "微软雅黑", "SimSun", "宋体", "Arial", sans-serif;
    font-size: 12px;
    outline: none;
}

.ai-workshop-model-select:focus {
    border-color: rgba(107, 140, 255, 0.85);
}

.ai-workshop-send-btn {
    flex: 0 0 auto;
    min-width: 68px;
    height: 30px;
    padding: 0 14px;
    border-radius: 16px;
    border: none;
    outline: none;
    background-color: #6b8cff;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(107, 140, 255, 0.4);
    transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.ai-workshop-send-btn:hover {
    background-color: #5578ee;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(107, 140, 255, 0.6);
}

.ai-workshop-send-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(107, 140, 255, 0.45);
}

.ai-workshop-send-btn:disabled {
    background-color: #3a3d42;
    box-shadow: none;
    cursor: default;
    opacity: 0.7;
}

/* 停止按钮：红色圆角，强调中断语义 */
.ai-workshop-stop-btn {
    flex: 0 0 auto;
    min-width: 60px;
    height: 30px;
    padding: 0 12px;
    border-radius: 16px;
    border: none;
    outline: none;
    background-color: #e85c5c;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(232, 92, 92, 0.45);
    transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.ai-workshop-stop-btn:hover {
    background-color: #d94b4b;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(232, 92, 92, 0.65);
}

.ai-workshop-stop-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(232, 92, 92, 0.4);
}

.ai-workshop-stop-btn:disabled {
    background-color: #3f3a3a;
    box-shadow: none;
    cursor: default;
    opacity: 0.7;
}
