/* ═══════════════════════════════════
   课程卡片
═══════════════════════════════════ */
.course { transition: box-shadow .2s; }
.course:hover { box-shadow: var(--shadow); }
.course h4 { margin-bottom: 4px; font-size: 14px; font-weight: 700; }

/* ═══════════════════════════════════
   设备租赁 after-sale
═══════════════════════════════════ */
.after-sale {
  border-style: dashed;
  border-radius: 12px;
  background: var(--surface-2);
}

/* ═══════════════════════════════════
   个人中心头部
═══════════════════════════════════ */
.profile-head { position: relative; overflow: hidden; }
.profile-head::after {
  content: "";
  position: absolute;
  width: 160px; height: 160px;
  border-radius: 50%;
  right: -40px; top: -50px;
  background: rgba(52, 211, 153, 0.15);
  pointer-events: none;
}
.profile-head::before {
  content: "";
  position: absolute;
  width: 80px; height: 80px;
  border-radius: 50%;
  right: 60px; bottom: -30px;
  background: rgba(255,255,255, 0.08);
  pointer-events: none;
}

/* ═══════════════════════════════════
   快捷入口面板
═══════════════════════════════════ */
.quick-panel {
  background: linear-gradient(135deg, var(--brand-soft), rgba(204,251,241,.5));
  border: 1.5px solid rgba(15,118,110,.15);
  border-radius: 12px;
  padding: 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--brand);
  font-weight: 500;
  animation: fade .2s ease;
}
[data-theme="dark"] .quick-panel {
  background: rgba(19,78,74,.25);
  border-color: rgba(45,212,191,.2);
  color: var(--brand);
}

/* ═══════════════════════════════════
   消息列表
═══════════════════════════════════ */
.message-item {
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
}
.message-item:hover { box-shadow: var(--shadow); }
.message-item.unread { border-left: 3px solid var(--brand); }
.message-item.unread .message-body p { font-weight: 700; }
.message-body { flex: 1; min-width: 0; }
.message-body p { font-size: 14px; line-height: 1.5; }
.msg-time {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--subtext);
  margin-top: 2px;
}
.msg-unread-tag {
  display: inline-flex; align-items: center;
  margin-top: 5px;
  font-size: 11px; font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 2px 7px; border-radius: 999px;
}

/* ═══════════════════════════════════
   地图画布
═══════════════════════════════════ */
.map-canvas {
  position: relative;
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #e0f2fe 0%, #d1fae5 50%, #dcfce7 100%);
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  margin: 8px 0;
}
.map-canvas::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(0,0,0,.04) 0, rgba(0,0,0,.04) 1px, transparent 1px, transparent 32px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.04) 0, rgba(0,0,0,.04) 1px, transparent 1px, transparent 32px);
  pointer-events: none;
}
[data-theme="dark"] .map-canvas {
  background: linear-gradient(135deg, #1e293b 0%, #134e4a 50%, #0f2d2a 100%);
}

/* ═══════════════════════════════════
   风险点标记
═══════════════════════════════════ */
.dot {
  position: absolute;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,.28);
  border: 2.5px solid rgba(255,255,255,.6);
  transition: transform .15s;
}
.dot:hover { transform: translate(-50%, -50%) scale(1.18); }
.dot.high { background: var(--danger); }
.dot.mid  { background: var(--warning); }
.dot.low  { background: var(--success); }

/* ═══════════════════════════════════
   风险列表项
═══════════════════════════════════ */
.risk-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  transition: box-shadow .2s;
}
.risk-item:hover { box-shadow: var(--shadow); }
.risk-item h4 { margin-bottom: 4px; font-size: 14px; font-weight: 700; }
.risk-item p  { font-size: 13px; color: var(--subtext); margin: 0; }
.risk-item .risk-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }

/* ═══════════════════════════════════
   上报时间线
═══════════════════════════════════ */
.report-timeline {
  padding-left: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}
.report-timeline li {
  font-size: 13px;
  color: var(--subtext);
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  border-left: 3px solid var(--brand-light);
  line-height: 1.5;
}
.report-timeline li strong { color: var(--text); }
.report-timeline li .report-time {
  font-size: 11px;
  color: var(--subtext);
  display: block;
  margin-bottom: 2px;
}

