/* =========================================
   AI 教练页面样式  ai_coach.css
   前缀：.ac-  避免与平台已有样式冲突
   ========================================= */

/* ---- header 登录注册按钮居中（覆盖平台全局偏移）---- */
.site-login{margin-top:8px!important}

/* ---- 公共基础 ---- */
.ac-page,
.ac-chat-page {
  background: #f3f7ff;
  min-height: calc(100vh - 160px);
  padding: 30px 0 60px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #0b1739;
  box-sizing: border-box;
}
.ac-page *,
.ac-chat-page * { box-sizing: border-box; }
.ac-page a:hover,
.ac-chat-page a:hover { text-decoration: none; }

/* ===================================================
   教练列表页
   =================================================== */
.ac-wrap { width: min(1200px, 94%); margin: auto; }

.ac-topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}
.ac-back-link {
  color: #356be8;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.ac-back-link:hover { color: #1a4ec0; text-decoration: none; }

.ac-page-title {
  font-size: 26px;
  font-weight: 800;
  color: #0b1739;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.ac-page-title::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 22px;
  background: linear-gradient(#23b2ff, #5c54ff);
  border-radius: 4px;
  vertical-align: -2px;
  flex-shrink: 0;
}
.ac-page-title span { font-size: 13px; color: #aab6d1; font-weight: 400; }

.ac-tip-bar {
  background: #fff8e6;
  border: 1px solid #ffe58f;
  border-radius: 10px;
  padding: 12px 20px;
  color: #8a6d00;
  font-size: 14px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ac-tip-bar::before { content: "⚠"; font-size: 15px; }

/* 2 列网格 */
.ac-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

/* 教练卡片 */
.ac-card {
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  border: 1.5px solid #edf1f8;
  box-shadow: 0 10px 28px rgba(39, 68, 125, .08);
  display: flex;
  flex-direction: row;
  transition: transform .25s ease, box-shadow .25s ease;
  cursor: pointer;
}
.ac-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 38px rgba(39, 68, 125, .15);
  border-color: color-mix(in srgb, var(--ac-color, #2f72f4) 28%, #e6edf8);
}

.ac-card-visual {
  position: relative;
  width: 200px;
  flex: 0 0 200px;
  overflow: hidden;
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--ac-color, #2f72f4) 10%, #fff),
    #fff 78%);
}
.ac-card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.ac-card:hover .ac-card-visual img { transform: scale(1.04); }

.ac-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--ac-color, #2f72f4);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 10px;
  box-shadow: 0 5px 12px color-mix(in srgb, var(--ac-color, #2f72f4) 38%, transparent);
  letter-spacing: .5px;
}

.ac-card-body {
  flex: 1;
  min-width: 0;
  padding: 28px 28px 26px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ac-card-body h2 {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 800;
  color: var(--ac-color, #2f72f4);
  line-height: 1.3;
}
.ac-card-body p {
  margin: 0 0 20px;
  color: #637087;
  font-size: 14px;
  line-height: 1.8;
  flex: 1;
}

/* 立即对话 / 登录后对话 按钮 */
.ac-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  padding: 10px 22px;
  background: var(--ac-color, #2f72f4);
  color: #fff;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
.ac-chat-btn:hover {
  opacity: .88;
  transform: translateY(-2px);
  color: #fff;
  text-decoration: none;
}
.ac-chat-btn-ghost {
  background: transparent;
  border: 1.5px solid var(--ac-color, #2f72f4);
  color: var(--ac-color, #2f72f4);
}
.ac-chat-btn-ghost:hover { background: color-mix(in srgb, var(--ac-color, #2f72f4) 8%, #fff); color: var(--ac-color, #2f72f4); }

/* ===================================================
   教练对话页
   =================================================== */
.ac-chat-wrap {
  width: min(1200px, 94%);
  margin: auto;
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

/* 左侧边栏 */
.ac-sidebar {
  width: 248px;
  flex: 0 0 248px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 20px;
}
.ac-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #356be8;
  font-size: 14px;
  text-decoration: none;
  padding: 6px 0;
}
.ac-back-btn:hover { color: #1a4ec0; text-decoration: none; }

.ac-sidebar-card {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  border: 1.5px solid #edf1f8;
  box-shadow: 0 8px 24px rgba(39, 68, 125, .08);
}
.ac-sidebar-card img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--ac-color, #2f72f4) 10%, #fff),
    #fff 78%);
}
.ac-sidebar-card h3 {
  margin: 14px 18px 6px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ac-color, #2f72f4);
}
.ac-sidebar-card p {
  margin: 0 18px 18px;
  font-size: 12px;
  color: #637087;
  line-height: 1.75;
}

.ac-clear-btn {
  width: 100%;
  padding: 10px;
  border: 1.5px solid #e0e8f8;
  border-radius: 12px;
  background: #fff;
  color: #637087;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
  text-align: center;
}
.ac-clear-btn:hover {
  background: #fff0f0;
  color: #d94040;
  border-color: #f9c0c0;
}

/* 主聊天区 */
.ac-main {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: 20px;
  border: 1.5px solid #edf1f8;
  box-shadow: 0 10px 28px rgba(39, 68, 125, .08);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 520px;
}

/* 消息列表 */
.ac-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}
.ac-messages::-webkit-scrollbar { width: 5px; }
.ac-messages::-webkit-scrollbar-thumb { background: #d3dcee; border-radius: 3px; }

/* 单条消息行 */
.ac-msg { display: flex; align-items: flex-start; gap: 12px; }
.ac-msg-user { flex-direction: row-reverse; }

.ac-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 38px;
  border: 2px solid #edf1f8;
}

/* 气泡 */
.ac-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.8;
  word-break: break-word;
  white-space: pre-wrap;
}
.ac-msg-ai .ac-bubble {
  background: #f1f5fb;
  color: #0b1739;
  border-radius: 4px 16px 16px 16px;
}
.ac-msg-user .ac-bubble {
  background: #356be8;
  color: #fff;
  border-radius: 16px 4px 16px 16px;
}

/* Markdown 渲染区 */
.ac-md { white-space: normal; }
.ac-md p { margin: 0 0 8px; }
.ac-md p:last-child { margin-bottom: 0; }
.ac-md strong, .ac-md b { font-weight: 700; }
.ac-md em { font-style: italic; }
.ac-md ul, .ac-md ol { padding-left: 20px; margin: 6px 0; }
.ac-md li { margin-bottom: 3px; }
.ac-md code {
  background: #e8effd;
  color: #356be8;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 13px;
  font-family: "Consolas", monospace;
}
.ac-md pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 12px 14px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 8px 0;
}
.ac-md pre code { background: transparent; color: inherit; padding: 0; }
.ac-md h1, .ac-md h2, .ac-md h3 { margin: 10px 0 6px; font-weight: 700; }
.ac-md h1 { font-size: 17px; }
.ac-md h2 { font-size: 16px; }
.ac-md h3 { font-size: 15px; }
.ac-md blockquote {
  border-left: 3px solid #b8cdf0;
  margin: 6px 0;
  padding: 4px 12px;
  color: #637087;
}
.ac-md table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13px; }
.ac-md th, .ac-md td { border: 1px solid #e0e8f8; padding: 6px 10px; }
.ac-md th { background: #f1f5fb; font-weight: 700; }

/* 思考状态光标 */
.ac-typing-cursor {
  display: inline-block;
  width: 10px;
  height: 14px;
  background: #356be8;
  border-radius: 2px;
  margin-left: 2px;
  vertical-align: -2px;
  animation: ac-blink .65s infinite;
}
@keyframes ac-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* 输入区 */
.ac-input-area {
  border-top: 1.5px solid #edf1f8;
  padding: 14px 18px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  background: #fafcff;
  border-radius: 0 0 20px 20px;
}
#ac-input {
  flex: 1;
  border: 1.5px solid #e0e8f8;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #0b1739;
  line-height: 1.65;
  outline: none;
  background: #fff;
  transition: border-color .2s;
  max-height: 140px;
  overflow-y: auto;
}
#ac-input:focus { border-color: #356be8; }
#ac-input::placeholder { color: #aab6d1; }

#ac-send-btn {
  padding: 10px 22px;
  background: #356be8;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, transform .15s;
  line-height: 1.5;
}
#ac-send-btn:hover { background: #1a4ec0; }
#ac-send-btn:disabled {
  background: #aab6d1;
  cursor: not-allowed;
  transform: none;
}

/* 输入区提示文字 */
.ac-input-tip {
  font-size: 12px;
  color: #aab6d1;
  text-align: center;
  padding: 4px 0 0;
}

/* ===================================================
   响应式
   =================================================== */
@media (max-width: 960px) {
  .ac-grid { grid-template-columns: 1fr; }
  .ac-card { flex-direction: column; }
  .ac-card-visual { width: 100%; height: 160px; flex: 0 0 160px; }

  .ac-chat-wrap { flex-direction: column; }
  .ac-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
  }
  .ac-sidebar-card { flex: 1; min-width: 240px; }
  .ac-sidebar-card img { height: 130px; }
  .ac-clear-btn { flex: 0 0 100%; }
  .ac-main {
    height: calc(100vh - 300px);
    min-height: 420px;
  }
}
