/* 现代化深色主题配色 */
:root {
  /* 主色调 */
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  
  /* 背景色 */
  --bg-primary: #0f1419;
  --bg-secondary: #1a1d23;
  --bg-tertiary: #252a35;
  --bg-card: #2a2f3c;
  --bg-elevated: #333847;
  
  /* 文字色 */
  --text-primary: #ffffff;
  --text-secondary: #b4bcd0;
  --text-muted: #8a92a8;
  --text-accent: #667eea;
  
  /* 边框色 */
  --border-primary: #3a4050;
  --border-secondary: #4a5064;
  --border-accent: #667eea;
  
  /* 状态色 */
  --success: #52c41a;
  --warning: #faad14;
  --error: #ff4d4f;
  --info: #1890ff;
  
  /* 状态背景色 */
  --success-bg: rgba(82, 196, 26, 0.1);
  --warning-bg: rgba(250, 173, 20, 0.1);
  --danger-bg: rgba(255, 77, 79, 0.1);
  
  /* 按钮悬停色 */
  --primary-color: #1890ff;
  --primary-hover: #40a9ff;
  --danger-hover: #ff7875;
  
  /* 布局颜色别名 */
  --bg-light: var(--bg-secondary);
  --border-light: var(--border-primary);
}

/* 计费显示组件样式 */
.billing-display {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  min-width: 200px;
  backdrop-filter: blur(10px);
}

.billing-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-primary);
}

.billing-info {
  display: flex;
  align-items: center;
  flex: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
  padding: 4px;
  border-radius: 8px;
}

.billing-info:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.billing-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.billing-close-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.billing-toggle-icon {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.billing-info.expanded .billing-toggle-icon {
  transform: rotate(180deg);
}

.billing-icon {
  font-size: 18px;
  margin-right: 8px;
}

.billing-text {
  color: var(--text-secondary);
  font-size: 14px;
  margin-right: 8px;
}

.billing-amount {
  color: var(--primary-color);
  font-size: 16px;
  font-weight: 600;
}

.billing-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cost-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.cost-label {
  color: var(--text-muted);
}

.cost-value {
  color: var(--text-secondary);
  font-weight: 500;
}

/* 仅在AI爆款复刻模块显示计费组件 */
.module-content:not(#videoReplicationModule) .billing-display {
  display: none;
}

/* 复刻费用显示样式 */
.replication-cost-display {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 8px 12px;
  margin-left: 12px;
  font-size: 14px;
}

/* AI爆款复刻按钮布局样式 */
.main-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.main-action-buttons .primary-button {
  margin: 0;
}

.main-action-buttons .replication-cost-display {
  margin-left: 0;
  margin-top: 8px;
  flex-basis: 100%;
  justify-content: center;
}

/* AI爆款复刻表格区域自动展示 */
.analysis-results {
  scroll-margin-top: 20px;
}

.analysis-results.show-table {
  animation: slideInFromTop 0.6s ease-out;
}

/* 固定标题行样式 */
.sticky-header {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-primary);
  padding: 16px 20px;
  margin: -16px -20px 16px -20px;
  z-index: 100;
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.sticky-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
}

.sticky-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.sticky-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sticky-buttons .primary-button {
  margin: 0;
  font-size: 13px;
  padding: 8px 12px;
  min-width: auto;
}

/* 费用显示在固定行中的样式 */
.sticky-controls .replication-cost-display {
  background: var(--bg-elevated);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.sticky-controls .cost-icon {
  font-size: 14px;
}

.sticky-controls .cost-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.sticky-controls .cost-amount {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
}

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

.cost-icon {
  font-size: 16px;
  margin-right: 6px;
}

.cost-text {
  color: var(--text-secondary);
  margin-right: 6px;
}

.cost-amount {
  color: var(--primary-color);
  font-weight: 600;
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 14px;
}

/* 容器样式 */
.container {
  max-width: 1800px;
  margin: 0 auto;
  padding: 20px;
  min-height: calc(100vh - 80px);
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 进度条样式 */
#progressSection {
  margin: 24px 0;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.progress {
  background: var(--bg-secondary);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
  position: relative;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-bar {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 20px;
  transition: width 0.6s ease;
  position: relative;
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

#statusText {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  margin: 0;
}

#statusText.info { color: var(--info); }
#statusText.success { color: var(--success); }
#statusText.error { color: var(--error); }
#statusText.warning { color: var(--warning); }

/* 动画效果 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-primary);
  border-radius: 4px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-secondary);
}

/* 通用动效 */
.form-container,
.preview-section,
.hero-section,
#progressSection {
  animation: fadeIn 0.6s ease;
}

.primary-button,
.secondary-button,
.queue-trigger,
.api-test-trigger {
  transform-origin: center;
}

/* 微动效果 */
.app-title {
  animation: fadeIn 0.8s ease;
}

.hero-section {
  animation: fadeIn 1s ease 0.2s both;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.hero-title-area {
  flex: 1;
}

.show-billing-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.show-billing-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--border-accent);
  color: var(--text-accent);
}

.billing-icon-btn {
  font-size: 16px;
}

.form-container {
  animation: fadeIn 0.8s ease 0.4s both;
}

/* 悬浮效果 */
.form-container:hover,
.preview-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
}

/* 响应式优化 */
@media (max-width: 768px) {
  .container {
    padding: 16px;
  }
  
  .hero-section {
    padding: 32px 16px;
  }
  
  .main-title {
    font-size: 24px;
  }
  
  .form-container,
  .preview-section {
    padding: 20px;
  }
}

/* SSH隧道控制区域样式 */
.tunnel-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* SSH隧道状态指示灯样式 */
.tunnel-light {
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  filter: grayscale(100%) brightness(0.5);
  user-select: none;
  padding: 8px;
  border-radius: 50%;
  display: inline-block;
}

.tunnel-light:hover {
  transform: scale(1.1);
}

#tunnelStatusLight {
  font-size: 24px;
  transition: all 0.3s ease;
  filter: grayscale(100%) brightness(0.5);
}

#tunnelStatusLight.tunnel-running {
  filter: none;
  text-shadow: 0 0 10px #10b981, 0 0 20px #10b981, 0 0 30px #10b981;
  animation: tunnelPulse 2s ease-in-out infinite;
}

#tunnelStatusLight.tunnel-error {
  filter: hue-rotate(0deg) saturate(2);
  text-shadow: 0 0 10px #ef4444, 0 0 20px #ef4444, 0 0 30px #ef4444;
  animation: tunnelError 1s ease-in-out infinite;
}

#tunnelStatusLight.tunnel-checking {
  filter: hue-rotate(60deg) saturate(1.5);
  text-shadow: 0 0 10px #f59e0b, 0 0 20px #f59e0b, 0 0 30px #f59e0b;
  animation: tunnelChecking 1.5s ease-in-out infinite;
}

@keyframes tunnelPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

@keyframes tunnelError {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.6;
  }
}

@keyframes tunnelChecking {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.7;
  }
}