/* ═══════════════════════════════════
   操作面板
═══════════════════════════════════ */
.action-panel { animation: fade .18s ease; }

/* ═══════════════════════════════════
   咨询 Tab 切换
═══════════════════════════════════ */
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab-btn {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--subtext);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: auto;
  transition: all .15s;
}
.tab-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: 0 3px 10px rgba(15,118,110,.25);
}
.tab-btn:not(.active):hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-soft); }

/* ═══════════════════════════════════
   评分显示（大数字）
═══════════════════════════════════ */
.score-display {
  font-size: 52px;
  font-weight: 900;
  color: var(--brand);
  line-height: 1;
  margin: 8px 0 4px;
}

/* ═══════════════════════════════════════════════════════════
   视频播放模态框
═══════════════════════════════════════════════════════════ */
.video-modal {
  border: none;
  border-radius: 20px;
  padding: 0;
  width: min(680px, calc(100vw - 24px));
  max-height: 90dvh;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(15,23,42,.25);
  background: var(--surface);
}
.video-modal::backdrop {
  background: rgba(15,23,42,.65);
  backdrop-filter: blur(4px);
}
.video-modal-inner {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.video-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.video-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
#videoPlayer {
  width: 100%;
  border-radius: 12px;
  background: #000;
  max-height: 60dvh;
  display: block;
}

/* 专家咨询输入区 */
.consult-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.consult-input-wrap textarea {
  flex: 1;
  min-width: 0;
}
.consult-send-btn {
  flex-shrink: 0;
  height: 38px;
  padding: 0 16px;
  align-self: flex-end;
}

/* 咨询气泡 */
.consult-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 85%;
  word-break: break-word;
}
.consult-bubble.user {
  background: var(--brand);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.consult-bubble.expert {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.consult-bubble.expert .expert-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  flex-shrink: 0;
  padding-top: 1px;
}

/* 视频上传进度 */
.upload-progress-wrap {
  margin-top: 10px;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
}
.upload-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--subtext);
  margin-bottom: 6px;
}
.upload-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.upload-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  width: 0%;
  transition: width .15s linear;
}

/* 电子证书卡片 */
.cert-card {
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  border-radius: 16px;
  padding: 24px 20px;
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cert-card::before {
  content: "";
  position: absolute;
  right: -20px; top: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  pointer-events: none;
}
.cert-stamp { font-size: 40px; margin-bottom: 8px; display: block; }
.cert-title { font-size: 18px; font-weight: 800; letter-spacing: .5px; }
.cert-sub { font-size: 12px; opacity: .8; margin-top: 4px; }
.cert-id {
  margin-top: 14px;
  font-size: 11px;
  opacity: .7;
  font-family: monospace;
  letter-spacing: 1px;
}
.cert-score {
  display: inline-block;
  background: rgba(255,255,255,.2);
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 13px;
  font-weight: 700;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════
   AI 助手浮层
═══════════════════════════════════════════════════════════ */

/* 悬浮按钮 */
.ai-fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--tab-height) + var(--safe-area-bottom) + 70px);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  box-shadow: 0 6px 20px rgba(15,118,110,.40);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  z-index: 200;
  transition: transform .2s, opacity .2s, box-shadow .2s;
}
.ai-fab:hover { transform: scale(1.08); box-shadow: 0 8px 28px rgba(15,118,110,.50); }
.ai-fab.ai-fab-hide { opacity: 0; pointer-events: none; transform: scale(.8); }
.ai-fab svg { color: #fff; width: 24px; height: 24px; }

/* 脉冲动画（有新消息时） */
@keyframes ai-pulse {
  0%,100% { box-shadow: 0 6px 20px rgba(15,118,110,.40); }
  50%      { box-shadow: 0 6px 28px rgba(15,118,110,.70), 0 0 0 8px rgba(15,118,110,.10); }
}
.ai-fab.ai-pulse { animation: ai-pulse 2s ease-in-out infinite; }

/* 聊天窗口 */
.ai-window {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tab-height) + var(--safe-area-bottom) + 16px);
  width: min(400px, calc(100vw - 32px));
  height: min(580px, calc(100dvh - var(--tab-height) - 80px));
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(15,23,42,.18);
  display: flex;
  flex-direction: column;
  z-index: 201;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
