/* =========================================================
   CLERICAL & PARCHMENT UI - 白圣女与黑牧师主题美化协议
   ========================================================= */

/* ---------------------------------------------------------
   1. 消息气泡区 (Message Bubbles) - 牧师的黑袍与圣女的白羽
   --------------------------------------------------------- */
/* 用户消息气泡：劳伦斯牧师的深褐外衣 + 圣经皮质质感 */
#customized-question-content {
    background: linear-gradient(135deg, #4a3c31 0%, #382d24 100%) !important;
    border-left: 4px solid #d4a359 !important;
    border-radius: 4px 16px 16px 16px !important;
    box-shadow: 0 4px 15px rgba(74, 60, 49, 0.15), inset 0 0 15px rgba(255, 255, 255, 0.05) !important;
}

/* AI消息气泡：塞西莉娅的圣女白羽 + 温暖圣光柔和光晕 */
#customized-answer-content {
    background: linear-gradient(135deg, #fffdf9 0%, #f7f1e8 100%) !important;
    border-right: 4px solid #d4a359 !important;
    border-radius: 16px 4px 16px 16px !important;
    box-shadow: 0 4px 20px rgba(212, 163, 89, 0.12), 0 0 10px rgba(212, 163, 89, 0.08) !important;
}

/* 隐藏原本的顶部粉/青色装饰条 */
#customized-question-content .bg-\[\#c9e1e9\],
#customized-answer-content .bg-\[\#F1CBCB\] {
    display: none !important;
}

/* 消息正文文本：确保羊皮卷与深色背景下的高对比度可读性 */
#customized-question-content .text-gray-900,
#customized-question-content .markdown-body {
    color: #fbf9f6 !important;
    font-family: "Georgia", "Times New Roman", serif, system-ui !important;
    text-shadow: 0 1px 1px rgba(0,0,0,0.5) !important;
}
#customized-answer-content .text-gray-900,
#customized-answer-content .markdown-body {
    color: #4a3c31 !important;
    font-family: "Georgia", "Times New Roman", serif, system-ui !important;
}

/* 消息操作按钮 - 温暖的黄金微光悬浮反馈 */
#customized-answer-content button,
#customized-question-content button {
    color: #a09080 !important;
    transition: all 0.3s ease !important;
}
#customized-answer-content button:hover {
    color: #d4a359 !important;
    filter: drop-shadow(0 0 4px rgba(212, 163, 89, 0.6)) !important;
}
#customized-question-content button:hover {
    color: #f7f1e8 !important;
    filter: drop-shadow(0 0 4px rgba(247, 241, 232, 0.8)) !important;
}

/* 模型名称与Token消耗 - 圣典章节式设计 */
#customized-answer-content .text-purple-500.mt-1 .MuiTypography-body2:first-child {
    color: #d4a359 !important;
    font-weight: bold !important;
    letter-spacing: 0.5px !important;
    font-family: "Georgia", serif !important;
}
#customized-answer-content .text-orange-500 {
    color: #4a3c31 !important;
    background: #f1e5d5 !important;
    padding: 2px 8px !important;
    border-radius: 4px !important;
    border: 1px solid #d4a359 !important;
    font-size: 11px !important;
}

/* ---------------------------------------------------------
   2. 加载动画 (Loading Animation) - 圣女祈祷中
   --------------------------------------------------------- */
/* 隐藏默认点阵动画 */
#customized-answer-content [class*="dot-flashing"] {
    display: none !important;
}

/* 注入 SVG SMIL 圣光呼吸文字动画 */
#customized-answer-content .flex.items-center.justify-center.w-6.h-5 {
    width: 220px !important;
    height: 24px !important;
    position: relative !important;
    justify-content: flex-start !important;
}

