:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: rgba(25, 25, 60, 0.6);
  --bg-card-hover: rgba(35, 35, 80, 0.7);
  --border: rgba(120, 100, 255, 0.15);
  --border-hover: rgba(120, 100, 255, 0.3);
  --text-primary: #e8e6f0;
  --text-secondary: #9892b5;
  --text-muted: #6b6490;
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.3);
  --accent-secondary: #6366f1;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --glass: blur(20px) saturate(1.5);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
}

#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: rgba(10, 10, 30, 0.85);
  backdrop-filter: var(--glass);
  border-right: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-text {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.sidebar.collapsed .logo-text { opacity: 0; width: 0; }

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}
.sidebar-toggle:hover { color: var(--text-primary); }

.nav-list {
  list-style: none;
  padding: 12px 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  margin-bottom: 2px;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(139, 92, 246, 0.08);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent);
}

.nav-item svg { flex-shrink: 0; }

.sidebar.collapsed .nav-item span { opacity: 0; width: 0; overflow: hidden; }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
}

.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }

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

.page-header { margin-bottom: 32px; }
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle { color: var(--text-secondary); font-size: 14px; }
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin: 28px 0 16px;
  color: var(--text-primary);
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: border-color 0.3s, transform 0.2s;
}
.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.stat-label { font-size: 13px; color: var(--text-secondary); }

/* Company Grid */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.company-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  gap: 16px;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s;
}
.company-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(139, 92, 246, 0.1);
}

.company-logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}

.company-info { flex: 1; }
.company-info h3 { font-size: 16px; margin-bottom: 2px; }
.company-info p { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }

.progress-bar {
  height: 6px;
  background: rgba(139, 92, 246, 0.15);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  border-radius: 3px;
  transition: width 0.6s ease;
}
.progress-text { font-size: 12px; color: var(--text-muted); }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  font-family: inherit;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

/* Timeline */
.timeline { position: relative; padding-left: 32px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 11px; top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 24px;
}
.timeline-dot {
  position: absolute;
  left: -27px; top: 16px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--text-muted);
}
.timeline-item.done .timeline-dot { background: var(--success); border-color: var(--success); }
.timeline-item.active .timeline-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.timeline-card h4 { margin-bottom: 6px; font-size: 15px; }
.timeline-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }

/* Badges */
.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.badge-done { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.badge-active { background: rgba(139, 92, 246, 0.15); color: var(--accent); }
.badge-pending { background: rgba(107, 100, 144, 0.2); color: var(--text-muted); }

/* Criteria */
.criteria-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.criteria-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.criteria-card h4 { margin-bottom: 8px; color: var(--accent); }
.criteria-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.6; }
.criteria-weight { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* Experience */
.experience-list { display: flex; flex-direction: column; gap: 16px; }
.experience-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.exp-header { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.exp-date { font-size: 12px; color: var(--text-muted); }
.experience-card h4 { margin-bottom: 8px; }
.experience-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--accent); }
.filter-select option { background: var(--bg-secondary); }

/* Question Bank */
.question-list { display: flex; flex-direction: column; gap: 20px; }
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.q-header { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.q-company {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-secondary);
}
.q-round {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent);
}
.q-difficulty {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: auto;
}
.q-difficulty.hard { background: rgba(248, 113, 113, 0.15); color: var(--danger); }
.q-difficulty.medium { background: rgba(251, 191, 36, 0.15); color: var(--warning); }
.q-difficulty.easy { background: rgba(52, 211, 153, 0.15); color: var(--success); }

.question-card h4 { font-size: 15px; margin-bottom: 16px; line-height: 1.5; }

.answer-tabs { display: flex; flex-direction: column; gap: 12px; }
.answer-section {
  background: rgba(10, 10, 26, 0.5);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.answer-label {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.answer-label.good { color: var(--success); }
.answer-label.medium { color: var(--warning); }
.answer-label.poor { color: var(--danger); }
.answer-code {
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 8px;
  line-height: 1.6;
}
.answer-note { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* Script Editor */
.script-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  min-height: 500px;
}
.script-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.script-sidebar h3 { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.script-list { list-style: none; }
.script-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  margin-bottom: 2px;
}
.script-item:hover { background: rgba(139, 92, 246, 0.08); color: var(--text-primary); }
.script-item.active { background: rgba(139, 92, 246, 0.15); color: var(--accent); }

.script-editor-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.editor-title { font-size: 14px; font-weight: 500; }
.editor-actions { display: flex; gap: 8px; }
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }

.script-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.7;
  padding: 20px;
  resize: none;
  outline: none;
  min-height: 400px;
}
.editor-meta {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* History */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.history-list { display: flex; flex-direction: column; gap: 16px; }
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.history-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.history-date { font-size: 12px; color: var(--text-muted); }
.history-card h4 { margin-bottom: 12px; }

.score-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.score-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.score-label { font-size: 12px; color: var(--text-muted); }
.score-value { font-size: 16px; font-weight: 600; }
.score-value.good { color: var(--success); }
.score-value.medium { color: var(--warning); }
.score-value.poor { color: var(--danger); }
.history-feedback { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* Mock Interview */
.mock-setup { text-align: center; padding: 40px 0; }
.mock-options {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.mock-option-group { display: flex; flex-direction: column; gap: 6px; }
.mock-option-group label { font-size: 12px; color: var(--text-muted); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border: none;
  color: white;
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s;
}
.btn-secondary:hover { border-color: var(--accent); }

.hidden { display: none !important; }

.mock-session { padding: 20px 0; }
.mock-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
}
#mock-time {
  font-size: 48px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.mock-question-area { margin-bottom: 24px; }
.mock-interviewer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.interviewer-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.interviewer-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.7;
  max-width: 600px;
}

.mock-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.btn-record {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-record:hover { background: rgba(248, 113, 113, 0.25); }
.btn-record.recording {
  animation: pulse 1.5s infinite;
  background: rgba(248, 113, 113, 0.3);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(248, 113, 113, 0); }
}

.mock-feedback {
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.mock-feedback h3 { margin-bottom: 12px; font-size: 16px; }
.feedback-content p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }
  .sidebar .logo-text { opacity: 0; width: 0; }
  .sidebar .nav-item span { opacity: 0; width: 0; overflow: hidden; }

  .main-content {
    margin-left: var(--sidebar-collapsed);
    padding: 20px 16px;
  }

  .page-header h1 { font-size: 22px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .company-grid { grid-template-columns: 1fr; }
  .script-layout { grid-template-columns: 1fr; }
  .score-row { grid-template-columns: repeat(2, 1fr); }
  .mock-options { flex-direction: column; align-items: center; }
}

@media (max-width: 480px) {
  .main-content { padding: 16px 12px; }
  .stat-value { font-size: 24px; }
  .criteria-grid { grid-template-columns: 1fr; }
}
