/**
 * 现代化组件样式
 * 基于设计系统的核心组件实现
 */

/* ==================== 卡片组件 ==================== */
.card {
  background: var(--surface-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--neutral-200);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary-200);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--neutral-200);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--neutral-900);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.card-icon {
  width: 20px;
  height: 20px;
  color: var(--primary-500);
  flex-shrink: 0;
}

.card-body {
  padding: 0;
}

.card-footer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--neutral-200);
}

/* ==================== 输入组件 ==================== */
.input-group {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-4);
}

.input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--neutral-100);
  transition: all var(--transition-base);
}

.input-row:last-child {
  border-bottom: none;
}

.input-row:hover {
  background-color: var(--neutral-50);
  border-radius: var(--radius-base);
  padding-left: var(--space-2);
  padding-right: var(--space-2);
}

.input-label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--neutral-700);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
}

.input-field {
  width: 80px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-base);
  font-size: var(--text-sm);
  font-family: var(--font-family-mono);
  font-weight: var(--font-weight-medium);
  background: var(--surface-primary);
  color: var(--neutral-900);
  text-align: center;
  transition: all var(--transition-base);
}

.input-field:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
  background: var(--primary-50);
}

.input-field:hover:not(:focus) {
  border-color: var(--neutral-400);
  background: var(--neutral-50);
}

.input-field.error {
  border-color: var(--error-500);
  box-shadow: 0 0 0 3px rgba(255, 82, 82, 0.1);
  background: var(--error-50);
}

.input-field.success {
  border-color: var(--success-500);
  box-shadow: 0 0 0 3px rgba(80, 227, 194, 0.1);
  background: var(--success-50);
}

.input-unit {
  font-size: var(--text-xs);
  color: var(--neutral-600);
  font-weight: var(--font-weight-medium);
  min-width: 24px;
  text-align: center;
}

.input-error-message {
  font-size: var(--text-xs);
  color: var(--error-500);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.input-error-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* ==================== 按钮组件 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary-500);
  color: white;
  width: 200px;
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  margin: var(--space-8) auto 0;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(74, 144, 226, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.btn-loading {
  opacity: 0.8;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-loading .btn-text {
  opacity: 0.7;
}

.btn-loading::before {
  content: '';
  position: absolute;
  left: var(--space-4);
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ==================== 工具提示组件 ==================== */
.tooltip-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.tooltip-icon {
  width: 16px;
  height: 16px;
  margin-left: var(--space-2);
  color: var(--neutral-500);
  transition: color var(--transition-base);
  flex-shrink: 0;
}

.tooltip-trigger:hover .tooltip-icon {
  color: var(--primary-500);
}

.tooltip-content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  
  /* 自适应宽度设计 */
  min-width: 120px;
  max-width: 380px;
  width: max-content;
  
  /* 优雅的视觉设计 */
  background: rgba(15, 23, 42, 0.96);
  color: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  
  /* 现代化效果 */
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.15);
  
  /* 隐藏状态 */
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-4px);
  transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
  
  /* 层级 */
  z-index: 1000;
  
  /* 文本优化 */
  word-wrap: break-word;
  hyphens: auto;
}

.tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  
  /* 箭头设计 */
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.96);
  
  /* 箭头阴影效果 */
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.tooltip-trigger:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==================== 开关组件 ==================== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--neutral-300);
  transition: var(--transition-base);
  border-radius: var(--radius-full);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-base);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-500);
}

.toggle-switch input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* ==================== 状态指示器 ==================== */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  background: var(--neutral-100);
  color: var(--neutral-700);
  transition: all var(--transition-base);
}

.status-indicator.status-idle {
  background: var(--neutral-100);
  color: var(--neutral-700);
}

.status-indicator.status-calculating {
  background: var(--warning-100);
  color: var(--warning-700);
}

.status-indicator.status-success {
  background: var(--success-100);
  color: var(--success-700);
}

.status-indicator.status-error {
  background: var(--error-100);
  color: var(--error-700);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.status-calculating .status-dot {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ==================== 信息提示 ==================== */
.info-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--info-50);
  border: 1px solid var(--info-200);
  border-radius: var(--radius-md);
  margin-top: var(--space-4);
}

