/* ===== 日常恋爱风格 - AI聊天平台专属CSS ===== */
/* 所有样式封装在<ai>容器内，避免全局污染 */

ai {
  display: block;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 12px 10px;
  box-sizing: border-box;
  background: #fefaf6;  /* 暖白基底 */
  color: #4a3f3a;
  font-family: 'Segoe UI', 'PingFang SC', Roboto, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* ---- 正文剧情区 —— 卡片式气泡 ---- */
ai article {
  display: block;
  margin: 0 0 14px 0;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid #f0e3da;
  border-radius: 20px 20px 20px 6px;
  box-shadow: 0 4px 12px rgba(233, 192, 176, 0.12);
  color: #4a3f3a;
  font-size: 15px;
  line-height: 1.8;
  word-break: break-word;
  transition: box-shadow 0.2s;
}

ai article p {
  margin: 0 0 12px 0;
}
ai article p:last-child {
  margin-bottom: 0;
}

/* ---- 可折叠卡片 —— 圆润、柔和 ---- */
ai details {
  display: block;
  margin-bottom: 14px;
  background: #ffffff;
  border: 1px solid #f0e3da;
  border-radius: 24px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(233, 192, 176, 0.10);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

ai details[open] {
  border-color: #fad5c0;
  box-shadow: 0 6px 18px rgba(241, 184, 160, 0.18);
}

ai details:hover {
  border-color: #f7c9b2;
  box-shadow: 0 6px 16px rgba(241, 184, 160, 0.15);
}

/* 各卡片左侧柔和色条 —— 甜系配色 */
ai details:nth-of-type(1) { border-left: 6px solid #f7b2a1; }  /* 逻辑演算 */
ai details:nth-of-type(2) { border-left: 6px solid #b5d9c6; }  /* 现实观测 */
ai details:nth-of-type(3) { border-left: 6px solid #f5c8a0; }  /* 我的档案 */
ai details:nth-of-type(4) { border-left: 6px solid #f5a3b8; }  /* 互动角色 */
ai details:nth-of-type(5) { border-left: 6px solid #a8c8e8; }  /* 手机与动态 */
ai details:nth-of-type(6) { border-left: 6px solid #f5d78a; }  /* 已知角色 */
ai details:nth-of-type(7) { border-left: 6px solid #c9b8e0; }  /* 记忆区 */
ai details:nth-of-type(8) { border-left: 6px solid #f5a3b8; }  /* 命运抉择 */

/* ---- 卡片标题 —— 温暖、俏皮 ---- */
ai summary {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  color: #7a5a4a;
  background: rgba(253, 235, 226, 0.4);
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-bottom: 1px solid rgba(240, 227, 218, 0.5);
  transition: background 0.2s;
}

ai summary:hover {
  background: rgba(253, 235, 226, 0.7);
}

/* 隐藏默认三角形 */
ai summary::-webkit-details-marker {
  display: none;
}
ai summary::marker {
  display: none;
  content: '';
}

/* 左侧装饰：爱心小点 / 短条 */
ai summary::before {
  content: '♥';
  display: inline-block;
  font-size: 12px;
  color: #f5a3b8;
  margin-right: 10px;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  transition: transform 0.2s;
}

ai details[open] summary::before {
  transform: scale(1.1);
  color: #e8829c;
}

/* ---- 段落分区 ---- */
ai p {
  margin: 0;
  padding: 8px 18px;
  border-left: 3px solid rgba(245, 163, 184, 0.3);
  background: rgba(255, 248, 244, 0.3);
}

/* 内容分组标题 —— 可爱小标签 */
ai f {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #b07a6a;
  letter-spacing: 0.5px;
  margin: 10px 0 4px 0;
  padding-left: 14px;
  border-left: 4px solid #f5c8a0;
}

/* 数据行 —— 轻量信息 */
ai d {
  display: block;
  font-size: 13px;
  color: #5f4e46;
  padding: 4px 0 4px 16px;
  margin: 2px 0;
  line-height: 1.6;
  border-left: 2px dashed #f5d5c0;
  word-break: break-word;
  background: rgba(255, 248, 244, 0.2);
  border-radius: 0 12px 12px 0;
}

/* 特殊高亮 */
ai d.highlight {
  color: #b05a4a;
  border-left-color: #f5a3b8;
  background: #fef6f0;
}

/* ---- 特定卡片内部微调（保留趣味性） ---- */

/* 互动角色面板 - 不同色调 */
ai details:nth-of-type(4) > p:nth-of-type(1) { border-left-color: #f5c8a0; }  /* 档案 */
ai details:nth-of-type(4) > p:nth-of-type(2) { border-left-color: #f5a3b8; }  /* 精神/状态 */
ai details:nth-of-type(4) > p:nth-of-type(3) { border-left-color: #c9b8e0; }  /* 躯体检视 */
ai details:nth-of-type(4) > p:nth-of-type(4) { border-left-color: #a8c8e8; }  /* 私密部位 */
ai details:nth-of-type(4) > p:nth-of-type(5) { border-left-color: #b5d9c6; }  /* 行为记录 */

/* 手机与动态 - 来源色 */
ai details:nth-of-type(5) > p:nth-of-type(1) { border-left-color: #9fc7e8; }  /* LINE */
ai details:nth-of-type(5) > p:nth-of-type(2) { border-left-color: #f5d78a; }  /* 头条 */
ai details:nth-of-type(5) > p:nth-of-type(3) { border-left-color: #c9b8e0; }  /* 论坛 */

/* 命运抉择 - 选项像小卡片 */
ai details:nth-of-type(8) > d {
  padding: 10px 16px;
  margin: 6px 12px;
  background: #fef8f4;
  border: 1px solid #f5d5c0;
  border-left: 5px solid #f5a3b8;
  border-radius: 30px;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
  cursor: default;
  color: #4a3f3a;
}

ai details:nth-of-type(8) > d:hover {
  background: #fceee8;
  border-color: #e8829c;
  transform: translateX(4px);
}

/* ---- 记忆区表格 —— 温柔表格 ---- */
ai details:nth-of-type(7) table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
  background: transparent;
  border-radius: 16px;
  overflow: hidden;
}

ai details:nth-of-type(7) th {
  background: #fceee8;
  color: #7a5a4a;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid #f5d5c0;
  font-weight: 600;
  white-space: nowrap;
}

ai details:nth-of-type(7) td {
  padding: 8px 12px;
  border-bottom: 1px solid #f5e3da;
  color: #4a3f3a;
}

ai details:nth-of-type(7) tr:hover td {
  background: #fef8f4;
}

/* ---- 移动端优化 ---- */
@media (max-width: 600px) {
  ai {
    padding: 8px 6px;
    font-size: 13px;
  }
  ai summary {
    padding: 12px 14px;
    font-size: 14px;
  }
  ai p {
    padding: 6px 14px;
  }
  ai d, ai f {
    font-size: 12px;
  }
  ai details:nth-of-type(8) > d {
    margin: 5px 8px;
  }
}

/* ---- 滚动条 — 恋爱小清新 ---- */
ai::-webkit-scrollbar {
  width: 5px;
}
ai::-webkit-scrollbar-track {
  background: #fef8f4;
  border-radius: 8px;
}
ai::-webkit-scrollbar-thumb {
  background: #f5c8b8;
  border-radius: 8px;
}
ai::-webkit-scrollbar-thumb:hover {
  background: #eeb0a0;
}

/* --- 1. 顶部栏 (Header) 美化：磨砂玻璃与渐变边框 --- */
.sticky.w-full.top-0.flex.items-center {
    background: rgba(15, 17, 26, 0.85) !important;
    backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid rgba(59, 130, 246, 0.3) !important; /* 蓝色边框 */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

/* 模型选择器美化：改为方形直角 */
#ai-model-selector .group.flex.items-center {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0px !important; /* 椭圆形改为方形 */
    padding: 2px 12px !important;
    transition: all 0.3s ease !important;
}

#ai-model-selector .group.flex.items-center:hover {
    background: rgba(59, 130, 246, 0.2) !important; /* 蓝色悬停 */
    border-color: #3b82f6 !important; /* 蓝色边框 */
}

#ai-model-selector .truncate.text-\[13px\] {
    color: #e2e8f0 !important;
    font-weight: 600 !important;
}

/* 顶部图标色彩统一：改为蓝色 */
.sticky.w-full.top-0 svg, 
#header-setting-button svg {
    color: #60a5fa !important; /* 蓝色调 */
    filter: drop-shadow(0 0 2px rgba(96, 165, 250, 0.5)) !important;
}

/* --- 2. 底部栏 (Input Bar) 美化：悬浮呼吸感 --- */
.bg-gradient-to-t {
    background: linear-gradient(to top, rgba(15, 17, 26, 1), rgba(15, 17, 26, 0)) !important;
}

#ai-chat-bottom-input {
    background: rgba(31, 41, 55, 0.95) !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important; /* 蓝色边框 */
    border-radius: 0px !important; /* 椭圆形改为方形 */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
    transition: border-color 0.3s ease !important;
}

#ai-chat-bottom-input:focus-within {
    border-color: #3b82f6 !important; /* 蓝色聚焦 */
}

#ai-chat-input {
    color: #000000 !important; /* 输入栏字体改为黑色 */
    font-family: ui-sans-serif, system-ui, sans-serif !important;
}

#ai-chat-input::placeholder {
    color: #9ca3af !important;
}

#ai-chat-input::selection {
    background: rgba(59, 130, 246, 0.5) !important; /* 蓝色选中 */
}

/* --- 3. 按钮栏 (Mod & Stream Buttons) 美化 --- */
#ai-mod-button2 button.MuiButton-root {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important; /* 蓝色渐变 */
    border: none !important;
    border-radius: 0px !important; /* 方形直角 */
    color: white !important;
    font-weight: bold !important;
    text-transform: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#ai-mod-button2 button.MuiButton-root:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.6) !important; /* 蓝色光晕 */
    filter: brightness(1.1) !important;
}

/* 开场白/滑块选择器美化：改为方形 */
div.flex.items-center.h-9.bg-white.rounded-md.cursor-pointer.group[class*="border-gray"] {
    background: #2d3748 !important;
    border: 1px solid #4a5568 !important;
    border-radius: 0px !important; /* 方形 */
}

div.flex.items-center.h-9.cursor-pointer.group svg {
    color: #60a5fa !important; /* 蓝色图标 */
}

/* --- 4. 分页栏 (Pagination) 美化 --- */
.MuiPaginationItem-root {
    color: #cbd5e0 !important;
    border-radius: 0px !important; /* 方形 */
    transition: all 0.3s !important;
}

.MuiPaginationItem-root.Mui-selected {
    background: #3b82f6 !important; /* 蓝色选中 */
    color: white !important;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5) !important;
}

.MuiPaginationItem-root:hover:not(.Mui-selected) {
    background: rgba(59, 130, 246, 0.2) !important; /* 蓝色悬停 */
}

.MuiStack-root.css-1uwir8f .MuiBox-root {
    color: #9ca3af !important;
}

.MuiInputBase-input {
    color: #f3f4f6 !important;
    text-align: center !important;
}

/* --- 5. 评论区 (Comments Section) 全面美化 --- */
/* 主背景强制覆盖 */
div[class*="w-full"][class*="bg-white"][class*="bottom-0"] {
    background: #111827 !important;
    color: #e5e7eb !important;
}

/* 标题与文字 */
div.text-lg.font-bold {
    color: #f9fafb !important;
    border-left: 4px solid #3b82f6 !important; /* 蓝色左边框 */
    padding-left: 12px !important;
}

p.MuiTypography-body1.text-grey-600 {
    color: #9ca3af !important;
}

/* 星星评分 */
span.MuiRating-iconFilled svg {
    color: #fbbf24 !important;
    filter: drop-shadow(0 0 3px rgba(251, 191, 36, 0.4)) !important;
}

span.MuiRating-iconEmpty svg {
    color: #4b5563 !important;
}

/* 评论输入框：改为方形 */
div.flex.flex-col.border-gray-200 {
    border-color: #374151 !important;
    background: #1f2937 !important;
    border-radius: 0px !important; /* 方形 */
    overflow: hidden !important;
}

textarea.rc-textarea {
    background: transparent !important;
    color: #ffffff !important;
    padding: 12px !important;
}

div.bg-gray-100.text-gray-500 {
    background: #374151 !important;
    color: #9ca3af !important;
}

/* 发送按钮 */
div.cursor-pointer.group.flex.items-center.justify-center {
    transition: transform 0.2s ease !important;
}

div.cursor-pointer.group.flex.items-center.justify-center:hover svg {
    color: #3b82f6 !important; /* 蓝色悬停 */
    transform: scale(1.1) rotate(-10deg) !important;
}

/* 评论项设计 */
div.group.ml-0 {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    padding: 16px 0 !important;
}

div.text-sm.text-grey-600 span.font-bold {
    color: #60a5fa !important; /* 蓝色用户名 */
}

div.break-all {
    color: #d1d5db !important;
    line-height: 1.6 !important;
    margin-top: 4px !important;
}

/* 排序按钮 */
button.MuiButton-containedPrimary {
    background: #3b82f6 !important; /* 蓝色主按钮 */
}

button.MuiButton-outlinedPrimary {
    border-color: #3b82f6 !important; /* 蓝色边框 */
    color: #60a5fa !important; /* 蓝色文字 */
}

/* 时间戳与回复 */
div.text-xs.text-grey-600 {
    color: #6b7280 !important;
}

span.cursor-pointer {
    color: #3b82f6 !important; /* 蓝色链接 */
    font-weight: bold !important;
}

span.cursor-pointer:hover {
    text-decoration: underline !important;
}