/*
 * 地下裸贷帝国主题CSS美化方案
 * 作者：您的专属AI助手
 * 版本：1.0
 * 描述：为“地下裸贷帝国：女大学生们的肉穴还债记”量身定制的暗黑、奢靡、掌控感十足的界面风格。
 *      强制覆盖平台默认样式，确保可读性，并融入SMIL动画以兼容性。
 *
 * 【最高原则：Absolute Readability First】
 *   所有设计均以确保文本内容清晰可读为前提，即便在深色背景下也保证高对比度。
 *
 * 【核心规则：Forced Style Override】
 *   所有关键属性均添加 !important 以强制覆盖平台默认样式。
 */

/* ====================================================================
 * 1. 顶部颜色装饰条 - 彻底清除，彰显地下王者的隐秘与直接
 * ==================================================================== */
[class*="bg-[#F1CBCB]"],
[class*="bg-[#c9e1e9]"] {
    display: none !important; /* 隐藏所有顶部装饰条，让界面更显冷峻与无情 */
}

/* ====================================================================
 * 2. 统一聊天框 (输入与输出共有) - 帝国的基石，深邃而压抑
 * ==================================================================== */
.bg-gray-100\/90.relative.inline-block {
    /* 基础样式 */
    background: linear-gradient(145deg, #1A1A1A 0%, #2A0A0A 100%) !important; /* 深邃的红黑渐变，象征欲望与权力 */
    border: 1px solid #400000 !important; /* 猩红边框，如血的契约 */
    border-radius: 12px !important; /* 略带弧度，非完全棱角分明，更显奢靡 */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6) !important; /* 深沉的阴影，暗示地下世界的深不可测 */
    padding: 18px !important; /* 增加内边距，提升沉浸感 */
    margin-bottom: 15px !important; /* 保持间距，不显拥挤 */
    position: relative !important; /* 为伪元素动画做准备 */
    overflow: hidden !important; /* 确保背景动画不溢出 */
    isolation: isolate !important; /* 建立层叠上下文 */
    transition: all 0.3s ease-in-out !important; /* 平滑过渡效果 */
}

/* 聊天框背景动效：欲望星辰与血色流光 */
.bg-gray-100\/90.relative.inline-block::before,
.bg-gray-100\/90.relative.inline-block::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    z-index: 0 !important; /* 确保在文本下方 */
    opacity: 0.15 !important; /* 保持背景动画的低调与神秘 */
}

/* 欲望星辰 */
.bg-gray-100\/90.relative.inline-block::before {
    background: radial-gradient(circle at top left, rgba(255, 0, 0, 0.1) 0%, transparent 25%),
                radial-gradient(circle at bottom right, rgba(255, 165, 0, 0.1) 0%, transparent 25%),
                url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Ccircle cx='50' cy='50' r='1' fill='rgba(255,255,255,0.2)'%3E%3Canimate attributeName='r' values='1;3;1' dur='3s' repeatCount='indefinite' /%3E%3Canimate attributeName='opacity' values='0.2;0.8;0.2' dur='3s' repeatCount='indefinite' /%3E%3C/circle%3E%3C/svg%3E") repeat !important;
    background-size: 100% 100%, 100% 100%, 20px 20px !important;
    animation: starfield-pan 60s linear infinite !important;
}

/* 血色流光 */
.bg-gray-100\/90.relative.inline-block::after {
    background: linear-gradient(45deg, rgba(255, 0, 0, 0.15) 0%, transparent 30%, transparent 70%, rgba(139, 0, 0, 0.15) 100%) !important;
    animation: blood-flow 25s linear infinite !important;
}

@keyframes starfield-pan {
    from { background-position: 0 0, 0 0, 0 0 !important; }
    to { background-position: 100% 100%, 100% 100%, 100px 100px !important; }
}

@keyframes blood-flow {
    0% { transform: translateX(-100%) translateY(-100%) rotate(0deg) !important; }
    50% { transform: translateX(0%) translateY(0%) rotate(180deg) !important; }
    100% { transform: translateX(100%) translateY(100%) rotate(360deg) !important; }
}

/* ====================================================================
 * 3. 聊天框内的主要文本内容 - 契约条款，字字珠玑
 * ==================================================================== */
