/* ============================================================
   客户智能分析系统 — 样式
   ============================================================ */

:root {
  --ca-primary: #1a2a4a;
  --ca-accent: #c8a951;
  --ca-accent2: #e8c96e;
  --ca-bg-dark: #0a0f1e;
  --ca-bg-card: #111d30;
  --ca-bg-card-hover: #162540;
  --ca-text-light: #f0f4ff;
  --ca-text-muted: #94a3b8;
  --ca-border: rgba(200, 169, 81, 0.25);
  --ca-gradient-gold: linear-gradient(135deg, #c8a951 0%, #e8c96e 50%, #c8a951 100%);
  --ca-green: #10b981;
  --ca-red: #ef4444;
  --ca-yellow: #f59e0b;
  --ca-blue: #3b82f6;
}

/* ===== 页面布局 ===== */
.ca-page-wrap {
  min-height: 100vh;
  background: var(--ca-bg-dark);
  padding: 88px 32px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.ca-page-header {
  margin-bottom: 32px;
}

.ca-page-title {
  font-size: 28px;
  font-weight: 700;
  background: var(--ca-gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.ca-page-subtitle {
  font-size: 14px;
  color: var(--ca-text-muted);
}

/* ===== 搜索区域 ===== */
.ca-search-section {
  background: var(--ca-bg-card);
  border: 1px solid var(--ca-border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 28px;
  text-align: center;
}

.ca-search-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ca-text-light);
  margin-bottom: 20px;
}

.ca-search-box {
  display: flex;
  gap: 12px;
  max-width: 600px;
  margin: 0 auto;
}

.ca-search-input {
  flex: 1;
  padding: 14px 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--ca-border);
  border-radius: 12px;
  color: var(--ca-text-light);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.ca-search-input:focus {
  border-color: var(--ca-accent);
  box-shadow: 0 0 0 3px rgba(200,169,81,0.1);
}

.ca-search-input::placeholder {
  color: var(--ca-text-muted);
}

.ca-search-btn {
  padding: 14px 32px;
  background: var(--ca-gradient-gold);
  color: #0a0f1e;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.ca-search-btn:hover {
  opacity: 0.9;
}

.ca-search-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 工商信息卡片 ===== */
.ca-company-card {
  background: var(--ca-bg-card);
  border: 1px solid var(--ca-border);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
  animation: caFadeIn 0.3s ease;
}

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

.ca-company-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.ca-company-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--ca-text-light);
}

.ca-company-status {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.ca-status-active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--ca-green);
}

.ca-status-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: var(--ca-red);
}

.ca-company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.ca-info-item {
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
}

.ca-info-label {
  font-size: 11px;
  color: var(--ca-text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ca-info-value {
  font-size: 14px;
  color: var(--ca-text-light);
  line-height: 1.5;
}

.ca-company-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.ca-btn {
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ca-btn-primary {
  background: var(--ca-gradient-gold);
  color: #0a0f1e;
}

.ca-btn-primary:hover {
  opacity: 0.9;
}

.ca-btn-outline {
  background: transparent;
  color: var(--ca-accent);
  border: 1px solid var(--ca-border);
}

.ca-btn-outline:hover {
  background: rgba(200,169,81,0.08);
  border-color: var(--ca-accent);
}

.ca-btn-sm {
  padding: 8px 18px;
  font-size: 13px;
}

/* ===== 对话界面 ===== */
.ca-chat-layout {
  display: flex;
  gap: 24px;
  min-height: calc(100vh - 160px);
}

.ca-chat-sidebar {
  width: 280px;
  flex-shrink: 0;
}

.ca-chat-sidebar-card {
  background: var(--ca-bg-card);
  border: 1px solid var(--ca-border);
  border-radius: 14px;
  padding: 20px;
  position: sticky;
  top: 100px;
}

.ca-chat-sidebar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ca-accent2);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ca-border);
}

.ca-chat-info-row {
  margin-bottom: 10px;
}

.ca-chat-info-label {
  font-size: 11px;
  color: var(--ca-text-muted);
  margin-bottom: 2px;
}

.ca-chat-info-value {
  font-size: 13px;
  color: var(--ca-text-light);
}

.ca-chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ca-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--ca-bg-card);
  border: 1px solid var(--ca-border);
  border-radius: 14px;
  margin-bottom: 16px;
  max-height: calc(100vh - 300px);
  min-height: 400px;
}