#customized-answer-content .flex.items-center.justify-center.w-6.h-5::before {
    content: '';
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    /* 温暖金色的 [圣女祈祷中... ✨] 呼吸动效 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='24'%3E%3Ctext x='0' y='17' fill='%23d4a359' font-family='Georgia, serif' font-size='13' font-weight='bold' letter-spacing='1'%3E[ 圣女祈祷中... ✨ ]%3Canimate attributeName='opacity' values='0.3;1;0.3' dur='2s' repeatCount='indefinite'/%3E%3C/text%3E%3C/svg%3E") !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: left center !important;
}

/* ---------------------------------------------------------
   3. 界面控制区 (UI Control Area) - 教堂的暖阳与红茶
   --------------------------------------------------------- */
/* 顶部控制栏 - 圣洁羊皮卷毛玻璃 */
.sticky.top-0 {
    background: rgba(246, 238, 227, 0.82) !important;
    backdrop-filter: blur(12px) !important;
    border-bottom: 2px solid rgba(212, 163, 89, 0.3) !important;
    box-shadow: 0 4px 15px rgba(74, 60, 49, 0.05) !important;
}
#customized-model-selector .truncate {
    color: #4a3c31 !important;
    font-weight: bold !important;
    font-family: "Georgia", serif !important;
}

/* 底部输入框 - 温暖信笺风格 */
.bg-white.border-\[1\.5px\] {
    background-color: transparent !important;
    border: none !important;
}
#ai-chat-input {
    background-color: #fffdfa !important;
    border: 1.5px solid #e2d4c5 !important;
    color: #4a3c31 !important;
    border-radius: 8px !important;
    box-shadow: inset 0 2px 4px rgba(74, 60, 49, 0.03) !important;
    transition: all 0.3s ease !important;
}
#ai-chat-input:focus {
    border-color: #d4a359 !important;
    box-shadow: 0 0 8px rgba(212, 163, 89, 0.3), inset 0 2px 4px rgba(74, 60, 49, 0.03) !important;
    outline: none !important;
}
#ai-chat-input::placeholder {
    color: #bfaea0 !important;
}

/* 发送按钮 - 温暖的黄金礼赞 */
#ai-send-button {
    background: linear-gradient(135deg, #e5c158 0%, #d4a359 100%) !important;
    border-radius: 6px !important;
    border: 1px solid #f1dca4 !important;
    box-shadow: 0 2px 6px rgba(212, 163, 89, 0.3) !important;
    transition: all 0.2s !important;
}
#ai-send-button:hover {
    transform: scale(1.03) !important;
    box-shadow: 0 4px 12px rgba(212, 163, 89, 0.5) !important;
}
#ai-send-button .icon-icon-send {
    color: #fffdfa !important;
}

/* 快捷按钮组 - 优雅的古典线框 */
#ai-mod-button2 .MuiButton-outlinedPrimary {
    border-color: #e2d4c5 !important;
    color: #8c7662 !important;
    border-radius: 6px !important;
    background: rgba(246, 238, 227, 0.5) !important;
    transition: all 0.2s !important;
}
#ai-mod-button2 .MuiButton-outlinedPrimary:hover {
    border-color: #d4a359 !important;
    color: #d4a359 !important;
    background: #fffdfa !important;
    box-shadow: 0 2px 8px rgba(212, 163, 89, 0.15) !important;
}

/* ---------------------------------------------------------
   4. 评论区 (Comment Section) - 慵懒同居的留言板
   --------------------------------------------------------- */
/* 评论面板主容器 - 温暖的象牙白书页 */
.absolute.bottom-0.z-20.inset-x-0.bg-white {
    background: #fbf9f6 !important;
    border-top: 3px solid #d4a359 !important;
    box-shadow: 0 -8px 25px rgba(74, 60, 49, 0.08) !important;
}

/* 标题 - 圣事留言簿 */
.absolute.bottom-0.z-20.inset-x-0.bg-white .text-lg.font-bold.pl-3 {
    color: #4a3c31 !important;
    font-family: "Georgia", serif !important;
    border-left: 4px solid #d4a359 !important;
    padding-left: 8px !important;
    margin-left: 12px !important;
}

