/**
 * AI 简历润色与模拟面试系统 - 样式
 * 深色主题，现代化设计
 */

/* ==================== CSS 变量 ==================== */
:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #28354a;
  --surface-3: #334155;
  --text: #e6eef8;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0ea5e9;
  --accent-dim: rgba(56, 189, 248, 0.15);
  --success: #22c55e;
  --success-dim: rgba(34, 197, 94, 0.15);
  --error: #ef4444;
  --error-dim: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.15);
  --border: #334155;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
}

/* ==================== 基础重置 ==================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ==================== 布局 ==================== */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ==================== Header ==================== */
.site-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #172033 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 0;
}

.site-header h1 {
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.site-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==================== Tab 导航 ==================== */
.tab-nav {
  display: flex;
  gap: 8px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.tab-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.tab-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ==================== 功能区块 ==================== */
.feature-section {
  display: none;
}

.feature-section.active {
  display: block;
}

/* ==================== Panel 卡片 ==================== */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,.05);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.panel-head {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-head h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.panel-head p {
  font-size: 0.85rem;
  color: var(--text-muted);
  width: 100%;
}

.form-content {
  padding: 18px 20px 20px;
}

/* ==================== 表单元素 ==================== */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-row.two-col {
  flex-direction: row;
  gap: 14px;
}

.form-row.two-col > label {
  flex: 1;
}

label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
select,
textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.meta-row small {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==================== 按钮 ==================== */
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.12s;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.25);
}

.primary-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.secondary-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.danger-btn {
  background: var(--error-dim);
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.danger-btn:hover {
  background: var(--error);
  color: #fff;
}

.text-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}

.text-btn:hover {
  color: var(--accent);
}

/* ==================== 消息提示 ==================== */
.form-message {
  min-height: 20px;
  font-size: 0.86rem;
  margin-top: 12px;
}

.form-message.success {
  color: var(--success);
}

.form-message.error {
  color: var(--error);
}

/* ==================== 结果展示 ==================== */
.result-panel {
  animation: fadeInUp 0.4s ease;
}

.result-actions {
  display: flex;
  gap: 10px;
}

.result-content {
  padding: 20px;
}

.result-section {
  margin-bottom: 24px;
}

.result-section:last-child {
  margin-bottom: 0;
}

.result-section h3 {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.markdown-content {
  line-height: 1.8;
  color: var(--text);
}

.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  color: var(--accent);
  margin: 16px 0 8px;
}

.markdown-content strong {
  color: var(--accent);
}

.suggestion-list {
  list-style: none;
  padding: 0;
}

.suggestion-list li {
  padding: 8px 0;
  padding-left: 24px;
  position: relative;
  border-bottom: 1px dashed var(--border);
}

.suggestion-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid var(--accent);
}

/* ==================== 面试聊天界面 ==================== */
.interview-chat {
  animation: fadeInUp 0.3s ease;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.chat-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.chat-info .divider {
  color: var(--text-muted);
}

.chat-messages {
  height: 400px;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg);
}

