/* =====================================================
   智能营销平台 - 银行端工作台 样式文件
   ===================================================== */

/* CSS变量定义 */
:root {
  /* 主色调 */
  --primary-color: #1890ff;
  --primary-hover: #40a9ff;
  --primary-light: #e6f7ff;

  /* 功能色 */
  --success-color: #52c41a;
  --warning-color: #faad14;
  --danger-color: #ff4d4f;
  --info-color: #1890ff;

  /* 中性色 */
  --text-primary: #262626;
  --text-secondary: #595959;
  --text-tertiary: #8c8c8c;
  --border-color: #d9d9d9;
  --divider-color: #f0f0f0;

  /* 背景色 */
  --bg-base: #f0f2f5;
  --bg-card: #ffffff;
  --bg-hover: #fafafa;

  /* 尺寸 */
  --sidebar-width: 220px;
  --header-height: 56px;
  --border-radius: 8px;
  --border-radius-sm: 4px;

  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-base: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);

  /* 动画 */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
}

/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-base);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

/* =====================================================
   布局
   ===================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #001529 0%, #002140 100%);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo h1 {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 18px;
}

/* 导航菜单 */
.nav-menu {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  color: #fff;
  background: rgba(24, 144, 255, 0.2);
  border-left-color: var(--primary-color);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.nav-item .nav-text {
  font-size: 14px;
}

/* 用户信息 */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.85);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 14px;
  font-weight: 500;
}

.user-name {
  font-size: 14px;
}

.user-role {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
  min-height: 100vh;
}

/* 页面头部 */
.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-breadcrumb {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.page-breadcrumb a {
  color: var(--text-tertiary);
}

.page-breadcrumb a:hover {
  color: var(--primary-color);
}

/* =====================================================
   卡片组件
   ===================================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-extra {
  color: var(--text-tertiary);
  font-size: 13px;
}

/* 统计卡片 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  box-shadow: var(--shadow-base);
  transform: translateY(-2px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.primary::before {
  background: var(--primary-color);
}

.stat-card.success::before {
  background: var(--success-color);
}

.stat-card.warning::before {
  background: var(--warning-color);
}

.stat-card.danger::before {
  background: var(--danger-color);
}

.stat-label {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-suffix {
  font-size: 14px;
  font-weight: 400;
  margin-left: 4px;
}

.stat-trend {
  margin-top: 8px;
  font-size: 13px;
}

.stat-trend.up {
  color: var(--success-color);
}

.stat-trend.down {
  color: var(--danger-color);
}

/* =====================================================
   表格组件
   ===================================================== */
.table-wrapper {
  overflow-x: auto;
}

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

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--divider-color);
}

.table th {
  background: var(--bg-hover);
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table .company-name {
  color: var(--primary-color);
  cursor: pointer;
  font-weight: 500;
}

.table .company-name:hover {
  text-decoration: underline;
}

/* =====================================================
   标签组件
   ===================================================== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  border-radius: 4px;
  margin-right: 4px;
}

.tag-blue {
  background: #e6f7ff;
  color: #1890ff;
  border: 1px solid #91d5ff;
}

.tag-green {
  background: #f6ffed;
  color: #52c41a;
  border: 1px solid #b7eb8f;
}

.tag-orange {
  background: #fff7e6;
  color: #fa8c16;
  border: 1px solid #ffd591;
}

.tag-red {
  background: #fff2f0;
  color: #ff4d4f;
  border: 1px solid #ffccc7;
}

.tag-purple {
  background: #f9f0ff;
  color: #722ed1;
  border: 1px solid #d3adf7;
}

/* 状态标签 */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 20px;
  font-weight: 500;
}

.status-pending {
  background: #fff7e6;
  color: #d46b08;
}

.status-contacted {
  background: #e6f7ff;
  color: #096dd9;
}

.status-interested {
  background: #f6ffed;
  color: #389e0d;
}

.status-success {
  background: #d9f7be;
  color: #237804;
}

.status-rejected {
  background: #fff2f0;
  color: #cf1322;
}

/* =====================================================
   按钮组件
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-default {
  background: #fff;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-default:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-text {
  background: transparent;
  color: var(--primary-color);
  padding: 4px 8px;
}

.btn-text:hover {
  background: var(--primary-light);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
}

.btn-icon {
  margin-right: 6px;
}

/* =====================================================
   表单组件
   ===================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.form-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: #fff;
  cursor: pointer;
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: var(--border-radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.filter-item {
  display: flex;
  align-items: center;
}

.filter-item label {
  margin-right: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  white-space: nowrap;
}

.filter-item .form-select,
.filter-item .form-input {
  min-width: 140px;
}

.filter-bar .search-input {
  flex: 1;
  max-width: 280px;
  position: relative;
}

.filter-bar .search-input input {
  padding-left: 36px;
}

.filter-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

/* =====================================================
   模态框组件
   ===================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.9);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--divider-color);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 130px);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--divider-color);
}

/* =====================================================
   Tab组件
   ===================================================== */
