/* ═══════════════════════════════════════════
   INTERVIEW PREP WEBSITE — COMPLETE STYLES
   ═══════════════════════════════════════════ */

:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --text: #1e293b;
  --text-light: #64748b;
  --text-white: #f1f5f9;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --font-mono: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ═══ HEADER ═══ */
.header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.header .logo {
  font-size: 1.4rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.header .logo span {
  color: var(--primary-light);
}
.header nav {
  display: flex;
  gap: 8px;
}
.header nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}
.header nav a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}
.header nav a.active {
  color: white;
  background: var(--primary);
}

/* ═══ LAYOUT ═══ */
.app-container {
  display: flex;
  min-height: calc(100vh - 64px);
}

/* ═══ SIDEBAR ═══ */
.sidebar {
  width: 280px;
  background: var(--bg-sidebar);
  color: var(--text-white);
  padding: 16px 0;
  overflow-y: auto;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  flex-shrink: 0;
}
.sidebar .phase-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #94a3b8;
  transition: var(--transition);
  border-left: 3px solid transparent;
}
.sidebar .phase-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}
.sidebar .phase-link.active {
  background: rgba(79, 70, 229, 0.2);
  color: white;
  border-left-color: var(--primary-light);
}
.sidebar .phase-link .icon {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
}
.sidebar .phase-link .count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
}
.sidebar .section-title {
  padding: 16px 20px 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #64748b;
  font-weight: 600;
}

/* ═══ MAIN CONTENT ═══ */
.main-content {
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  overflow-y: auto;
}

/* ═══ HOME PAGE ═══ */
.home-hero {
  text-align: center;
  padding: 60px 20px 40px;
}
.home-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 12px;
}
.home-hero h1 span {
  color: var(--primary);
}
.home-hero p {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

/* Progress Overview */
.progress-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid var(--border);
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 4px;
}
.stat-card .stat-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 12px;
  overflow: hidden;
}
.stat-card .stat-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Phase Cards */
.phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.phase-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
}
.phase-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.phase-card .phase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.phase-card .phase-icon {
  font-size: 2rem;
}
.phase-card .phase-title {
  font-size: 1.15rem;
  font-weight: 700;
}
.phase-card .phase-desc {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 16px;
  line-height: 1.5;
}
.phase-card .phase-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}
.phase-card .phase-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.phase-card .phase-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.phase-card .phase-percent {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
}

/* ═══ QUESTION PAGE ═══ */
.question-page h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: #1e293b;
}
.question-page .phase-desc {
  color: var(--text-light);
  margin-bottom: 24px;
}

/* Section */
.section-block {
  margin-bottom: 32px;
}
.section-block .section-header {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Question Card */
.question-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: var(--transition);
}
.question-card.completed {
  border-left: 4px solid var(--success);
}
.question-card .q-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}
.question-card .q-header:hover {
  background: #f8fafc;
}
.question-card .q-num {
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.question-card.completed .q-num {
  background: var(--success);
}
.question-card .q-title {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
}
.question-card .q-arrow {
  transition: transform 0.3s;
  font-size: 0.8rem;
  color: var(--text-light);
}
.question-card .q-arrow.open {
  transform: rotate(180deg);
}

.question-card .q-body {
  display: none;
  padding: 0 20px 20px;
}
.question-card .q-body.open {
  display: block;
}

.question-card .q-problem {
  background: #fef3c7;
  border-left: 4px solid var(--warning);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.question-card .q-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 6px;
  margin-top: 16px;
}
.question-card .q-why {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.question-card .q-steps {
  list-style: none;
}
.question-card .q-steps li {
  padding: 6px 0 6px 24px;
  position: relative;
  font-size: 0.9rem;
  color: var(--text);
}
.question-card .q-steps li::before {
  content: '▸';
  position: absolute;
  left: 4px;
  color: var(--primary);
  font-size: 0.75rem;
}

.question-card .q-code {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  margin: 12px 0;
  position: relative;
}
.question-card .q-code .copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}
.question-card .q-code .copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.question-card .q-complexity {
  display: inline-block;
  background: #e0e7ff;
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  margin: 8px 0;
}
.question-card .q-edge {
  background: #fee2e2;
  color: #991b1b;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-top: 8px;
}

/* Action Buttons */
.q-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-toggle {
  background: var(--primary);
  color: white;
}
.btn-toggle:hover {
  background: var(--primary-dark);
}
.btn-complete {
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
}
.btn-complete:hover {
  background: #d1fae5;
}
.btn-complete.done {
  background: var(--success);
  color: white;
}
.btn-complete.done:hover {
  background: #059669;
}

/* ═══ TOP NAV FILTERS ═══ */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: white;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover {
  border-color: var(--primary-light);
}
.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    display: flex;
    overflow-x: auto;
    padding: 8px;
  }
  .sidebar .phase-link {
    white-space: nowrap;
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 8px 12px;
  }
  .sidebar .phase-link.active {
    border-bottom-color: var(--primary-light);
    border-left: none;
  }
  .main-content {
    padding: 16px;
  }
  .phase-grid {
    grid-template-columns: 1fr;
  }
  .home-hero h1 {
    font-size: 1.8rem;
  }
}

/* ═══ TOAST ═══ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation:
    slideIn 0.3s ease,
    fadeOut 0.3s ease 2.7s forwards;
}
.toast.success {
  background: var(--success);
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ═══ PRINT STYLES ═══ */
@media print {
  .header,
  .sidebar,
  .q-actions,
  .filter-bar,
  .btn {
    display: none !important;
  }
  .q-body {
    display: block !important;
  }
  .main-content {
    padding: 0;
  }
}
