/* ===== LGSports 比赛页 AI 对话模态框样式 ===== */
/* 适用于 matches.html — 聊天模态框遮罩、头部、消息区、输入区 */

/* ========================================
   1. 模态框遮罩
   ======================================== */

.match-chat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: stretch;
  justify-content: center;
  animation: matchChatFadeIn 0.2s ease-out;
}

@keyframes matchChatFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========================================
   2. 模态框主体
   ======================================== */

.match-chat-modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  height: 100%;
  background: var(--dashboard-bg, #f5f7fa);
  animation: matchChatSlideUp 0.25s ease-out;
  overflow: hidden;
}

@keyframes matchChatSlideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ========================================
   3. 模态框头部
   ======================================== */

.match-chat-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--card-bg, #fff);
  border-bottom: 1px solid var(--border-color, #e8e8e8);
  flex-shrink: 0;
  z-index: 2;
}

.match-chat-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary, #333);
  flex-shrink: 0;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}

.match-chat-close:active {
  background: rgba(0, 0, 0, 0.06);
}

.match-chat-close svg {
  width: 22px;
  height: 22px;
}

.match-chat-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.match-chat-league {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #888);
  background: var(--chip-bg, #f5f5f5);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.match-chat-teams {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-chat-matchnum {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #888);
  background: var(--chip-bg, #f5f5f5);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.match-chat-time {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary, #888);
  background: var(--chip-bg, #f5f5f5);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ========================================
   4. 消息区域（复用 .chat-messages 基础样式）
   ======================================== */

.match-chat-modal .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.match-chat-modal .chat-messages::-webkit-scrollbar {
  display: none;
}

/* ========================================
   5. 输入区域（复用 .chat-input-area 基础样式）
   ======================================== */

.match-chat-modal .chat-input-area {
  padding: 10px 16px 14px;
  background: var(--card-bg, #fff);
  border-top: 1px solid var(--border-color, #e8e8e8);
  flex-shrink: 0;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

/* ========================================
   6. Dark-mode 适配
   ======================================== */

body.dark-mode .match-chat-overlay {
  background: rgba(0, 0, 0, 0.7);
}

body.dark-mode .match-chat-modal {
  background: #111827;
}

body.dark-mode .match-chat-header {
  background: #1f2937;
  border-bottom-color: #374151;
}

body.dark-mode .match-chat-close {
  color: #f3f4f6;
}

body.dark-mode .match-chat-close:active {
  background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .match-chat-league {
  background: #374151;
  color: #9ca3af;
}

body.dark-mode .match-chat-teams {
  color: #f3f4f6;
}

body.dark-mode .match-chat-matchnum {
  background: #374151;
  color: #9ca3af;
}

body.dark-mode .match-chat-time {
  background: #374151;
  color: #9ca3af;
}

body.dark-mode .match-chat-modal .chat-input-area {
  background: #1f2937;
  border-top-color: #374151;
}

/* ========================================
   7. 移动端响应式
   ======================================== */

@media (max-width: 768px) {
  .match-chat-modal {
    max-width: 100%;
  }

  .match-chat-header {
    padding: 10px 12px;
    gap: 5px;
  }

  .match-chat-close {
    width: 32px;
    height: 32px;
  }

  .match-chat-close svg {
    width: 20px;
    height: 20px;
  }

  .match-chat-teams {
    font-size: 13px;
  }

  .match-chat-matchnum {
    font-size: 11px;
  }

  .match-chat-time {
    font-size: 11px;
  }

  .match-chat-league {
    font-size: 11px;
    padding: 1px 6px;
  }

  .match-chat-modal .chat-messages {
    padding: 12px 12px;
    gap: 10px;
  }

  .match-chat-modal .chat-input-area {
    padding: 8px 12px 12px;
  }
}

/* ========================================
   8. 专家选择器面板
   ======================================== */

.expert-select-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--dashboard-bg, #f5f7fa);
}

.esp-head {
  padding: 18px 20px 10px;
  flex-shrink: 0;
}

.esp-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.esp-help-btn {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid rgba(102, 126, 234, 0.4);
  border-radius: 999px;
  background: transparent;
  color: #667eea;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.esp-help-btn:active,
.esp-help-btn.active {
  background: rgba(102, 126, 234, 0.12);
}

.esp-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
}

.esp-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary, #888);
  line-height: 1.5;
}

.esp-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
  -webkit-overflow-scrolling: touch;
}

/* 战绩四指标说明面板 */
.esp-stats-help {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--stat-bg, #f5f6fa);
}

.esh-item {
  display: flex;
  gap: 8px;
  font-size: 11px;
  line-height: 1.6;
}

.esh-item + .esh-item {
  margin-top: 6px;
}

.esh-item b {
  flex-shrink: 0;
  color: var(--text-primary, #333);
  font-weight: 600;
}

.esh-item span {
  color: var(--text-secondary, #888);
}

.esp-group-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #888);
  margin: 14px 4px 8px;
}

.esp-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--card-bg, #fff);
  border: 1.5px solid var(--border-color, #e8e8e8);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.esp-card:active {
  transform: scale(0.99);
}

.esp-card.selected {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.esp-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.esp-card-avatar svg {
  width: 100%;
  height: 100%;
}

.esp-card-info {
  flex: 1;
  min-width: 0;
}

.esp-card-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
}

.esp-badge {
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.esp-badge.official {
  background: rgba(102, 126, 234, 0.12);
  color: #667eea;
}

.esp-badge.custom {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.esp-card-desc {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.esp-card-stats {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary, #888);
}

/* 指标胶囊徽章：标签弱化 + 数值主体 */
.esp-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--stat-bg, #f5f6fa);
  white-space: nowrap;
}

.esp-label {
  font-style: normal;
  font-size: 10px;
  color: var(--text-secondary, #999);
}

.esp-stat b {
  color: var(--text-primary, #333);
  font-weight: 600;
}

.esp-stat b.up { color: #ef4444; }
.esp-stat b.down { color: #10b981; }

/* 命中率置信区间小字 */
.esp-ci {
  font-style: normal;
  font-size: 10px;
  font-weight: 400;
  color: #999;
  margin-left: 1px;
}

.esp-stat-empty {
  color: #bbb;
  background: transparent;
  padding-left: 2px;
}

/* 场次胶囊：无标签纯数值 */
.esp-stat-plain {
  background: transparent;
  padding-left: 2px;
}

.esp-card-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #667eea;
  color: #fff;
  font-size: 13px;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.esp-card.selected .esp-card-check {
  display: flex;
}

.esp-empty {
  text-align: center;
  color: #888;
  padding: 32px 0;
  font-size: 13px;
}

/* 产出预告确认层 */
.esp-confirm {
  flex-shrink: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--card-bg, #fff);
  border-top: 1px solid var(--border-color, #e8e8e8);
}

.esp-confirm-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #1a1a2e);
}

.esp-confirm-desc {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-secondary, #666);
  line-height: 1.6;
}

.esp-confirm-cost {
  margin-top: 3px;
  font-size: 11px;
  color: #f59e0b;
}

.esp-confirm-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.esp-btn-start {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 10px;
  background: #667eea;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.esp-btn-start:active {
  opacity: 0.85;
}

.esp-btn-cancel {
  padding: 10px 16px;
  border: 1px solid var(--border-color, #e0e0e0);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary, #666);
  font-size: 14px;
  cursor: pointer;
}

/* ========================================
   9. 头部当前专家 chip + 追问 chips
   ======================================== */

.match-chat-expert {
  font-size: 12px;
  font-weight: 600;
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.match-chat-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.match-chat-chips::-webkit-scrollbar {
  display: none;
}

.match-chat-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid rgba(102, 126, 234, 0.35);
  border-radius: 16px;
  background: rgba(102, 126, 234, 0.06);
  color: #667eea;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.match-chat-chip:active {
  background: rgba(102, 126, 234, 0.15);
}

/* ========================================
   10. 专家层 Dark-mode 适配
   ======================================== */

body.dark-mode .expert-select-panel {
  background: #111827;
}

body.dark-mode .esp-title {
  color: #f3f4f6;
}

body.dark-mode .esp-card {
  background: #1f2937;
  border-color: #374151;
}

body.dark-mode .esp-card.selected {
  border-color: #667eea;
}

body.dark-mode .esp-card-name {
  color: #f3f4f6;
}

body.dark-mode .esp-stat {
  background: #1f2937;
}

body.dark-mode .esp-stats-help {
  background: #1f2937;
}

body.dark-mode .esh-item b {
  color: #e5e7eb;
}

body.dark-mode .esh-item span {
  color: #9ca3af;
}

body.dark-mode .esp-stat-empty,
body.dark-mode .esp-stat-plain {
  background: transparent;
}

body.dark-mode .esp-label {
  color: #9ca3af;
}

body.dark-mode .esp-stat b {
  color: #e5e7eb;
}

body.dark-mode .esp-confirm {
  background: #1f2937;
  border-top-color: #374151;
}

body.dark-mode .esp-confirm-title {
  color: #f3f4f6;
}

body.dark-mode .esp-confirm-desc {
  color: #9ca3af;
}

body.dark-mode .esp-btn-cancel {
  border-color: #4b5563;
  color: #9ca3af;
}

/* ========================================
   专家横滑条（对话态切换/会诊）
   ======================================== */

.match-expert-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid #eee;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}

.match-expert-bar::-webkit-scrollbar {
  display: none;
}

.meb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.meb-item:hover {
  border-color: #c7d2fe;
}

.meb-item.active {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.meb-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.meb-avatar svg {
  width: 100%;
  height: 100%;
}

.meb-name {
  font-size: 12px;
  font-weight: 600;
  color: #4b5563;
}

.meb-item.active .meb-name {
  color: #4f46e5;
}

body.dark-mode .match-expert-bar {
  border-bottom-color: #374151;
}

body.dark-mode .meb-item {
  background: #1f2937;
  border-color: #374151;
}

body.dark-mode .meb-item.active {
  border-color: #667eea;
}

body.dark-mode .meb-name {
  color: #d1d5db;
}

body.dark-mode .meb-item.active .meb-name {
  color: #a5b4fc;
}

/* ========================================
   沉淀出口栏（观点沉淀与导流闭环）
   ======================================== */

.match-chat-outlets {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.match-chat-outlets::-webkit-scrollbar {
  display: none;
}

.mco-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border: 1px dashed #d1d5db;
  border-radius: 16px;
  background: #fafafa;
  color: #4b5563;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.mco-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.mco-btn:active {
  background: #f3f4f6;
}

.mco-btn.mco-predict {
  border-style: solid;
  border-color: rgba(102, 126, 234, 0.45);
  background: rgba(102, 126, 234, 0.06);
  color: #4f46e5;
}

.mco-btn.mco-predict.confirming {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
}

.mco-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

body.dark-mode .mco-btn {
  border-color: #4b5563;
  background: #1f2937;
  color: #d1d5db;
}

body.dark-mode .mco-btn.mco-predict {
  border-color: rgba(102, 126, 234, 0.55);
  background: rgba(102, 126, 234, 0.12);
  color: #a5b4fc;
}

body.dark-mode .mco-btn.mco-predict.confirming {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
