/* Agent 相关样式 */

/* Markdown渲染样式 */
.agent-message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background-color: var(--surface-color);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    font-size: 0.75rem;  /* 基准字体大小 12px */
    line-height: 1.5;
    max-width: 85%;
    position: relative;
    transition: all 0.2s ease;
}

.agent-message:hover {
    box-shadow: var(--shadow-md);
}

.agent-message h1,
.agent-message h2,
.agent-message h3 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 500;
    color: inherit;
    line-height: 1.3;
}

.agent-message h1 {
    font-size: 1.2em;  /* 14.4px */
    padding-bottom: 0.375em;
    border-bottom: 1px solid var(--border-color);
}

.agent-message h2 {
    font-size: 1.1em;  /* 13.2px */
}

.agent-message h3 {
    font-size: 1em;    /* 12px */
}

.agent-message p {
    margin-bottom: 0.75em;
    font-size: 1em;    /* 12px */
}

.agent-message p:last-child {
    margin-bottom: 0;
}

.agent-message ul,
.agent-message ol {
    margin: 0.75em 0;
    padding-left: 1.5em;
    font-size: 1em;    /* 12px */
}

.agent-message li {
    margin-bottom: 0.375em;
}

.agent-message li:last-child {
    margin-bottom: 0;
}

.agent-message blockquote {
    border-left: 2px solid var(--primary-color);
    padding: 0.5em 0.75em;
    margin: 0.75em 0;
    background-color: rgba(59, 130, 246, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

.agent-message pre {
    margin: 0.75em 0;
    padding: 12px;
    border-radius: var(--radius-sm);
    background-color: var(--code-bg);
    overflow-x: auto;
}

.agent-message pre code {
    padding: 0;
    background: none;
    font-size: 0.9167em;  /* 11px */
    line-height: 1.5;
}

.agent-message code {
    font-family: var(--font-mono);
    font-size: 0.9167em;  /* 11px */
    padding: 0.2em 0.4em;
    border-radius: var(--radius-sm);
    background-color: var(--code-bg);
    color: var(--code-color);
}

.agent-message table {
    width: 100%;
    margin: 0.75em 0;
    border-collapse: collapse;
    font-size: 0.75rem;
    background-color: var(--surface-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.agent-message th,
.agent-message td {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.agent-message th {
    background-color: var(--background-color);
    font-weight: 500;
    color: var(--text-primary);
}

.agent-message tr:nth-child(even) {
    background-color: var(--background-color);
}

.p{
    font-size: 0.425rem;
    margin-bottom: 0;
    padding-bottom: 0;
}

.agent-message img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 0.75em 0;
}

.agent-message a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.agent-message a:hover {
    border-bottom-color: var(--primary-color);
}

.agent-message hr {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 1em 0;
}

.agent-message.user-message {
    background-color: var(--primary-color);
    color: white;
    margin-left: auto;
    max-width: 75%;
    border-radius: var(--radius-md) var(--radius-md) 0 var(--radius-md);
}

.agent-message.user-message code {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.agent-message.error-message {
    background-color: #FEF2F2;
    border: 1px solid #FCA5A5;
    color: #991B1B;
}

/* AI助手对话区域 */
#agent-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
}

/* 聊天输入区域 */
.chat-controls {
    flex: 0 0 auto;
    background-color: var(--surface-color);
    padding: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* 确保消息容器正确滚动 */
.panel-content.d-flex.flex-column {
    overflow: hidden;
}

.content-card.scrollable.flex-grow-1 {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.input-group {
    display: flex;
    gap: 8px;
}

.input-group input[type="text"] {
    flex: 1;
    height: 32px;
    padding: 0 12px;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--surface-color);
    transition: all 0.2s ease;
}

.input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.input-group .btn {
    height: 32px;
    padding: 0 12px;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .agent-message {
        max-width: 90%;
        padding: 10px 12px;
        font-size: 0.6875rem;
    }

    .agent-message.user-message {
        max-width: 80%;
    }

    #agent-content {
        padding: 12px;
        gap: 10px;
    }

    .chat-controls {
        padding: 10px;
    }

    .input-group input[type="text"],
    .input-group .btn {
        height: 28px;
        padding: 0 10px;
        font-size: 0.6875rem;
    }
} 

/* Mermaid 图表样式 */
.agent-message .mermaid {
    background-color: var(--background-color);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin: 0.75em 0;
    overflow-x: auto;
    text-align: center;
}

.agent-message .mermaid svg {
    max-width: 100%;
    height: auto;
}

/* 确保图表中的文字清晰可读 */
.agent-message .mermaid .node rect,
.agent-message .mermaid .node circle,
.agent-message .mermaid .node ellipse,
.agent-message .mermaid .node polygon,
.agent-message .mermaid .node path {
    fill: var(--surface-color);
    stroke: var(--primary-color);
    stroke-width: 1px;
}

.agent-message .mermaid .node text {
    fill: var(--text-primary);
    font-size: 12px;
}

.agent-message .mermaid .edgeLabel {
    background-color: var(--surface-color);
    color: var(--text-primary);
}

.agent-message .mermaid .edgePath path {
    stroke: var(--primary-color);
    stroke-width: 1px;
}

.agent-message .mermaid .edgePath marker {
    fill: var(--primary-color);
} 