.ai-window.ai-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(24px) scale(.96);
}
.ai-window.ai-visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* 头部 */
.ai-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-light) 100%);
  flex-shrink: 0;
}
.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-avatar svg { color: #fff; width: 18px; height: 18px; }
.ai-header-info { flex: 1; }
.ai-header-name { font-size: 15px; font-weight: 700; color: #fff; }
.ai-header-sub  { font-size: 11px; color: rgba(255,255,255,.78); margin-top: 1px; display: flex; align-items: center; gap: 5px; }

/* 状态指示点 */
.ai-status-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  transition: background .3s;
}
.ai-status-dot.online   { background: #4ade80; }
.ai-status-dot.thinking { background: #fbbf24; animation: ai-blink .7s ease-in-out infinite alternate; }
.ai-status-dot.offline  { background: #f87171; }
@keyframes ai-blink { from { opacity: 1; } to { opacity: .3; } }

.ai-close {
  background: rgba(255,255,255,.2);
  border: none;
  border-radius: 8px;
  padding: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background .15s;
}
.ai-close:hover { background: rgba(255,255,255,.35); }
.ai-close svg { color: #fff; width: 16px; height: 16px; }

/* 快捷问题 */
.ai-quick {
  display: flex;
  gap: 6px;
  padding: 8px 12px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.ai-quick::-webkit-scrollbar { display: none; }
.ai-quick-btn {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--subtext);
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.ai-quick-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: transparent; }

/* 消息列表 */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.ai-messages::-webkit-scrollbar { width: 4px; }
.ai-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* 气泡 */
.ai-bubble-wrap { display: flex; }
.ai-bubble-wrap.user     { justify-content: flex-end; }
.ai-bubble-wrap.assistant,
.ai-bubble-wrap.system-alert { justify-content: flex-start; }

.ai-bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.ai-bubble-wrap.user .ai-bubble {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.ai-bubble-wrap.assistant .ai-bubble {
  background: var(--surface-2);
  color: var(--text);
  border-bottom-left-radius: 5px;
  border: 1px solid var(--border);
}
.ai-bubble-wrap.system-alert .ai-bubble {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  max-width: 100%;
}
[data-theme="dark"] .ai-bubble-wrap.system-alert .ai-bubble {
  background: #431407;
  color: #fb923c;
  border-color: #7c2d12;
}

.ai-bubble strong { font-weight: 700; }
.ai-step { font-weight: 700; color: var(--brand); }

/* 打字动画 */
.ai-typing { display: flex; align-items: center; gap: 4px; padding: 12px 14px; }
.ai-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--subtext);
  animation: ai-bounce .9s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: .15s; }
.ai-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes ai-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-6px); }
}

/* 输入区 */
.ai-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.ai-input {
  flex: 1;
  min-height: 38px;
  max-height: 120px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  overflow-y: auto;
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
.ai-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15,118,110,.10);
}
.ai-input::placeholder { color: var(--subtext); }

.ai-icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--subtext);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: all .15s;
}
.ai-icon-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.ai-icon-btn svg { width: 17px; height: 17px; }
.ai-icon-btn:disabled { opacity: .45; pointer-events: none; }

.ai-send-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: none;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: background .15s, transform .1s;
  box-shadow: 0 3px 10px rgba(15,118,110,.30);
}
.ai-send-btn:hover { background: var(--brand-mid); transform: scale(1.05); }
.ai-send-btn:disabled { opacity: .45; pointer-events: none; }
.ai-send-btn svg { width: 17px; height: 17px; }

/* 语音录音中 */
.ai-voice-active {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
  animation: ai-pulse-red .8s ease-in-out infinite alternate;
}
@keyframes ai-pulse-red {
  from { box-shadow: none; }
  to   { box-shadow: 0 0 0 6px rgba(220,38,38,.15); }
}

/* 适老化模式下字体放大 */
[data-elder="on"] .ai-bubble { font-size: 16px; line-height: 1.7; }
[data-elder="on"] .ai-input  { font-size: 16px; }
[data-elder="on"] .ai-quick-btn { font-size: 13px; padding: 7px 14px; }
[data-elder="on"] .ai-header-name { font-size: 17px; }
[data-elder="on"] .ai-fab { width: 62px; height: 62px; }
[data-elder="on"] .ai-fab svg { width: 28px; height: 28px; }

