/* ===== 灵创面试官 — 主样式 ===== */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #13131a;
  --bg-card: #1a1a24;
  --bg-card-hover: #22222e;
  --bg-input: #1e1e2a;
  --border: #2a2a3a;
  --border-focus: #6c5ce7;
  --text-primary: #f0f0f5;
  --text-secondary: #8888a0;
  --text-muted: #555568;
  --accent: #6c5ce7;
  --accent-hover: #7c6cf7;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --success: #00d68f;
  --warning: #ffaa00;
  --danger: #ff4757;
  --danger-hover: #ff6b7a;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.screen { min-height: 100vh; }
.screen.hidden { display: none !important; }
.hidden { display: none !important; }

/* ===== NAVBAR ===== */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
}
.nav-brand { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-badge {
  background: var(--accent-glow); color: var(--accent-hover);
  padding: 4px 12px; border-radius: 20px; font-size: 12px;
}
.nav-btn {
  background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border);
  padding: 6px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
}
.nav-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-back {
  background: none; border: none; color: var(--accent); cursor: pointer; font-size: 14px;
  padding: 6px 12px; border-radius: var(--radius-sm);
}
.nav-back:hover { background: var(--bg-card); }

/* ===== KEY GATE ===== */
.keygate-container {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #0a0a1a 100%);
}
.keygate-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 48px 40px;
  max-width: 420px; width: 90%; text-align: center;
  box-shadow: 0 0 60px rgba(108, 92, 231, 0.1);
}
.keygate-icon { font-size: 56px; margin-bottom: 16px; }
.keygate-title { font-size: 28px; font-weight: 800; margin-bottom: 8px; color: var(--text-primary); }
.keygate-subtitle { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; line-height: 1.8; }
.keygate-form { text-align: left; }
.keygate-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.keygate-input {
  width: 100%; padding: 14px 16px; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-primary); font-size: 16px; text-align: center;
  letter-spacing: 2px; outline: none; transition: var(--transition);
}
.keygate-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.keygate-input::placeholder { color: var(--text-muted); letter-spacing: 1px; }
.keygate-btn {
  width: 100%; padding: 14px; background: var(--accent); color: white;
  border: none; border-radius: var(--radius); font-size: 16px; font-weight: 600;
  cursor: pointer; margin-top: 16px; transition: var(--transition);
}
.keygate-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.keygate-error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 20px; }
.keygate-footer { margin-top: 24px; }
.keygate-footer a { color: var(--accent); text-decoration: none; font-size: 13px; }
.keygate-footer a:hover { text-decoration: underline; }

/* ===== MODAL ===== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-content { position: relative; z-index: 1; }
.modal-close {
  position: absolute; top: 16px; right: 16px; background: var(--bg-card);
  border: 1px solid var(--border); color: var(--text-secondary); width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* Pricing */
.pricing-modal {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px; max-width: 800px; width: 90%; text-align: center;
}
.pricing-modal h2 { font-size: 24px; margin-bottom: 24px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.pricing-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 20px; text-align: center; position: relative;
}
.pricing-card.popular { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow); }
.pricing-badge {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: white; padding: 2px 16px; border-radius: 12px;
  font-size: 12px; font-weight: 600;
}
.pricing-header { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.pricing-price { font-size: 32px; font-weight: 800; color: var(--accent-hover); margin-bottom: 16px; }
.pricing-price span { font-size: 14px; color: var(--text-secondary); font-weight: 400; }
.pricing-card ul { list-style: none; text-align: left; margin-bottom: 20px; }
.pricing-card li { padding: 6px 0; font-size: 13px; color: var(--text-secondary); }
.pricing-card li::before { content: "✓ "; color: var(--success); }
.pricing-btn {
  width: 100%; padding: 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--border);
}
.pricing-btn.primary { background: var(--accent); color: white; border: none; }
.pricing-btn:hover { filter: brightness(1.1); }
.pricing-note { margin-top: 16px; font-size: 12px; color: var(--text-muted); }

/* ===== DASHBOARD ===== */
.dashboard { max-width: 900px; margin: 0 auto; padding: 32px 24px; }
.hero { text-align: center; margin-bottom: 40px; }
.hero h2 { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.hero p { color: var(--text-secondary); font-size: 15px; }

.mode-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
  margin-bottom: 48px;
}
.mode-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; cursor: pointer; transition: var(--transition);
}
.mode-card:hover {
  border-color: var(--border-focus); background: var(--bg-card-hover);
  transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-glow);
}
.mode-card-icon { font-size: 32px; margin-bottom: 12px; }
.mode-card h4 { font-size: 16px; margin-bottom: 6px; }
.mode-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.history-section { margin-top: 16px; }
.history-section h3 { font-size: 20px; margin-bottom: 16px; }
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-item {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; transition: var(--transition);
}
.history-item:hover { border-color: var(--border-focus); background: var(--bg-card-hover); }
.history-item-left h4 { font-size: 15px; margin-bottom: 4px; }
.history-item-left p { font-size: 12px; color: var(--text-secondary); }
.history-item-right { text-align: right; }
.history-score { font-size: 20px; font-weight: 700; color: var(--accent-hover); }
.history-score span { font-size: 12px; color: var(--text-muted); }
.history-date { font-size: 12px; color: var(--text-muted); }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); font-size: 14px; }

/* ===== SETUP ===== */
.setup { max-width: 640px; margin: 0 auto; padding: 32px 24px; }
.setup h2 { font-size: 24px; margin-bottom: 8px; }
.setup-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 32px; }
.setup-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.required { color: var(--danger); }
.form-group select, .form-group input[type="text"], .form-group textarea {
  padding: 12px 16px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px;
  outline: none; font-family: inherit; transition: var(--transition);
}
.form-group select:focus, .form-group input:focus, .form-group textarea:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.file-upload-area { 
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px;
  text-align: center; cursor: pointer; transition: var(--transition);
}
.file-upload-area:hover { border-color: var(--border-focus); background: var(--bg-card); }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.upload-icon { font-size: 32px; }
#resume-filename { font-size: 13px; color: var(--text-secondary); }