.ca-message {
  display: flex;
  margin-bottom: 20px;
  animation: caMsgIn 0.3s ease;
}

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

.ca-message-user {
  flex-direction: row-reverse;
}

.ca-message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  margin: 0 12px;
}

.ca-avatar-user {
  background: var(--ca-gradient-gold);
  color: #0a0f1e;
}

.ca-avatar-ai {
  background: rgba(59, 130, 246, 0.2);
  color: var(--ca-blue);
}

.ca-message-bubble {
  max-width: 70%;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.7;
  word-wrap: break-word;
}

.ca-bubble-user {
  background: var(--ca-gradient-gold);
  color: #0a0f1e;
  border-bottom-right-radius: 4px;
}

.ca-bubble-ai {
  background: rgba(255,255,255,0.06);
  color: var(--ca-text-light);
  border-bottom-left-radius: 4px;
}

.ca-message-time {
  font-size: 11px;
  color: var(--ca-text-muted);
  margin-top: 6px;
}

.ca-bubble-ai a {
  color: var(--ca-accent);
  text-decoration: underline;
}

.ca-chat-input-area {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--ca-bg-card);
  border: 1px solid var(--ca-border);
  border-radius: 14px;
}

.ca-chat-input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ca-text-light);
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  transition: border-color 0.2s;
}

.ca-chat-input:focus {
  border-color: var(--ca-accent);
}

.ca-chat-input::placeholder {
  color: var(--ca-text-muted);
}

.ca-chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--ca-gradient-gold);
  color: #0a0f1e;
  border: none;
  font-size: 20px;
  cursor: pointer;
  transition: opacity 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ca-chat-send-btn:hover {
  opacity: 0.9;
}

.ca-chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ca-typing {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  align-items: center;
}

.ca-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ca-text-muted);
  animation: caTyping 1.4s ease-in-out infinite;
}

.ca-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ca-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes caTyping {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1); }
}

/* ===== 报告页面 ===== */
.ca-report-card {
  background: var(--ca-bg-card);
  border: 1px solid var(--ca-border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
}

.ca-report-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ca-border);
}

.ca-report-company {
  font-size: 26px;
  font-weight: 700;
  color: var(--ca-text-light);
  margin-bottom: 8px;
}

.ca-report-meta {
  font-size: 13px;
  color: var(--ca-text-muted);
}

.ca-score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px auto;
  font-size: 28px;
  font-weight: 700;
}

.ca-score-high {
  background: rgba(16, 185, 129, 0.12);
  border: 3px solid var(--ca-green);
  color: var(--ca-green);
}

.ca-score-medium {
  background: rgba(245, 158, 11, 0.12);
  border: 3px solid var(--ca-yellow);
  color: var(--ca-yellow);
}

.ca-score-low {
  background: rgba(239, 68, 68, 0.12);
  border: 3px solid var(--ca-red);
  color: var(--ca-red);
}

.ca-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ca-accent2);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ca-border);
}

.ca-swot-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.ca-swot-item {
  padding: 20px;
  border-radius: 12px;
  border: 1px solid;
}

.ca-swot-s {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.2);
}

.ca-swot-w {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.2);
}

.ca-swot-o {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.2);
}

.ca-swot-t {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.2);
}

.ca-swot-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.ca-swot-s .ca-swot-title { color: var(--ca-green); }
.ca-swot-w .ca-swot-title { color: var(--ca-red); }
.ca-swot-o .ca-swot-title { color: var(--ca-blue); }
.ca-swot-t .ca-swot-title { color: var(--ca-yellow); }

.ca-swot-list {
  list-style: none;
  padding: 0;
}

.ca-swot-list li {
  font-size: 13px;
  color: var(--ca-text-light);
  padding: 6px 0;
  line-height: 1.5;
}

.ca-swot-list li::before {
  content: '•';
  margin-right: 8px;
}

.ca-action-list {
  list-style: none;
  padding: 0;
}

.ca-action-item {
  padding: 16px 18px;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  border-left: 3px solid var(--ca-accent);
}

.ca-action-step {
  font-size: 12px;
  color: var(--ca-accent);
  font-weight: 600;
  margin-bottom: 4px;
}

.ca-action-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ca-text-light);
  margin-bottom: 4px;
}

