
/* 响应式调整 */
@media (max-width: 767px) {
    .message-bubble {
        padding: 8px 0;
        font-size: 0.95rem;
    }

    pre.hljs {
        margin: 12px 0;
        padding: 12px;
        font-size: 0.8rem;
    }

    pre.hljs .js-copy-btn {
        padding: 4px 8px;
        font-size: 0.75rem
    }
}


.message-bubble {
    padding: 12px 0;
    line-height: 1.5;
    transition: opacity 0.3s ease;
    font-weight: 600;
}
/* 代码高亮样式 */
pre.hljs {
    border-radius: 10px;
    margin: 15px 0;
    padding: 16px;
    position: relative;
    overflow: auto;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

pre.hljs:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.io-grey-mode pre.hljs {
    background-color: #f3f3f3;
}

.io-grey-mode pre.hljs code {
    background-color: #f3f3f3;
}

.io-grey-mode pre.hljs code span {
    color: #000;
}

.io-black-mode pre.hljs {
    background-color: #000;
}

.io-black-mode pre.hljs code {
    background-color: #000;
    color: #f3f3f3
}


.io-black-mode pre.hljs:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

pre.hljs code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* 复制按钮 */
pre.hljs .js-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.7;
}

pre.hljs:hover .js-copy-btn {
    opacity: 1;
}


.io-grey-mode pre.hljs .js-copy-btn {
    background-color: rgba(229, 229, 229, 0.8);
    color: #000;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.io-black-mode pre.hljs .js-copy-btn {
    background-color: rgba(52, 53, 65, 0.8);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.io-grey-mode pre.hljs .js-copy-btn:hover {
    background-color: #e0e0e0;
    color: #19c37d;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.io-black-mode pre.hljs .js-copy-btn:hover {
    background-color: #40414f;
    color: #19c37d;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.js-copy-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Markdown 渲染样式优化 */
.message-bubble .markdown-content {
    /* 基础样式 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.95rem;
    padding-left: 0;
}

/* 段落和列表样式调整 */
.message-bubble p {
    margin-top: 0;
    margin-bottom: 5px;
    line-height: 1.35;
}

/* 段落之间的间隔 */
.message-bubble p + p {
    margin-top: 10px;
}

/* 调整列表样式 */
.message-bubble ul,
.message-bubble ol {
    padding-left: 1.5em;
    margin-top: 8px;
    margin-bottom: 8px;
}

.message-bubble li {
    margin-bottom: 4px;
}

.message-bubble li > ul,
.message-bubble li > ol {
    margin-top: 4px;
    margin-bottom: 0;
}

/* 标题样式 - 更紧凑 */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
    font-weight: 600;
    line-height: 1.2;
    border: none;
    background: none;
    padding: 0;
    font-size: 1.05rem;
}

/* 表格样式 - 更美观 */
.message-bubble table {
    border-collapse: separate;
    width: 100%;
    margin: 1em 0;
    overflow-x: auto;
    display: block;
    font-size: 0.9em;
    border-radius: 8px;
    border-spacing: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.io-black-mode .message-bubble table {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.message-bubble table th {
    background-color: rgba(0, 0, 0, 0.03);
    font-weight: 600;
}

.io-black-mode .message-bubble table th {
    background-color: rgba(255, 255, 255, 0.08);
}

.message-bubble table th,
.message-bubble table td {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    text-align: left;
}

.io-black-mode .message-bubble table th,
.io-black-mode .message-bubble table td {
    border-color: #444;
}

.message-bubble table tr:first-child th:first-child {
    border-top-left-radius: 8px;
}

.message-bubble table tr:first-child th:last-child {
    border-top-right-radius: 8px;
}

.message-bubble table tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.message-bubble table tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

/* 引用块样式 - 更美观 */
.message-bubble blockquote {
    margin: 10px 0;
    padding: 10px 15px;
    color: #6a737d;
    border-left: 4px solid #dfe2e5;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 0 8px 8px 0;
}

.io-black-mode .message-bubble blockquote {
    border-left-color: #4b5563;
    background-color: rgba(255, 255, 255, 0.05);
    color: #a0aec0;
}

/* 水平线 */
.message-bubble hr {
    height: 1px;
    padding: 0;
    margin: 20px 0;
    background-color: #e1e4e8;
    border: 0;
    border-radius: 1px;
}

.io-black-mode .message-bubble hr {
    background-color: #4b5563;
}

/* 图片 */
.message-bubble img {
    max-width: 18%;  /* PC端默认显示更小的图片 */
    box-sizing: content-box;
    background-color: #fff;
    border-radius: 8px;
    margin: 8px 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    clear: both;
    display: block;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .message-bubble img {
        max-width: 45%;  /* 移动端显示更大的图片以便查看 */
    }
}

.message-bubble img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.io-black-mode .message-bubble img {
    background-color: #2d333b;
    border-color: rgba(255, 255, 255, 0.1);
}

.io-black-mode .message-bubble img:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* 图片预览模态框样式 */
.image-preview-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
}

.image-preview-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.image-preview-content {
    max-width: 85%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    animation: fadeIn 0.3s;
    display: block;
    margin: 0 auto;
}

.image-preview-caption {
    margin-top: 15px;
    color: white;
    font-size: 1rem;
    text-align: center;
    max-width: 80%;
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.image-preview-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 10000;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
}

.image-preview-close:hover {
    color: #19c37d;
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.5);
}

@keyframes fadeIn {
    from {opacity: 0; transform: scale(0.9);}
    to {opacity: 1; transform: scale(1);}
}

/* 使图片有可点击的视觉提示 */
.message-bubble img {
    cursor: pointer;
}
