/* ==========================================================================
   1. 全局样式重置与滚动条
   ========================================================================== */
html, body { margin: 0; padding: 0; box-sizing: border-box; }
/* 增加 Firefox 滚动条兼容 */
* { scrollbar-width: thin; scrollbar-color: rgba(180, 150, 120, 0.25) transparent; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(180, 150, 120, 0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(180, 150, 120, 0.45); }
::selection { background: rgba(201, 169, 110, 0.18); color: #3a2c20; }

/* ==========================================================================
   2. 手机侧边栏 (核心修复区)
   ========================================================================== */
/* 修复：强制使用 fixed 固定在用户当前视口，并使用 transform 实现精准垂直居中 */
.phone-sidebar, .phone-sidebar > div { 
  position: fixed !important; 
  top: 50% !important; 
  transform: translateY(-50%) !important; 
  z-index: 9999 !important; /* 确保不被聊天气泡遮挡 */
}
.phone-sidebar[open] { pointer-events: auto; }
.phone-sidebar[open] summary { right: 320px; }
/* 修复：增加 list-style: none 兼容 Firefox 和部分新版 Safari */
.phone-sidebar summary { list-style: none; }
.phone-sidebar summary::-webkit-details-marker { display: none; }
.phone-sidebar summary:hover { background: rgba(34, 37, 48, 1) !important; width: 38px; color: #fff; }

/* ==========================================================================
   3. 课表面板
   ========================================================================== */
.schedule-grid { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 8px 0; }
.schedule-day { background: #fefcf9; border: 1px solid #f0e6db; border-radius: 8px; padding: 8px 10px; }
.day-header { font-weight: 700; font-size: 12px; color: #8b5e3c; margin-bottom: 4px; padding-bottom: 2px; border-bottom: 1px solid #ece4db; }
.course-item { font-size: 11px; color: #555; background: #f9f5f0; border-left: 2px solid #c9a96e; border-radius: 4px; padding: 4px 8px; margin: 2px 0; line-height: 1.5; }

/* ==========================================================================
   4. 面板系统美化
   ========================================================================== */
.profile-panel, .social-panel, .memory-panel {
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px;
  overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.profile-panel summary, .social-panel summary, .memory-panel summary {
  background: linear-gradient(to right, #f8fafc, #ffffff); color: #2c3e50;
  border-bottom: 1px solid #e2e8f0; font-size: 13.5px; font-weight: bold;
  padding: 12px 16px; transition: background 0.2s; cursor: pointer; /* 增加手型光标 */
  list-style: none; /* 兼容非 WebKit 内核 */
}
.profile-panel summary:hover, .social-panel summary:hover, .memory-panel summary:hover { background: rgba(201, 169, 110, 0.05); }
.profile-panel summary::-webkit-details-marker,
.social-panel summary::-webkit-details-marker,
.memory-panel summary::-webkit-details-marker { display: none; }
.profile-panel[open] summary, .social-panel[open] summary, .memory-panel[open] summary {
  border-bottom: 1px solid #c9a96e; color: #1a1a1a;
}
.panel-content { padding: 16px 20px; background: #ffffff; color: #4f5f6e; font-family: -apple-system, system-ui, sans-serif; font-size: 13px; line-height: 1.8; }
.memory-panel .panel-content strong { display: block; margin-top: 12px; margin-bottom: 4px; color: #2c3e50; font-size: 13.5px; }
.memory-panel .panel-content strong:first-child { margin-top: 0; }
.memory-panel table { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: 12px; background: rgba(254, 250, 247, 0.6); border: 1px solid #e8d5c8; border-radius: 8px; overflow: hidden; display: table; }
.memory-panel th { background: rgba(248, 242, 235, 0.8); color: #5a3e2b; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid #e8d5c8; font-size: 11px; text-align: left; }
.memory-panel td { padding: 5px 8px; border-bottom: 1px solid rgba(232, 213, 200, 0.4); color: #3a2c20; font-size: 11px; }

/* ==========================================================================
   5. 基础排版与组件
   ========================================================================== */
.time-status { background: #1a1a2e; border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; color: #e0d5c0; font-family: -apple-system, system-ui, sans-serif; font-size: 13px; border-left: 4px solid #c9a96e; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
.next { border: 2px solid #2c3e50 !important; background: #ffffff !important; box-shadow: 4px 4px 0 #2c3e50 !important; border-radius: 4px !important; overflow: hidden !important; width: 100% !important; box-sizing: border-box !important; }
.next summary { background: #faf9f6 !important; border-bottom: 1px solid #eae6df !important; padding: 12px 20px !important; font-weight: bold !important; font-size: 15px !important; color: #2c3e50 !important; list-style: none; cursor: pointer; }
.next summary::-webkit-details-marker { display: none; }
.cot { display: none; }
.h { display: none !important; }
.module-switches { background: #fefaf7; border: 1px solid #e8d5c8; border-radius: 10px; padding: 8px 16px; margin-bottom: 16px; font-size: 11px; color: #8b5e3c; font-family: -apple-system, system-ui, sans-serif; line-height: 1.6; box-shadow: 0 2px 8px rgba(0,0,0,0.03); border-left: 3px solid #c9a96e; }

/* ==========================================================================
   6. 正文排版
   ========================================================================== */
.main-text {
  font-family: 'Georgia', 'Noto Serif SC', 'PingFang SC', serif;
  font-size: 14px;
  line-height: 1.75;
  color: #2c3e50;
  background: #ffffff;
  padding: 18px 20px;
  border-radius: 8px;
  margin: 16px 0;
  border: 1px solid #eae6df;
  text-align: justify;
  box-shadow: 0 2px 12px rgba(0,0,0,0.01);
}
.main-text p {
  margin-bottom: 10px;
  text-indent: 1.2em;
}
text {
  display: block;
  margin: 16px 0;
  line-height: 1.75;
  font-size: 14px;
  color: #3a2c20;
  font-family: 'Georgia', 'Noto Serif SC', 'PingFang SC', serif;
}
text p {
  margin-bottom: 10px;
  text-indent: 1.2em;
}
blockquote {
  border-left: 3px solid #c9a96e;
  background: rgba(201, 169, 110, 0.06);
  padding: 10px 16px;
  border-radius: 0 6px 6px 0;
  color: #6b5a4a;
  font-style: italic;
  margin: 12px 0;
}
a { color: #8b5e3c; text-decoration: none; border-bottom: 1px dotted #c9a96e; transition: all 0.2s; }
a:hover { color: #5a3e2b; border-bottom: 1px solid #c9a96e; }
hr { border: none; border-top: 1px solid #e8d5c8; margin: 16px 0; }

/* ==========================================================================
   7. 聊天框美化
   ========================================================================== */
.group .bg-gray-100\/90, .ai-message .bg-gray-100\/90 { background: rgba(254, 250, 247, 0.95) !important; border: 1px solid #e8d5c8 !important; border-radius: 18px !important; padding: 16px 20px !important; margin-bottom: 12px !important; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important; color: #3a2c20 !important; }
.group .bg-gray-100\/90 p, .ai-message p { color: #3a2c20 !important; }
#ai-chat-input, input.modern-input, textarea.modern-input, .message-input { background-color: rgba(254, 250, 247, 0.9) !important; border: 1.5px solid #e8d5c8 !important; border-radius: 24px !important; color: #3a2c20 !important; padding: 12px 20px !important; font-size: 14px !important; outline: none !important; transition: all 0.2s ease !important; box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.02) !important; }
#ai-chat-input:focus, input.modern-input:focus, textarea.modern-input:focus { border-color: #c9a96e !important; box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03), 0 0 12px rgba(201, 169, 110, 0.15) !important; }

/* 发送按钮美化 */
.flex.items-center.gap-2.pb-2 > button { background: linear-gradient(145deg, #f0e6d8, #e8d5c0) !important; color: #5a3e2b !important; border: 1px solid #c9a96e !important; border-radius: 40px !important; padding: 8px 20px !important; font-size: 12px !important; font-weight: 600 !important; font-family: -apple-system, system-ui, sans-serif !important; min-height: 36px !important; box-shadow: 0 2px 8px rgba(120, 90, 50, 0.06), inset 0 1px 0 rgba(255,255,255,0.7) !important; transition: all 0.2s ease !important; cursor: pointer !important; }
.flex.items-center.gap-2.pb-2 > button:hover { background: linear-gradient(145deg, #f5ede2, #eeddcc) !important; border-color: #b8956e !important; transform: translateY(-1px) !important; box-shadow: 0 4px 14px rgba(120, 90, 50, 0.1) !important; }

.MuiTypography-root.MuiTypography-body2.css-6c0gf2 { color: #8a7a6c !important; font-weight: 500 !important; }
.text-orange-500 { color: #c9a96e !important; }

/* ==========================================================================
   8. 加载动画
   ========================================================================== */
.flex.items-center.justify-center.w-6.h-5, .style_dot-flashing__8L91Q { background: transparent !important; display: flex !important; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; position: relative; z-index: 10; }
.flex.items-center.justify-center.w-6.h-5 > div, .flex.items-center.justify-center.w-6.h-5 > svg, .style_dot-flashing__8L91Q > div, .style_dot-flashing__8L91Q > svg { display: none !important; }
.flex.items-center.justify-center.w-6.h-5::before, .style_dot-flashing__8L91Q::before { content: ''; display: block; width: 28px; height: 28px; background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyOCIgaGVpZ2h0PSIyOCIgdmlld0JveD0iMCAwIDI4IDI4Ij48cmVjdCB4PSI4IiB5PSIzIiB3aWR0aD0iMiIgaGVpZ2h0PSIyMiIgcng9IjEiIGZpbGw9IiM4YjVlM2MiPjxhbm1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIxOzAuMzsxIiBkdXI9IjEuMnMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBiZWdpbj0iMHMiLz48L3JlY3Q+PHJlY3QgeD0iMTMiIHk9IjUiIHdpZHRoPSIyIiBoZWlnaHQ9IjE4IiByeD0iMSIgZmlsbD0iIzhiNWUzYyI+PGFuaW1hdGUgYXR0cmlidXRlTmFtZT0ib3BhY2l0eSIgdmFsdWVzPSIxOzAuMzsxIiBkdXI9IjEuMnMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiBiZWdpbj0iMC4ycyIvPjwvcmVjdD48cmVjdCB4PSIxOCIgeT0iNyIgd2lkdGg9IjIiIGhlaWdodD0iMTQiIHJ4PSIxIiBmaWxsPSIjOGI1ZTNjIj48YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJvcGFjaXR5IiB2YWx1ZXM9IjE7MC4zOzEiIGR1cj0iMS4ycyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIGJlZ2luPSIwLjRzIi8+PC9yZWN0Pjwvc3ZnPg=="); background-repeat: no-repeat; background-position: center; background-size: contain; z-index: 10; position: relative; }

/* ==========================================================================
   9. 移动端适配 (修复了宽度溢出风险)
   ========================================================================== */
@media (max-width: 768px) {
  .phone-sidebar > div {
    /* 修复：使用 calc 确保屏幕太窄时侧边栏不会被切断 */
    width: min(300px, 90vw) !important; 
    height: 520px !important;
    right: 8px !important;
  }
  .profile-panel summary, .social-panel summary, .memory-panel summary { padding: 10px 16px !important; font-size: 13px !important; }
  .panel-content { padding: 14px 16px !important; }
  .time-status { padding: 10px 14px; font-size: 12px; }
  .next summary { padding: 10px 16px !important; font-size: 14px !important; }
}
@media (max-width: 480px) {
  .time-status { padding: 8px 12px; font-size: 11px; }
  .profile-panel, .social-panel, .memory-panel { padding: 0; }
  .panel-content { padding: 10px 14px; font-size: 12px; }
  .profile-panel summary, .social-panel summary, .memory-panel summary { font-size: 12px !important; }
}