.ca-action-desc {
  font-size: 13px;
  color: var(--ca-text-muted);
  line-height: 1.5;
}

.ca-action-timeline {
  font-size: 12px;
  color: var(--ca-accent);
  margin-top: 6px;
}

.ca-talking-points {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.ca-talking-card {
  padding: 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  border: 1px solid var(--ca-border);
}

.ca-talking-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ca-accent);
  margin-bottom: 10px;
}

.ca-talking-card ul {
  list-style: none;
  padding: 0;
}

.ca-talking-card li {
  font-size: 13px;
  color: var(--ca-text-light);
  padding: 4px 0;
  line-height: 1.5;
}

.ca-talking-card li::before {
  content: '💬 ';
}

/* ===== 历史报告列表 ===== */
.ca-table-wrap {
  background: var(--ca-bg-card);
  border: 1px solid var(--ca-border);
  border-radius: 14px;
  overflow: hidden;
}

.ca-table {
  width: 100%;
  border-collapse: collapse;
}

.ca-table th {
  background: rgba(255,255,255,0.03);
  padding: 14px 18px;
  font-size: 12px;
  color: var(--ca-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--ca-border);
}

.ca-table td {
  padding: 14px 18px;
  font-size: 14px;
  color: var(--ca-text-light);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ca-table tr:last-child td {
  border-bottom: none;
}

.ca-table tr:hover {
  background: rgba(255,255,255,0.02);
}

.ca-score-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.ca-badge-high { background: rgba(16,185,129,0.15); color: var(--ca-green); }
.ca-badge-mid { background: rgba(245,158,11,0.15); color: var(--ca-yellow); }
.ca-badge-low { background: rgba(239,68,68,0.15); color: var(--ca-red); }

.ca-table-link {
  color: var(--ca-accent);
  text-decoration: none;
  font-weight: 500;
}

.ca-table-link:hover {
  text-decoration: underline;
}

.ca-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ca-text-muted);
}

.ca-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.ca-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ca-text-light);
  margin-bottom: 8px;
}

.ca-empty-desc {
  font-size: 14px;
  margin-bottom: 24px;
}

/* ===== 加载动画 ===== */
.ca-loading {
  text-align: center;
  padding: 40px;
}

.ca-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--ca-border);
  border-top: 3px solid var(--ca-accent);
  border-radius: 50%;
  animation: caSpin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes caSpin {
  to { transform: rotate(360deg); }
}

/* ===== 通知提示 ===== */
.ca-toast {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: caSlideIn 0.3s ease;
  max-width: 400px;
}

.ca-toast-success {
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
}

.ca-toast-error {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

.ca-toast-info {
  background: rgba(59, 130, 246, 0.9);
  color: #fff;
}

@keyframes caSlideIn {
  from { transform: translateX(100px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .ca-page-wrap {
    padding: 80px 16px 24px;
  }
  .ca-search-box {
    flex-direction: column;
  }
  .ca-company-grid {
    grid-template-columns: 1fr;
  }
  .ca-chat-layout {
    flex-direction: column;
  }
  .ca-chat-sidebar {
    width: 100%;
  }
  .ca-chat-sidebar-card {
    position: static;
  }
  .ca-swot-grid {
    grid-template-columns: 1fr;
  }
  .ca-talking-points {
    grid-template-columns: 1fr;
  }
  .ca-page-title {
    font-size: 22px;
  }
  .ca-company-name {
    font-size: 18px;
  }
}


/* ===== 语音输入按钮 ===== */
.mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--ca-primary);
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.mic-btn:hover {
  background: var(--ca-accent);
  transform: scale(1.05);
}

.mic-btn.recording {
  background: #e53935;
  animation: micPulse 1s infinite;
}

.mic-btn.recording:hover {
  background: #c62828;
}

@keyframes micPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.5); }
  50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(229, 57, 53, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(229, 57, 53, 0); }
}

.mic-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mic-btn:disabled:hover {
  background: var(--ca-primary);
  transform: none;
}

/* TTS播放按钮 */
.ca-message-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.ca-tts-btn {
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
  transition: all 0.2s;
  user-select: none;
  display: inline-flex;
  align-items: center;
}
.ca-tts-btn:hover {
  opacity: 1;
  transform: scale(1.15);
}
.ca-tts-btn.playing {
  opacity: 1;
  animation: ttsPulse 1s infinite;
}
@keyframes ttsPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}