.info-note-icon {
  width: 16px;
  height: 16px;
  color: var(--info-500);
  flex-shrink: 0;
  margin-top: 2px;
}

.info-note-text {
  font-size: var(--text-sm);
  color: var(--info-700);
  line-height: var(--line-height-snug);
  margin: 0;
}

/* ==================== 标签组件 ==================== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  background: var(--warning-100);
  color: var(--warning-700);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-medium);
  border-radius: var(--radius-sm);
  margin-left: var(--space-2);
}

.tag.tag-adjustable {
  background: var(--success-100);
  color: var(--success-700);
}

/* ==================== 加载动画 ==================== */
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--neutral-200);
  border-top: 2px solid var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-dots {
  display: inline-flex;
  gap: var(--space-1);
}

.loading-dot {
  width: 4px;
  height: 4px;
  background: var(--primary-500);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

/* ==================== 仪表板风格卡片 - 参考专业dashboard设计 ==================== */
.dashboard-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 0;
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 1px 2px rgba(0, 0, 0, 0.02);
  border: 1px solid #e5e7eb;
  margin-bottom: 24px;
  transition: all 0.2s ease;
  overflow: hidden;
}

.dashboard-card:hover {
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.04);
  border-color: #d1d5db;
}

/* 卡片头部 */
.dashboard-header {
  padding: 24px 32px 16px;
  border-bottom: 1px solid #f3f4f6;
  background: #ffffff;
}

.dashboard-title {
  font-size: 24px;
  font-weight: 600;
  color: #111827;
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

/* 卡片内容 */
.dashboard-content {
  padding: 24px 32px 32px;
  background: #ffffff;
}

/* 指标网格 */
.dashboard-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

/* 单个指标 */
.dashboard-metric {
  text-align: center;
  padding: 16px 0;
}

.metric-number {
  font-size: 48px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
  margin-bottom: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  letter-spacing: -0.02em;
}

.metric-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
  line-height: 1.3;
}

.metric-subtitle {
  font-size: 14px;
  color: #6b7280;
  font-weight: 400;
  line-height: 1.4;
  margin: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .dashboard-card {
    margin-bottom: 20px;
    border-radius: 6px;
  }
  
  .dashboard-header {
    padding: 20px 24px 12px;
  }
  
  .dashboard-title {
    font-size: 20px;
  }
  
  .dashboard-content {
    padding: 20px 24px 24px;
  }
  
  .dashboard-metric-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .metric-number {
    font-size: 40px;
  }
  
  .metric-title {
    font-size: 15px;
  }
  
  .metric-subtitle {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .dashboard-header {
    padding: 16px 20px 12px;
  }
  
  .dashboard-content {
    padding: 16px 20px 20px;
  }
  
  .dashboard-title {
    font-size: 18px;
  }
  
  .metric-number {
    font-size: 36px;
  }
}

/* 保留动画效果 */
.dashboard-card.animate-fadeIn {
  animation: fadeIn 0.6s ease-out;
}

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

/* 数字动画效果 */
.metric-number.animate-number {
  animation: numberPulse 0.6s ease-out;
}

@keyframes numberPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
    color: #2563eb;
  }
  100% {
    transform: scale(1);
  }
}

/* hover状态增强 */
.dashboard-metric:hover .metric-number {
  color: #1d4ed8;
  transition: color 0.2s ease;
}

.dashboard-metric:hover .metric-title {
  color: #059669;
  transition: color 0.2s ease;
}

/* 数字高亮效果 */
.metric-number {
  transition: all 0.3s ease;
  position: relative;
}

.metric-number::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  transition: width 0.3s ease;
}

.dashboard-metric:hover .metric-number::after {
  width: 60%;
}

/* ==================== 原银行专业级人力配置卡片 - 精致平面设计 ==================== */
.banking-professional-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.banking-professional-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #1e40af;
}

.banking-professional-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

