/* 
============================================================
  东京爱情故事 · 浅色系聊天框美化
  柔焦米白 + 樱花粉晕染 · 日系温暖舒适风
  所有样式均已添加 !important 确保覆盖平台默认
============================================================
*/

/* ========== 1. 移除顶部彩色装饰条 ========== */
[class*="bg-[#F1CBCB]"],
[class*="bg-[#c9e1e9]"] {
    display: none !important;
}

/* ========== 2. 统一聊天框（输入 + 输出）基础美化 ========== */
.bg-gray-100\/90.relative.inline-block {
    background: #fdf8f4 !important;
    /* 米白底，带一点点暖粉 */;
    border-radius: 18px !important;
    box-shadow:
        0 4px 20px rgba(200, 160, 150, 0.15),
        0 1px 4px rgba(200, 160, 150, 0.08) !important;
    border: 1px solid rgba(230, 200, 190, 0.3) !important;
    padding: 16px 20px !important;
    transition: box-shadow 0.3s ease !important;
    backdrop-filter: blur(2px) !important;
}

/* 悬停时柔光微漾 */
.bg-gray-100\/90.relative.inline-block:hover {
    box-shadow:
        0 8px 32px rgba(200, 160, 150, 0.2),
        0 2px 8px rgba(200, 160, 150, 0.1) !important;
}

/* ========== 3. 单独的输入聊天框 ========== */
.bg-gray-100\/90.relative.inline-block:not(.chat-answer-container .bg-gray-100\/90) {
    background: #faf5f0 !important;
    border: 1px solid rgba(220, 190, 180, 0.25) !important;
    border-radius: 18px !important;
}

/* ========== 4. 聊天框内主要文本（markdown-body） ========== */
.markdown-body {
    color: #3d2e2a !important;
    /* 温暖深褐，高对比可读 */;
    font-family: "Hiragino Sans", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    line-height: 1.8 !important;
    letter-spacing: 0.02em !important;
    background: transparent !important;
    position: relative !important;
    z-index: 1 !important;
    /* 禁止任何可能模糊文本的阴影 */;
    text-shadow: none !important;
    -webkit-font-smoothing: antialiased !important;
}

/* 文本加粗样式 */
.markdown-body strong {
    color: #b45a4a !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
}

/* 链接颜色 - 柔和赤色 */
.markdown-body a {
    color: #c06a5a !important;
    border-bottom: 1px dashed rgba(192, 106, 90, 0.3) !important;
    text-decoration: none !important;
}

.markdown-body a:hover {
    color: #a84e3e !important;
    border-bottom-color: #a84e3e !important;
}

/* 列表符号 */
.markdown-body li::marker {
    color: #dba89a !important;
}

/* ========== 5. 代码块（清爽日系风格） ========== */
.markdown-body pre,
.markdown-body code {
    font-family: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", monospace !important;
    font-size: 14px !important;
    background: #f7f0eb !important;
    /* 暖米灰底 */;
    color: #3d2e2a !important;
    border-radius: 12px !important;
    border: 1px solid rgba(210, 180, 170, 0.2) !important;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.02) !important;
    padding: 16px 20px !important;
    line-height: 1.7 !important;
}

.markdown-body code {
    padding: 2px 8px !important;
    font-size: 13.5px !important;
    border-radius: 6px !important;
    background: #f3eae5 !important;
    color: #b45a4a !important;
}

.markdown-body pre code {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #3d2e2a !important;
}

/* 代码语法高亮颜色微调（针对 platform 内置高亮类） */
.markdown-body .hljs {
    background: transparent !important;
    color: #3d2e2a !important;
}

.markdown-body .hljs-keyword {
    color: #b45a4a !important;
    font-weight: 600 !important;
}

.markdown-body .hljs-string {
    color: #7a8b6f !important;
}

.markdown-body .hljs-comment {
    color: #ab9a92 !important;
    font-style: italic !important;
}

.markdown-body .hljs-number {
    color: #c08a6a !important;
}

.markdown-body .hljs-title {
    color: #6a7b8f !important;
}

/* ========== 6. 底部附加元素（按钮、模型名、Token） ========== */

/* 操作按钮（复制、编辑、删除等） */
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary {
    color: #b08a7a !important;
    font-weight: 500 !important;
    font-size: 12.5px !important;
    letter-spacing: 0.04em !important;
    padding: 4px 10px !important;
    border-radius: 20px !important;
    background: rgba(230, 210, 200, 0.15) !important;
    transition: all 0.25s ease !important;
    min-width: auto !important;
}

.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary:hover {
    background: rgba(220, 190, 180, 0.3) !important;
    color: #9a6a5a !important;
    transform: translateY(-1px) !important;
}