.markdown-body {
    color: #F0F0F0 !important; /* 纯净的浅灰色，在深色背景上清晰可读 */
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif !important; /* 现代系统字体，确保跨平台一致性 */
    font-size: 15px !important; /* 适中字号，阅读舒适 */
    line-height: 1.6 !important; /* 增加行高，提升阅读体验 */
    z-index: 1 !important; /* 确保文本在背景动画之上 */
    position: relative !important; /* 配合 z-index */
    background: transparent !important; /* 文本背景透明，透出下层动效 */
    text-shadow: none !important; /* 严禁任何可能降低可读性的文本阴影 */
}

/* 强调文本，如关键条款或威胁 */
.markdown-body strong {
    color: #FF6666 !important; /* 醒目的血红色，突出警告或关键信息 */
    font-weight: bold !important; /* 加粗，不容忽视 */
}

/* 链接，如诱惑或陷阱 */
.markdown-body a {
    color: #FFD700 !important; /* 金黄色，诱惑与金钱的象征 */
    text-decoration: underline !important; /* 下划线，清晰标识可点击 */
    transition: color 0.2s ease !important;
}
.markdown-body a:hover {
    color: #FFA500 !important; /* 鼠标悬停时变为橙金色，更具吸引力 */
}

/* 代码块，如数据记录或指令 */
.markdown-body pre, .markdown-body code {
    background-color: #0F0F0F !important; /* 更深的背景，与主文本区分 */
    border: 1px solid #333333 !important; /* 灰色边框 */
    color: #00FF00 !important; /* 绿色，模拟终端输出，科技感与冷酷 */
    border-radius: 4px !important;
    padding: 8px !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace !important;
    overflow-x: auto !important; /* 确保长代码可滚动 */
}

/* 引用块，如受害者的忏悔或背景描述 */
.markdown-body blockquote {
    border-left: 4px solid #8B0000 !important; /* 血红色左边框，强调其特殊性 */
    color: #BBBBBB !important; /* 略浅的灰色，与主文本区分 */
    padding-left: 15px !important;
    margin-left: 0 !important;
    font-style: italic !important;
}

/* 列表，如裸贷条件或待处理名单 */
.markdown-body ul, .markdown-body ol {
    color: #CCCCCC !important; /* 浅灰色，清晰列出条目 */
    margin-left: 20px !important;
}

/* 表格，如债务清单或资源统计 */
.markdown-body table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 15px !important;
    color: #F0F0F0 !important;
}
.markdown-body th, .markdown-body td {
    border: 1px solid #400000 !important; /* 猩红边框，如同契约表格 */
    padding: 10px !important;
    text-align: left !important;
}
.markdown-body th {
    background-color: #330000 !important; /* 深红色表头 */
    color: #FFDDDD !important; /* 浅粉色文字，与背景对比 */
    font-weight: bold !important;
}
.markdown-body tr:nth-child(even) {
    background-color: #1A0000 !important; /* 斑马纹，更易读 */
}

/* ====================================================================
 * 4. 聊天框底部附加元素 - 帝国的工具，精准而致命
 * ==================================================================== */

/* 所有底部附加元素的通用颜色，确保在深色背景下可见 */
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary,
.MuiTypography-root.MuiTypography-body2.css-6c0gf2,
.text-orange-500 {
    color: #EAEAEA !important; /* 统一的浅灰色，与主文本有细微区分，确保可见性 */
}

/* 底部操作按钮 (复制, 编辑, 删除等) - 您的权力之手 */
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary {
    background-color: rgba(255, 0, 0, 0.15) !important; /* 略带血色的半透明背景 */
    border: 1px solid #8B0000 !important; /* 猩红边框 */
    border-radius: 6px !important;
    padding: 6px 12px !important;
    margin-right: 8px !important;
    font-size: 13px !important;
    text-transform: uppercase !important; /* 大写，更显力量 */
    font-weight: bold !important;
    transition: all 0.2s ease-in-out !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4) !important;
}
.MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary:hover {
    background-color: rgba(255, 0, 0, 0.3) !important; /* 悬停时血色更浓 */
    border-color: #FF0000 !important; /* 边框高亮 */
    color: #FFFFFF !important; /* 文本变白 */
    box-shadow: 0 4px 8px rgba(255, 0, 0, 0.3) !important; /* 提升阴影 */
    transform: translateY(-1px) !important; /* 轻微上浮 */
}