/* 头部区域 - 精致平面设计 */
.banking-header-section {
  display: flex;
  align-items: center;
  padding: 32px 32px 24px;
  background: #fafbfc;
  border-bottom: 1px solid #e5e7eb;
  position: relative;
}

.banking-icon-container {
  margin-right: 24px;
  position: relative;
}

.banking-icon-wrapper {
  width: 56px;
  height: 56px;
  background: #1e40af;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.banking-icon {
  font-size: 24px;
  color: #ffffff;
  position: relative;
}

.banking-icon-glow {
  display: none;
}

.banking-title-section {
  flex: 1;
}

.banking-main-title {
  font-size: 22px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.banking-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.4;
}

/* 主要指标区域 - 精致平面设计 */
.banking-main-metric {
  padding: 40px 32px 32px;
  text-align: center;
  background: #ffffff;
}

.metric-value-container {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.metric-prefix {
  font-size: 16px;
  font-weight: 500;
  color: #6b7280;
  letter-spacing: 0;
}

.metric-value {
  font-size: 64px;
  font-weight: 700;
  color: #1e40af;
  line-height: 1;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
}

.metric-value::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: #1e40af;
}

.metric-suffix {
  font-size: 18px;
  font-weight: 500;
  color: #374151;
  letter-spacing: 0;
}

.metric-description {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.metric-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-confidence {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #ecfdf5;
  border: 1px solid #d1fae5;
  border-radius: 6px;
}

.confidence-icon {
  font-size: 14px;
  color: #059669;
}

.confidence-text {
  font-size: 12px;
  color: #047857;
  font-weight: 500;
  letter-spacing: 0;
}

/* 分割线 - 精致平面设计 */
.banking-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0 32px;
  position: relative;
}

.banking-divider::before {
  display: none;
}

/* 状态栏 - 精致平面设计 */
.banking-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px 32px;
  background: #fafbfc;
  gap: 20px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  flex: 1;
  justify-content: center;
  transition: all 0.15s ease;
}

.status-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.status-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.status-icon.status-success {
  color: #059669;
}

.status-icon.status-info {
  color: #0284c7;
}

.status-icon.status-neutral {
  color: #6b7280;
}

.status-text {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  letter-spacing: 0;
}

/* 响应式调整 - 精致平面设计 */
@media (max-width: 768px) {
  .banking-professional-card {
    border-radius: 8px;
  }
  
  .banking-header-section,
  .banking-main-metric,
  .banking-status-bar {
    padding-left: 24px;
    padding-right: 24px;
  }
  
  .banking-header-section {
    padding-top: 24px;
    padding-bottom: 20px;
  }
  
  .banking-main-metric {
    padding-top: 32px;
    padding-bottom: 24px;
  }
  
  .banking-status-bar {
    padding-top: 20px;
    padding-bottom: 24px;
  }
  
  .metric-value {
    font-size: 48px;
  }
  
  .banking-status-bar {
    flex-direction: column;
    gap: 12px;
  }
  
  .status-item {
    width: 100%;
  }
  
  .banking-divider {
    margin: 0 24px;
  }
  
  .banking-icon-wrapper {
    width: 48px;
    height: 48px;
  }
  
  .banking-icon {
    font-size: 20px;
  }
  
  .banking-main-title {
    font-size: 20px;
  }
  
  .banking-subtitle {
    font-size: 13px;
  }
}

/* ==================== 响应式调整 ==================== */
@media (max-width: 768px) {
  .card {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
  }
  
  .input-field {
    width: 70px;
    font-size: var(--text-xs);
  }
  
  .btn-primary {
    width: 100%;
    margin: var(--space-6) 0 0;
  }
  
  .tooltip-content {
    max-width: 300px;
    font-size: var(--text-xs);
  }
  
  .input-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-4) 0;
  }
  
  .input-row .input-field {
    width: 100%;
    max-width: 120px;
  }
}

/* ==================== 约束指示器样式 ==================== */
.constraint-indicator {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  color: var(--primary-600);
  margin-left: var(--space-2);
  margin-right: var(--space-1);
  display: inline-flex;
  align-items: center;
  min-width: 20px;
  justify-content: center;
}