.btn-start-interview {
  padding: 16px; background: var(--accent); color: white; border: none;
  border-radius: var(--radius); font-size: 18px; font-weight: 700;
  cursor: pointer; margin-top: 8px; transition: var(--transition);
}
.btn-start-interview:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-start-interview:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== INTERVIEW ===== */
.interview-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--bg-secondary); border-bottom: 1px solid var(--border);
}
.interview-progress { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#interview-role-display { font-size: 14px; font-weight: 600; }
#interview-progress-text { font-size: 12px; color: var(--text-secondary); }
.interview-timer { font-size: 14px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.interview-main {
  max-width: 720px; margin: 0 auto; padding: 20px 24px;
  display: flex; flex-direction: column; height: calc(100vh - 53px);
}

/* Interviewer Card */
.interviewer-card {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 20px;
}
.interviewer-avatar { position: relative; }
.avatar-circle {
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent-glow);
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.avatar-status {
  width: 12px; height: 12px; border-radius: 50%; background: var(--success);
  position: absolute; bottom: 2px; right: 2px; border: 2px solid var(--bg-card);
}
.avatar-status.thinking { background: var(--warning); animation: pulse 1.5s infinite; }
.interviewer-info h3 { font-size: 16px; }
.interviewer-info p { font-size: 12px; color: var(--text-secondary); }

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

/* Chat Area */
.chat-area {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px;
  padding: 8px 0; margin-bottom: 16px;
}
.chat-message { display: flex; gap: 10px; max-width: 90%; animation: fadeIn 0.3s ease; }
.chat-message.user-message { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.ai-message { align-self: flex-start; }
.msg-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg-card);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  flex-shrink: 0; border: 1px solid var(--border);
}
.msg-bubble {
  padding: 12px 16px; border-radius: var(--radius); font-size: 14px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
}
.user-message .msg-bubble { background: var(--accent); color: white; border-radius: var(--radius) var(--radius) 4px var(--radius); }
.ai-message .msg-bubble { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius) var(--radius) var(--radius) 4px); }
.typing-indicator { display: flex; gap: 4px; padding: 8px 16px; }
.typing-indicator span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted);
  animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Input Area */
.input-area { margin-top: auto; }
.voice-indicator {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px; background: var(--danger); color: white; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 13px;
}
.voice-wave {
  width: 12px; height: 12px; border-radius: 50%; background: white;
  animation: pulse 0.8s infinite;
}
.input-row {
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px;
}
.voice-btn {
  width: 40px; height: 40px; border-radius: 50%; background: var(--bg-input);
  border: 1px solid var(--border); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.voice-btn:hover { background: var(--bg-card-hover); }
.voice-btn.active { background: var(--danger); border-color: var(--danger); color: white; }
.chat-input {
  flex: 1; background: none; border: none; color: var(--text-primary);
  font-size: 14px; font-family: inherit; resize: none; outline: none;
  padding: 8px 0; max-height: 120px;
}
.chat-input::placeholder { color: var(--text-muted); }
.send-btn {
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent);
  color: white; border: none; cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== FEEDBACK ===== */
.feedback { max-width: 720px; margin: 0 auto; padding: 32px 24px; }
.feedback-hero { text-align: center; margin-bottom: 32px; }
.feedback-hero h2 { font-size: 24px; margin-bottom: 16px; }
.feedback-score {
  font-size: 72px; font-weight: 800; background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.feedback-role { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.feedback-content {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 24px;
}
.feedback-dimension { margin-bottom: 20px; }
.feedback-dimension:last-child { margin-bottom: 0; }
.feedback-dim-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.feedback-dim-header h4 { font-size: 15px; }
.feedback-dim-score { font-size: 14px; font-weight: 700; color: var(--accent-hover); }
.feedback-bar {
  height: 6px; background: var(--bg-input); border-radius: 3px; margin-bottom: 8px; overflow: hidden;
}
.feedback-bar-fill {
  height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--success));
  transition: width 1s ease;
}
.feedback-dim-comment { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.feedback-summary { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.feedback-summary h4 { font-size: 15px; margin-bottom: 8px; }
.feedback-summary p { font-size: 14px; color: var(--text-secondary); line-height: 1.8; }
.feedback-transcript {
  margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border);
}
.feedback-transcript h4 { font-size: 15px; margin-bottom: 12px; }
.feedback-transcript-item {
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.feedback-transcript-item:last-child { border-bottom: none; }
.feedback-transcript-q { color: var(--accent-hover); margin-bottom: 4px; }
.feedback-transcript-a { color: var(--text-secondary); }

.feedback-actions { display: flex; gap: 12px; justify-content: center; }
.btn-primary, .btn-secondary {
  padding: 12px 24px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.btn-primary { background: var(--accent); color: white; border: none; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); }

.loading-spinner {
  text-align: center; padding: 40px; color: var(--text-secondary); font-size: 16px;
}

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border);
  padding: 12px 24px; border-radius: var(--radius); font-size: 14px;
  z-index: 2000; box-shadow: var(--shadow); animation: slideUp 0.3s ease;
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .setup { padding: 20px 16px; }
  .interviewer-card { padding: 12px; }
  .avatar-circle { width: 44px; height: 44px; font-size: 22px; }
  .msg-bubble { font-size: 13px; padding: 10px 14px; }
  .feedback-score { font-size: 56px; }
  .feedback-actions { flex-direction: column; }
  .keygate-card { padding: 32px 24px; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