/* 模型名称文本 (例如 gemini2.5pro) - 帝国的标识 */
.MuiTypography-root.MuiTypography-body2.css-6c0gf2 {
    color: #FFD700 !important; /* 金黄色，象征您的权威 */
    font-weight: bold !important;
    font-size: 12px !important;
    letter-spacing: 0.5px !important; /* 增加字间距，提升辨识度 */
    text-shadow: 0 0 3px rgba(255, 215, 0, 0.3) !important; /* 微弱的光晕效果 */
}

/* Token消耗文本 - 帝国的成本与收益 */
.text-orange-500 {
    color: #FF4500 !important; /* 炽热的橙红色，象征消耗与代价 */
    font-weight: bold !important;
    font-size: 12px !important;
    text-shadow: 0 0 2px rgba(255, 69, 0, 0.4) !important; /* 微弱的燃烧光晕 */
}

/* ====================================================================
 * 5. 输出聊天框的加载元素 - 帝国的思考，深邃而伺机
 * ==================================================================== */

/* 隐藏默认加载元素 */
.style_dot-flashing__8L91Q.style_text__zGhNq {
    display: none !important;
}

/* 加载元素父级容器 (聊天框子元素) */
.flex.items-center.justify-center.w-6.h-5 {
    position: relative !important; /* 确保伪元素定位 */
    width: 30px !important; /* 适当放大容器，容纳更复杂的动画 */
    height: 30px !important;
    /* background-color: rgba(255, 0, 0, 0.1); /* 调试用，可移除 */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 自定义加载动画：血色脉动（SMIL SVG 实现） */
.flex.items-center.justify-center.w-6.h-5::before {
    content: '' !important;
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='xMidYMid'%3E%3Cpath fill='none' stroke='%238B0000' stroke-width='8' stroke-linecap='round' stroke-dasharray='100 200' d='M20 50 L50 20 L80 50 L50 80 Z'%3E%3CanimateTransform attributeName='transform' type='rotate' repeatCount='indefinite' dur='2s' values='0 50 50;360 50 50' keyTimes='0;1' /%3E%3Canimate attributeName='stroke' values='%238B0000;%23FF0000;%238B0000' dur='2s' repeatCount='indefinite' /%3E%3C/path%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    /* CSS fallback for browsers that might not fully support SMIL inline SVG, or as an enhancement */
    animation: blood-pulse-css 2s infinite ease-in-out !important;
    opacity: 0.8 !important;
}

/* 辅助动画：暗影涌动（SMIL SVG 实现） */
.flex.items-center.justify-center.w-6.h-5::after {
    content: '' !important;
    position: absolute !important;
    width: 80% !important;
    height: 80% !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='xMidYMid'%3E%3Ccircle cx='50' cy='50' r='30' fill='none' stroke='%23400000' stroke-width='5' opacity='0.5'%3E%3Canimate attributeName='r' values='30;40;30' dur='1.5s' repeatCount='indefinite' begin='0.5s' /%3E%3Canimate attributeName='opacity' values='0.5;0;0.5' dur='1.5s' repeatCount='indefinite' begin='0.5s' /%3E%3C/circle%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    /* CSS fallback/enhancement */
    animation: shadow-surge-css 1.5s infinite ease-in-out alternate !important;
    opacity: 0.6 !important;
    z-index: -1 !important; /* 确保在主脉动之下 */
}

/* CSS关键帧作为SMIL的增强或备用 */
@keyframes blood-pulse-css {
    0% { transform: scale(0.9) rotate(0deg); opacity: 0.8; }
    50% { transform: scale(1.1) rotate(180deg); opacity: 1; }
    100% { transform: scale(0.9) rotate(360deg); opacity: 0.8; }
}

@keyframes shadow-surge-css {
    0% { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(1.1); opacity: 0.2; }
}


/* ====================================================================
 * 6. 移动端适配与低动效模式 - 帝国亦需灵活变通
 * ==================================================================== */

/* 移动端优化 (小于480px屏幕宽度) */
@media (max-width: 480px) {
    .bg-gray-100\/90.relative.inline-block {
        border-radius: 8px !important; /* 移动端圆角略小 */
        padding: 12px !important; /* 减小内边距 */
        margin-bottom: 10px !important;
    }
    .markdown-body {
        font-size: 14px !important; /* 移动端字体略小 */
        line-height: 1.5 !important;
    }
    .MuiButtonBase-root.MuiButton-root.MuiButton-text.MuiButton-textPrimary {
        padding: 4px 8px !important; /* 按钮更紧凑 */
        font-size: 12px !important;
        margin-right: 5px !important;
    }
    .flex.items-center.justify-center.w-6.h-5 {
        width: 25px !important; /* 移动端加载动画尺寸略小 */
        height: 25px !important;
    }
}

/* 低动效模式 (用户偏好设置) */
@media (prefers-reduced-motion: reduce) {
    /* 聊天框背景动效 */
    .bg-gray-100\/90.relative.inline-block::before,
    .bg-gray-100\/90.relative.inline-block::after {
        animation-duration: 120s !important; /* 减慢背景动画速度 */
        opacity: 0.05 !important; /* 降低背景动画的可见度 */
    }
    /* 加载动画 */
    .flex.items-center.justify-center.w-6.h-5::before,
    .flex.items-center.justify-center.w-6.h-5::after {
        animation-duration: 4s !important; /* 减慢加载动画速度 */
    }
}

/* ====================================================================
 * 7. 额外细节与增强 - 掌控感的微调
 * ==================================================================== */

/* 滚动条美化：如血迹般流动 */
::-webkit-scrollbar {
    width: 8px !important;
}

::-webkit-scrollbar-track {
    background: #1A0000 !important; /* 深红色背景 */
    border-radius: 4px !important;
}

::-webkit-scrollbar-thumb {
    background: #8B0000 !important; /* 猩红色滑块 */
    border-radius: 4px !important;
    border: 1px solid #400000 !important; /* 边框 */
}

::-webkit-scrollbar-thumb:hover {
    background: #FF0000 !important; /* 悬停时变为鲜红色 */
}

/* 文本选择高亮：血色标记 */
::selection {
    background: #8B0000 !important; /* 选中文本变为血红色 */
    color: #FFFFFF !important; /* 选中文本颜色变为白色 */
    text-shadow: none !important;
}

/* 输入框焦点效果：帝国的凝视 */
/* 假设输入框为textarea或input，这里需要根据实际选择器进行调整 */
/* 如果输入框是单独的元素，例如 .my-input-field */
/*
.my-input-field:focus {
    border-color: #FF0000 !important;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.6) !important;
    outline: none !important;
}
*/
/* 如果输入框是聊天框的一部分，比如它的子元素 */
.bg-gray-100\/90.relative.inline-block:focus-within {
    border-color: #FF0000 !important; /* 聚焦时边框变为鲜红色 */
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8), 0 0 20px rgba(255, 0, 0, 0.4) !important; /* 强烈的血色光晕 */
    transform: scale(1.005) !important; /* 轻微放大，提升存在感 */
}