.tabs {
  border-bottom: 1px solid var(--divider-color);
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
}

.tab-item {
  padding: 12px 0;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
}

.tab-item:hover {
  color: var(--primary-color);
}

.tab-item.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 500;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* =====================================================
   进度/漏斗组件
   ===================================================== */
.funnel-chart {
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.funnel-step {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  width: 100%;
}

.funnel-bar-container {
  flex: 1;
  display: flex;
  align-items: center;
}

.funnel-bar {
  height: 40px;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-hover) 100%);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 500;
  transition: all var(--transition-base);
  cursor: pointer;
  min-width: 40px;
  overflow: visible;
  white-space: nowrap;
}

.funnel-bar:hover {
  filter: brightness(1.1);
}

.funnel-label {
  width: 50px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  padding-right: 12px;
  flex-shrink: 0;
}

.funnel-value {
  width: 60px;
  font-size: 13px;
  color: var(--text-secondary);
  padding-left: 12px;
  flex-shrink: 0;
}


/* =====================================================
   AI相关组件
   ===================================================== */
.ai-chat-box {
  background: linear-gradient(135deg, #e6f7ff 0%, #bae7ff 100%);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 20px;
}

.ai-chat-input {
  display: flex;
  gap: 12px;
}

.ai-chat-input input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 24px;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

.ai-chat-input input:focus {
  outline: none;
  box-shadow: var(--shadow-base);
}

.ai-chat-input .btn {
  border-radius: 24px;
  padding: 12px 24px;
}

.ai-response {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 16px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}

.ai-response-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.ai-avatar {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #1890ff 0%, #722ed1 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  color: #fff;
  font-size: 12px;
}

.ai-name {
  font-weight: 500;
  color: var(--text-primary);
}

/* AI推荐理由卡片 */
.ai-recommendation {
  background: linear-gradient(135deg, #f6ffed 0%, #d9f7be 100%);
  border: 1px solid #b7eb8f;
  border-radius: var(--border-radius);
  padding: 16px;
}

.ai-recommendation-title {
  display: flex;
  align-items: center;
  font-weight: 500;
  color: #389e0d;
  margin-bottom: 10px;
}

.ai-recommendation-title .icon {
  margin-right: 8px;
  font-size: 16px;
}

.ai-recommendation-text {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* =====================================================
   详情页组件
   ===================================================== */
.detail-header {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.detail-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.company-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.company-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.detail-actions {
  display: flex;
  gap: 8px;
}

.metric-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.metric-card {
  background: var(--bg-hover);
  border-radius: var(--border-radius-sm);
  padding: 16px;
  text-align: center;
}

.metric-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary-color);
}

.metric-label {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* 详情主体布局 */
.detail-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 联系信息卡片 */
.contact-card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.contact-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider-color);
}

.contact-item:last-child {
  border-bottom: none;
}

.contact-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  margin-right: 12px;
}

.contact-label {
  font-size: 12px;
  color: var(--text-tertiary);
}

.contact-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* =====================================================
   看板/图表组件
   ===================================================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.chart-placeholder {
  height: 200px;
  background: linear-gradient(135deg, var(--bg-hover) 0%, #f5f5f5 100%);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
}

.rank-list {
  list-style: none;
}

.rank-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--divider-color);
}

.rank-item:last-child {
  border-bottom: none;
}

.rank-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  margin-right: 12px;
}

.rank-number.top {
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
  color: #fff;
}

.rank-name {
  flex: 1;
}

.rank-value {
  font-weight: 600;
  color: var(--primary-color);
}

/* =====================================================
   工具类
   ===================================================== */
.text-primary {
  color: var(--primary-color);
}

.text-success {
  color: var(--success-color);
}

.text-warning {
  color: var(--warning-color);
}

.text-danger {
  color: var(--danger-color);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-tertiary {
  color: var(--text-tertiary);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.flex {
  display: flex;
}

.flex-1 {
  flex: 1;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-8 {
  gap: 8px;
}

.gap-16 {
  gap: 16px;
}

.hidden {
  display: none;
}

/* =====================================================
   动画效果
   ===================================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

.slide-up {
  animation: slideUp 0.4s ease;
}

/* =====================================================
   响应式适配
   ===================================================== */
@media (max-width: 1200px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-body {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .filter-bar {
    flex-wrap: wrap;
  }

  .stat-cards {
    grid-template-columns: 1fr;
  }
}