﻿:root {
    --cl-chatbox-font-size: 16px;
}

ul{
    list-style:none;
}

/* 메시지 텍스트에 애니메이션 적용 */
.cl-chatbox--bubble--left .clc-chat-message-text {
    color: #333;
}
.cl-chatbox--bubble--right .clc-chat-message-text {
    padding: 0.9375rem;
}
.ivy-answer .answer-view .clc-chat-message-text {
    padding: 0.9375rem;
}

.clc-chat-message-text {
    font-family: 'Pretendard';
    line-height: 1.6;
    padding: 0 0.3rem;
    font-size: var(--cl-chatbox-font-size);
    box-sizing: border-box;
}

    /* 내부 모든 요소 기본 리셋 */
    .clc-chat-message-text * {
        margin: 0;
        padding: 0;
        box-sizing: inherit;
    }

    /* 문단 및 일반 텍스트 */
    .clc-chat-message-text p {
        line-height: 1.7;
        font-size:var(--cl-chatbox-font-size);
    }

    /* 헤딩 (h1 ~ h6) 스타일 */
    .clc-chat-message-text h1,
    .clc-chat-message-text h2,
    .clc-chat-message-text h3,
    .clc-chat-message-text h4,
    .clc-chat-message-text h5,
    .clc-chat-message-text h6 {
        margin: 20px 0 10px;
        font-weight: bold;
        line-height: 1.2;
    }

    .clc-chat-message-text h1 {
        font-size: 1.5em;
        border-bottom: 2px solid #e0e0e0;
        padding-bottom: 10px;
    }

    .clc-chat-message-text h2 {
        font-size: 1.4em;
    }

    .clc-chat-message-text h3 {
        font-size: 1.25em;
    }

    .clc-chat-message-text h4 {
        font-size: 1.1em;
    }

    .clc-chat-message-text h5 {
        font-size: 1em;
    }

    .clc-chat-message-text h6 {
        font-size: 0.85em;
    }

    /* 수평선 */
    .clc-chat-message-text hr {
        border: none;
        border-top: 1px dashed #ddd;
        margin: 20px 0;
    }

    /* 목록 스타일 (순서, 무순서, 중첩 목록 포함) */
    .clc-chat-message-text ul,
    .clc-chat-message-text ol {
        margin: 10px 0 10px 20px;
        padding: 0;
        list-style-position: outside;
    }

    .clc-chat-message-text li {
        margin: 8px 0;
    }

    /* 링크 스타일 */
    .clc-chat-message-text a {
        color: #007acc;
        text-decoration: none;
        transition: color 0.3s;
    }

        .clc-chat-message-text a:hover {
            color: #005999;
            text-decoration: underline;
        }

    /* 이미지 스타일 */
    .clc-chat-message-text img {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 16px 0;
        border: 1px solid #ddd;
        border-radius: 4px;
    }
.chat-message--bubble_imgwrap {
    padding: 0.9375rem 1.5625rem 0;
}
.chat-message--bubble_imgwrap p{
    color: #333;
}
/* 인용문 (blockquote) 스타일 */
.clc-chat-message-text blockquote {
    border-left: 4px solid #ccc;
    padding-left: 15px;
    margin: 16px 0;
    /*background-color: #f9f9f9;
    color: #666;
    font-style: italic;*/
}

    /* 인라인 코드 스타일 */
    .clc-chat-message-text code {
        background-color: #f4f4f4;
        color: #c7254e;
        padding: 2px 4px;
        font-family: Consolas, 'Courier New', monospace;
        border-radius: 3px;
        font-size: 0.95em;
    }

    /* 코드 블록 및 다중 줄 코드 */
.clc-chat-message-text pre {
    background-color: var(--clc-assign-base-50);
    text-shadow: none;
    padding: 15px;
    overflow-x: auto;
    border-radius: 5px;
    margin: 16px 0;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.95em;
    line-height: 1.5;
}

        /* 코드 블록 내부의 code 태그 */
        .clc-chat-message-text pre code {
            background: none;
            padding: 0;
            border: none;
            color: inherit;
            overflow-x:auto;
        }

    /* 표 스타일 */
    .clc-chat-message-text table {
        width: 100%;
        border-collapse: collapse;
        margin: 16px 0;
    }

    .clc-chat-message-text th,
    .clc-chat-message-text td {
        border: 1px solid #ddd;
        padding: 10px;
        text-align: left;
    }

    .clc-chat-message-text th {
        background-color: #f5f5f5;
    }

    /* 체크박스 및 작업 목록 스타일 */
    .clc-chat-message-text .contains-task-list {
        list-style: none;
        padding-left: 0;
    }

    .clc-chat-message-text .task-list-item {
        display: flex;
        align-items: center;
        margin: 8px 0;
    }

        .clc-chat-message-text .task-list-item input[type="checkbox"] {
            margin-right: 10px;
        }

    /* 이모지 등 특수문자 스타일 (필요시 추가 가능) */
    .clc-chat-message-text li {
        /* 이모지의 크기나 간격 등 추가 디자인을 여기에 적용 */
    }

    /* HTML 태그 내 인라인 스타일 보완 */
    .clc-chat-message-text [style] {
        /* 인라인 스타일을 기본 스타일과 조화롭게 보이도록 설정 */
        color: inherit;
        font-size: inherit;
    }

    /* 텍스트 강조 */
    .clc-chat-message-text strong {
        font-weight: bold;
    }

    .clc-chat-message-text em {
        font-style: italic;
    }

    .clc-chat-message-text del {
        text-decoration: line-through;
    }

    /* 전반적인 부드러운 렌더링 */
    .clc-chat-message-text *:not(pre) {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

/* KaTeX 수학 렌더링 스타일 */

/* 기본 수학 표기법 컨테이너 스타일 */
.math-inline, .math-block {
    font-family: 'KaTeX_Math', 'Times New Roman', serif;
    line-height: 1.5;
}

/* 인라인 수학 표기법 스타일 */
.math-inline {
    display: inline-block;
    vertical-align: middle;
    padding: 0 3px;
}

/* 블록 수학 표기법 스타일 */
.math-block {
    display: block;
    margin: 1em 0;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
}

/* 수학 섹션 제목 스타일 */
.math-section-title {
    font-weight: bold;
    color: #2c3e50;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

/* KaTeX 공식 레이아웃 수정 */
.katex-display {
    margin: 1em 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
}

    /* 공식이 큰 경우 가로 스크롤 처리 */
    .katex-display > .katex {
        max-width: 100%;
    }

/* 수식 내 HTML 태그 렌더링 스타일 */
.html-tag-in-math {
    font-family: monospace;
    color: #888;
    background-color: #f8f9fa;
    padding: 0 3px;
    border-radius: 3px;
}

/* 수학 표기법 에러 메시지 스타일 */
.katex-error {
    color: #e74c3c;
    border: 1px solid #e74c3c;
    padding: 0.2em 0.5em;
    border-radius: 3px;
    background-color: #fdecea;
    font-family: monospace;
    font-size: 0.9em;
}

/* 모바일 화면에서의 수식 조정 */
@media (max-width: 768px) {
    .math-block, .katex-display {
        font-size: 0.9em;
    }
}

/* 다크모드 대응 */
@media (prefers-color-scheme: dark) {
    .math-section-title {
        color: #e0e0e0;
        border-bottom-color: #444;
    }

    .html-tag-in-math {
        background-color: #2a2a2a;
        color: #aaa;
    }

    .katex-error {
        background-color: rgba(231, 76, 60, 0.2);
        color: #ff6b6b;
        border-color: #e74c3c;
    }
}