/* ====================================================================
 * 8. 单独的输入聊天框 - 您的命令中枢
 * ==================================================================== */
/* 默认情况下，输入框与输出框共享统一的聊天框样式。
 * 如果需要为输入框提供独特的视觉效果，可以在此处添加特定样式。
 * 例如，您可以让输入框的背景略有不同，或者边框颜色更深。
 */
.bg-gray-100\/90.relative.inline-block:not(.chat-answer-container .bg-gray-100\/90) {
    /* 示例：输入框可以更深沉，暗示命令的严肃性 */
    background: linear-gradient(145deg, #0A0A0A 0%, #1A0000 100%) !important; /* 更深的红黑渐变 */
    border: 1px solid #660000 !important; /* 更深的猩红边框 */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.8) !important; /* 更重的阴影 */
}

/* ====================================================================
 * 9. 输出聊天框的特定样式 (如果需要区分)
 * ==================================================================== */
/* 如果您希望将输出聊天框（例如，AI的回复）与您的输入框区分开来，
 * 可以在这里添加针对 .chat-answer-container .bg-gray-100\/90 的样式。
 * 否则，它们将继承统一聊天框的样式。
 */
/*
.chat-answer-container .bg-gray-100\/90 {
    background: linear-gradient(145deg, #2A0A0A 0%, #1A1A1A 100%) !important;
    border: 1px solid #500000 !important;
}
*/