/* 评分区域 - 圣光评级 */
.MuiRating-iconFilled {
    color: #d4a359 !important;
    filter: drop-shadow(0 0 2px rgba(212, 163, 89, 0.4)) !important;
}
.MuiRating-iconEmpty {
    color: #e2d4c5 !important;
}
.absolute.bottom-0.z-20.inset-x-0.bg-white .text-orange-500.w-14 {
    color: #d4a359 !important;
    font-weight: bold !important;
}

/* 评论输入框 - 羊皮信笺 */
textarea[placeholder="发表评论"] {
    background: #fffdfa !important;
    border: 1px solid #e2d4c5 !important;
    color: #4a3c31 !important;
    border-radius: 6px !important;
}
textarea[placeholder="发表评论"]:focus {
    border-color: #d4a359 !important;
    outline: none !important;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05), 0 0 6px rgba(212, 163, 89, 0.2) !important;
}

/* 评论列表项 - 温暖的手写便签 */
.p-3.overflow-y-auto.h-full .group.ml-0 {
    background: #fffdfa !important;
    border-left: 3px solid #e2d4c5 !important;
    padding: 12px !important;
    margin-bottom: 10px !important;
    border-radius: 0 8px 8px 0 !important;
    box-shadow: 0 2px 6px rgba(74, 60, 49, 0.03) !important;
    transition: all 0.2s !important;
}
.p-3.overflow-y-auto.h-full .group.ml-0:hover {
    border-left-color: #d4a359 !important;
    box-shadow: 0 4px 10px rgba(212, 163, 89, 0.08) !important;
}
.p-3.overflow-y-auto.h-full .group.ml-0 .text-sm.text-grey-600 span.font-bold {
    color: #4a3c31 !important;
}
.p-3.overflow-y-auto.h-full .group.ml-0 div.break-all {
    color: #605246 !important;
}
.p-3.overflow-y-auto.h-full .group.ml-0 .text-xs.text-grey-600 {
    color: #a09080 !important;
}

/* 评论区滚动条美化 */
.p-3.overflow-y-auto.h-full::-webkit-scrollbar {
    width: 5px !important;
}
.p-3.overflow-y-auto.h-full::-webkit-scrollbar-track {
    background: #fbf9f6 !important;
}
.p-3.overflow-y-auto.h-full::-webkit-scrollbar-thumb {
    background: #e2d4c5 !important;
    border-radius: 10px !important;
}
.p-3.overflow-y-auto.h-full::-webkit-scrollbar-thumb:hover {
    background: #d4a359 !important;
}

/* =========================================================
   CLERICAL STATUS PANELS - 圣典状态栏与档案美化
   ========================================================= */

/* 1. 折叠面板(details)主容器 - 仿中世纪羊皮纸书卷 */
.markdown-body details,
#customized-answer-content details,
#customized-question-content details {
    background: #fffdfa !important;
    border: 1px solid #e2d4c5 !important;
    border-left: 4px solid #d4a359 !important; /* 圣女金左边框 */
    border-radius: 6px !important;
    margin: 10px 0 !important;
    padding: 0 !important;
    box-shadow: 0 4px 12px rgba(74, 60, 49, 0.05) !important;
    overflow: hidden !important;
    transition: all 0.3s ease !important;
}

/* 悬浮时散发温暖的圣光金光晕 */
.markdown-body details:hover,
#customized-answer-content details:hover {
    border-left-color: #e5c158 !important;
    box-shadow: 0 6px 16px rgba(212, 163, 89, 0.15) !important;
    transform: translateY(-1px) !important;
}