.chat-message {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeInUp 0.3s ease;
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.message-content {
  max-width: 75%;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  border: 1px solid var(--border);
}

.chat-message.user .message-content {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.chat-message.hint .message-content {
  background: var(--warning-dim);
  border-color: var(--warning);
}

.chat-message.thinking .message-content {
  background: var(--surface-2);
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.message-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.message-body {
  font-size: 0.92rem;
  line-height: 1.6;
  word-break: break-word;
}

.thinking-dots span {
  animation: dots 1.4s infinite;
  opacity: 0;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* 评估反馈样式 */
.evaluation-feedback {
  background: var(--success-dim);
  border: 1px solid var(--success);
  border-radius: 8px;
  padding: 12px;
  margin-top: 8px;
}

.score-badge {
  display: inline-block;
  background: var(--success);
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.better-answer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 0.88rem;
}

/* 聊天输入区 */
.chat-input-area {
  padding: 16px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.input-row textarea {
  flex: 1;
  min-height: 60px;
  margin-bottom: 0;
}

.input-actions {
  display: flex;
  gap: 16px;
}

/* ==================== 面试报告 ==================== */
.interview-report {
  animation: fadeInUp 0.4s ease;
}

.report-content {
  padding: 20px;
}

.report-section {
  margin-bottom: 28px;
}

.report-section h3 {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.report-stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dimension-scores {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dimension-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dimension-name {
  width: 80px;
  font-size: 0.9rem;
}

.dimension-bar {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.dimension-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 4px;
  transition: width 0.6s ease;
}

.dimension-fill.good {
  background: linear-gradient(90deg, var(--success), #16a34a);
}

.dimension-fill.medium {
  background: linear-gradient(90deg, var(--warning), #d97706);
}

.dimension-fill.poor {
  background: linear-gradient(90deg, var(--error), #dc2626);
}

.dimension-score.good {
  color: var(--success);
}

.dimension-score.medium {
  color: var(--warning);
}

.dimension-score.poor {
  color: var(--error);
}

.overall-score {
  text-align: center;
  padding: 20px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.big-score {
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.score-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.dimension-fill.good {
  background: linear-gradient(90deg, var(--success), #16a34a);
}

.dimension-fill.medium {
  background: linear-gradient(90deg, var(--warning), #d97706);
}

.dimension-fill.poor {
  background: linear-gradient(90deg, var(--error), #dc2626);
}

.dimension-score.good {
  color: var(--success);
}

.dimension-score.medium {
  color: var(--warning);
}

.dimension-score.poor {
  color: var(--error);
}

.overall-score {
  text-align: center;
  padding: 20px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.big-score {
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.score-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.dimension-fill.good {
  background: linear-gradient(90deg, var(--success), #16a34a);
}

.dimension-fill.medium {
  background: linear-gradient(90deg, var(--warning), #d97706);
}

.dimension-fill.poor {
  background: linear-gradient(90deg, var(--error), #dc2626);
}

.dimension-score.good {
  color: var(--success);
}

.dimension-score.medium {
  color: var(--warning);
}

.dimension-score.poor {
  color: var(--error);
}

.overall-score {
  text-align: center;
  padding: 20px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.big-score {
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.score-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.dimension-score {
  width: 40px;
  text-align: right;
  font-weight: 600;
  color: var(--accent);
}

.report-list {
  list-style: none;
  padding: 0;
}

.report-list li {
  padding: 10px 0 10px 28px;
  position: relative;
  border-bottom: 1px dashed var(--border);
}

.report-list li::before {
  position: absolute;
  left: 0;
  font-weight: bold;
}

.report-list.positive li::before {
  content: "✓";
  color: var(--success);
}

.report-list.negative li::before {
  content: "○";
  color: var(--warning);
}

.report-list.action li::before {
  content: "→";
  color: var(--accent);
}

.chat-history {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}

.history-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.history-role {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.history-item.user .history-role {
  color: var(--text-muted);
}

.history-item p {
  font-size: 0.9rem;
  color: var(--text);
}

/* ==================== 配置提示 ==================== */
.config-notice {
  text-align: center;
  padding: 16px;
  margin-top: 20px;
  background: var(--warning-dim);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
}

.config-notice p {
  font-size: 0.85rem;
  color: var(--warning);
}

/* ==================== 动画 ==================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== 响应式 ==================== */
@media (max-width: 640px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 0 12px;
  }

  .header-inner {
    padding: 14px 0;
  }

  .tab-nav {
    padding: 14px 0;
  }

  .tab-btn {
    flex: 1;
    padding: 10px 16px;
  }

  .form-row.two-col {
    flex-direction: column;
    gap: 0;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-actions {
    width: 100%;
  }

  .chat-messages {
    height: 320px;
    padding: 14px;
  }

  .message-content {
    max-width: 85%;
  }

  .input-row {
    flex-direction: column;
  }

  .input-row .primary-btn {
    width: 100%;
  }

  .report-stats {
    gap: 16px;
  }

  .stat-value {
    font-size: 1.4rem;
  }
}

/* ==================== 无障碍 ==================== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