/* 模型名称文本 */
.MuiTypography-root.MuiTypography-body2.css-6c0gf2 {
    color: #b08a7a !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    letter-spacing: 0.06em !important;
    background: rgba(230, 210, 200, 0.15) !important;
    padding: 2px 12px !important;
    border-radius: 30px !important;
    display: inline-block !important;
}

/* Token 消耗文本 */
.text-orange-500 {
    color: #c08a6a !important;
    font-size: 12px !important;
    font-weight: 400 !important;
    background: rgba(240, 220, 210, 0.2) !important;
    padding: 2px 10px !important;
    border-radius: 30px !important;
}

/* ========== 7. 自定义加载动画 ========== */
/* 樱花飘落 · SMIL 内联 SVG（CSS动画禁用时依然运动） */

/* 先隐藏默认加载点 */
.style-module__AtdJSq__dot-flashing.style-module__AtdJSq__text {
    display: none !important;
}

/* 加载动画容器 */
.flex.items-center.justify-center.w-6.h-5 {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 64px !important;
    min-height: 48px !important;
    height: auto !important;
    padding: 8px 0 !important;
}

/* 使用 ::before 嵌入 SMIL SVG 动画（樱花飘落）+ CSS 增强 */
.flex.items-center.justify-center.w-6.h-5::before {
    content: '';
    display: block !important;
    width: 48px !important;
    height: 48px !important;
    background: transparent !important;
    /* 
      SMIL 动画：两片樱花上下飘动 + 淡入淡出
      CSS动画增强：在支持时叠加旋转与浮动
    */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' width='100' height='100'%3E%3Cdefs%3E%3Cpath id='petal' d='M50 10 C35 25, 20 35, 25 50 C30 65, 45 70, 50 55 C55 70, 70 65, 75 50 C80 35, 65 25, 50 10Z' fill='%23f5c8c0' opacity='0.85'/%3E%3C/defs%3E%3Cg%3E%3Cuse href='%23petal' x='0' y='0'%3E%3CanimateTransform attributeName='transform' type='translate' values='0,0; 4,-10; 0,0' dur='2.4s' repeatCount='indefinite'/%3E%3Canimate attributeName='opacity' values='0.4;0.9;0.4' dur='2.4s' repeatCount='indefinite'/%3E%3Cuse href='%23petal' x='20' y='20'%3E%3CanimateTransform attributeName='transform' type='translate' values='0,0; -4,-8; 0,0' dur='2.8s' repeatCount='indefinite'/%3E%3Canimate attributeName='opacity' values='0.5;0.85;0.5' dur='2.8s' repeatCount='indefinite'/%3E%3C/g%3E%3Cg%3E%3Cuse href='%23petal' x='50' y='10'%3E%3CanimateTransform attributeName='transform' type='translate' values='0,0; 5,-12; 0,0' dur='3.2s' repeatCount='indefinite'/%3E%3Canimate attributeName='opacity' values='0.3;0.8;0.3' dur='3.2s' repeatCount='indefinite'/%3E%3C/g%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    /* 
      CSS 增强：在动效未禁用时叠加柔和旋转 
      使用 transform-origin 确保围绕中心
    */
    transform-origin: center center !important;
    animation: tokyo-sakura-float 3.6s ease-in-out infinite !important;
}

/* CSS 增强关键帧（不影响 SMIL 主动画） */
@keyframes tokyo-sakura-float {
    0%,
    100% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(8deg) scale(1.04);
    }
    50% {
        transform: rotate(-4deg) scale(0.96);
    }
    75% {
        transform: rotate(6deg) scale(1.02);
    }
}

/* 低动效模式：降低幅度，但不关闭 */
@media (prefers-reduced-motion: reduce) {
    .flex.items-center.justify-center.w-6.h-5::before {
        animation: tokyo-sakura-float-reduced 4.8s ease-in-out infinite !important;
    }
    @keyframes tokyo-sakura-float-reduced {
        0%,
        100% {
            transform: rotate(0deg) scale(1);
        }
        50% {
            transform: rotate(3deg) scale(1.01);
        }
    }
}

/* ========== 8. 移动端适配 ========== */
@media (max-width: 480px) {
    .bg-gray-100\/90.relative.inline-block {
        padding: 12px 14px !important;
        border-radius: 14px !important;
    }
    .markdown-body {
        font-size: 14.5px !important;
        line-height: 1.7 !important;
    }
    .markdown-body pre,
    .markdown-body code {
        font-size: 13px !important;
        padding: 12px 14px !important;
    }
    .flex.items-center.justify-center.w-6.h-5 {
        min-height: 40px !important;
    }
    .flex.items-center.justify-center.w-6.h-5::before {
        width: 40px !important;
        height: 40px !important;
    }
    /* 按钮在移动端更紧凑 */
    .MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary {
        font-size: 11.5px !important;
        padding: 2px 8px !important;
    }
}