/* 2. 标题栏(summary) - 圣殿唱诗班排版 */
.markdown-body details summary,
#customized-answer-content details summary {
    background: linear-gradient(90deg, rgba(212, 163, 89, 0.08) 0%, transparent 100%) !important;
    padding: 12px 16px !important;
    font-weight: bold !important;
    color: #4a3c31 !important; /* 牧师深褐 */
    cursor: pointer !important;
    font-family: "Georgia", serif !important;
    border-bottom: 1px solid rgba(212, 163, 89, 0.15) !important;
    list-style: none !important; /* 针对Firefox */
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    transition: background 0.2s !important;
}

/* 兼容 WebKit 浏览器隐藏默认三角 */
.markdown-body details summary::-webkit-details-marker,
#customized-answer-content details summary::-webkit-details-marker {
    display: none !important;
}

/* 自定义折叠箭头 */
.markdown-body details summary::after,
#customized-answer-content details summary::after {
    content: '🕯️' !important; /* 用小蜡烛代替默认箭头 */
    font-size: 12px !important;
    transition: transform 0.3s !important;
}
.markdown-body details[open] summary::after,
#customized-answer-content details[open] summary::after {
    transform: rotate(180deg) !important;
    content: '✨' !important; /* 展开时圣光闪烁 */
}

/* 3. 面板展开后的内容区域 —— 修正所有子组合符 */
.markdown-body details > *:not(summary),
#customized-answer-content details > *:not(summary) {
    padding: 16px !important;
    color: #605246 !important;
    font-size: 13px !important;
    line-height: 1.8 !important;
    background: #fffdfa !important;
}

/* 4. 档案内部块级元素美化 */
/* 分割线 - 圣洁金虚线 */
.markdown-body details hr,
#customized-answer-content details hr {
    border: none !important;
    border-top: 1px dashed rgba(212, 163, 89, 0.5) !important;
    margin: 12px 0 !important;
}

/* 属性标签高亮 (如 🏷️ 姓名：) */
.markdown-body details p,
#customized-answer-content details p {
    margin: 6px 0 !important;
}

/* 5. 记忆回廊表格美化 (酒馆记事薄) */
.markdown-body details table,
#customized-answer-content details table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    margin: 10px 0 !important;
    border: 1px solid #e2d4c5 !important;
    border-radius: 6px !important;
    overflow: hidden !important;
}

.markdown-body details th,
#customized-answer-content details th {
    background-color: #f6eee3 !important; /* 羊皮纸底色 */
    color: #4a3c31 !important;
    font-weight: bold !important;
    padding: 8px 12px !important;
    border-bottom: 1px solid #e2d4c5 !important;
    font-family: "Georgia", serif !important;
}

.markdown-body details td,
#customized-answer-content details td {
    padding: 8px 12px !important;
    border-bottom: 1px solid #f3ebd8 !important;
    background-color: #fffdfa !important;
    color: #605246 !important;
}

.markdown-body details tr:last-child td,
#customized-answer-content details tr:last-child td {
    border-bottom: none !important;
}

/* 6. 行动选项 (🎯 行动选项) 特别美化 */
/* 将选项转化为精致的羊皮纸卡片按钮 */
/* 注意：此处未使用 &gt;，但确保所有子选择器正确 */
.markdown-body details summary ~ p:not(:has(span)), 
.markdown-body details summary ~ ul li,
#customized-answer-content details summary ~ p:not(:has(span)),
#customized-answer-content details summary ~ ul li {
    background: #fbf9f6 !important;
    border: 1px solid #e2d4c5 !important;
    border-radius: 6px !important;
    padding: 10px 14px !important;
    margin-bottom: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-weight: 500 !important;
}

.markdown-body details summary ~ p:not(:has(span)):hover,
.markdown-body details summary ~ ul li:hover,
#customized-answer-content details summary ~ p:not(:has(span)):hover,
#customized-answer-content details summary ~ ul li:hover {
    background: #fffdfa !important;
    border-color: #d4a359 !important;
    box-shadow: 0 4px 10px rgba(212, 163, 89, 0.12) !important;
    transform: translateX(4px) !important; /* 悬浮时向右微滑，增加交互感 */
}

