/* ===================================================
   FRONTEND INTERVIEW PREP — COMPLETE DESIGN SYSTEM
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── CSS Variables ─────────────────────────────── */
:root {
  --bg-primary:     #0d1117;
  --bg-secondary:   #161b22;
  --bg-card:        #21262d;
  --bg-code:        #1c2333;
  --bg-hover:       #2d333b;
  --border:         #30363d;
  --border-light:   #21262d;

  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #6e7681;

  --accent-blue:    #58a6ff;
  --accent-green:   #3fb950;
  --accent-yellow:  #e3b341;
  --accent-red:     #f85149;
  --accent-purple:  #bc8cff;
  --accent-orange:  #ffa657;

  --sidebar-width:  280px;
  --header-height:  60px;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);

  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;
}

/* ─── Reset & Base ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Top Header ────────────────────────────────── */
.top-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: rgba(13,17,23,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 calc(var(--sidebar-width) + 20px);
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 10px; }
.header-title { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.header-subtitle { font-size: 11px; color: var(--text-muted); }

.header-actions { display: flex; align-items: center; gap: 12px; }

.search-wrapper { position: relative; }

#search-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 7px 12px 7px 34px;
  width: 240px;
  transition: all var(--transition);
  outline: none;
}
#search-input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(88,166,255,0.12); width: 280px; }

.search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}
#search-results.active { display: block; }

.search-result-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
.search-result-item:hover { background: var(--bg-hover); }
.search-result-item:last-child { border-bottom: none; }
.result-title { font-weight: 600; font-size: 13px; color: var(--accent-blue); }
.result-section { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.progress-badge {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 6px 12px;
  font-size: 12px; font-weight: 600; color: var(--accent-green);
}
.prog-bar-mini { width: 60px; height: 4px; background: var(--bg-hover); border-radius: 2px; overflow: hidden; }
.prog-fill-mini { height: 100%; background: var(--accent-green); border-radius: 2px; transition: width 0.5s ease; }

.hamburger {
  display: none;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  cursor: pointer; padding: 6px 10px; font-size: 18px;
}

/* ─── Sidebar ───────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width); height: 100vh;
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 200;
  transition: transform var(--transition-slow);
  display: flex; flex-direction: column;
}

.sidebar-logo {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.sidebar-logo-text { font-weight: 800; font-size: 14px; line-height: 1.2; }
.sidebar-logo-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-group-label {
  padding: 8px 20px 4px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px; cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  color: var(--text-secondary); font-size: 13.5px; font-weight: 500;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); border-left-color: var(--border); }
.nav-item.active { background: rgba(88,166,255,0.08); color: var(--accent-blue); border-left-color: var(--accent-blue); }

.nav-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-label { flex: 1; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); flex-shrink: 0; transition: background var(--transition); }
.nav-dot.done { background: var(--accent-green); }

.sidebar-footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
}
.sidebar-progress-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted); margin-bottom: 6px;
}
.sidebar-progress-bar { height: 5px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.sidebar-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
  border-radius: 3px; transition: width 0.5s ease;
}

/* ─── Main Content ──────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); padding-top: var(--header-height); min-height: 100vh; }

.content-section {
  display: none; padding: 40px 48px;
  max-width: 960px;
  animation: fadeSlideIn 0.3s ease;
}
.content-section.active { display: block; }

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

/* Section Header */
.section-header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

.section-header h1 {
  font-size: 30px; font-weight: 800; color: var(--text-primary);
  line-height: 1.2; margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px;
}
.section-emoji { font-size: 34px; }
.section-desc { color: var(--text-secondary); font-size: 15px; max-width: 680px; line-height: 1.7; }

.section-meta { display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.meta-badge { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }

.mark-complete-btn {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: transparent; color: var(--text-secondary); font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: all var(--transition);
}
.mark-complete-btn:hover { border-color: var(--accent-green); color: var(--accent-green); }
.mark-complete-btn.done { border-color: var(--accent-green); color: var(--accent-green); background: rgba(63,185,80,0.08); }

/* Topic Cards */
.topic-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px 30px; margin-bottom: 22px;
  transition: border-color var(--transition);
}
.topic-card:hover { border-color: rgba(88,166,255,0.3); }

.topic-card h2 {
  font-size: 19px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border-light);
}
.topic-card h3 { font-size: 15px; font-weight: 600; color: var(--accent-blue); margin: 18px 0 10px; }
.topic-card h4 { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 14px 0 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.topic-card p { color: var(--text-secondary); font-size: 14px; line-height: 1.8; margin-bottom: 10px; }
.topic-card ul, .topic-card ol { padding-left: 20px; margin-bottom: 12px; }
.topic-card li { color: var(--text-secondary); font-size: 14px; line-height: 1.8; margin-bottom: 3px; }
.topic-card li strong { color: var(--text-primary); }

/* Code Blocks */
.code-block { margin: 14px 0; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }
.code-header {
  background: var(--bg-secondary); padding: 8px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.code-lang {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  display: flex; align-items: center; gap: 6px;
}
.code-lang::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-blue); }

.copy-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer; font-family: 'Inter', sans-serif;
  font-size: 11px; padding: 3px 8px; transition: all var(--transition);
}
.copy-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.copy-btn.copied { border-color: var(--accent-green); color: var(--accent-green); }

.code-block pre { margin: 0; padding: 18px 20px; background: var(--bg-code); overflow-x: auto; font-size: 13px; line-height: 1.7; }
.code-block pre code { font-family: 'JetBrains Mono','Fira Code',monospace; font-size: 13px; background: none; padding: 0; }

code:not(pre code) {
  font-family: 'JetBrains Mono',monospace; font-size: 12.5px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; color: var(--accent-orange);
}

/* Tables */
.table-wrapper { overflow-x: auto; margin: 14px 0; border-radius: var(--radius-md); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead tr { background: var(--bg-secondary); border-bottom: 1px solid var(--border); }
thead th { padding: 10px 16px; text-align: left; font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border-light); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody td { padding: 10px 16px; color: var(--text-secondary); vertical-align: top; line-height: 1.6; }
tbody td:first-child { color: var(--text-primary); font-weight: 500; }

/* Callouts */
.callout { border-left: 3px solid; border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 14px 18px; margin: 14px 0; font-size: 14px; }
.callout-title { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.callout p { margin: 0; line-height: 1.7; color: var(--text-secondary); }

.callout.info    { border-color: var(--accent-blue);   background: rgba(88,166,255,0.06); }
.callout.success { border-color: var(--accent-green);  background: rgba(63,185,80,0.06); }
.callout.warning { border-color: var(--accent-yellow); background: rgba(227,179,65,0.06); }
.callout.danger  { border-color: var(--accent-red);    background: rgba(248,81,73,0.06); }
.callout.info    .callout-title { color: var(--accent-blue); }
.callout.success .callout-title { color: var(--accent-green); }
.callout.warning .callout-title { color: var(--accent-yellow); }
.callout.danger  .callout-title { color: var(--accent-red); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-blue   { background: rgba(88,166,255,0.15);  color: var(--accent-blue); }
.badge-green  { background: rgba(63,185,80,0.15);   color: var(--accent-green); }
.badge-yellow { background: rgba(227,179,65,0.15);  color: var(--accent-yellow); }
.badge-red    { background: rgba(248,81,73,0.15);   color: var(--accent-red); }
.badge-purple { background: rgba(188,140,255,0.15); color: var(--accent-purple); }
.badge-orange { background: rgba(255,166,87,0.15);  color: var(--accent-orange); }

/* Key Points Grid */
.key-points { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 12px; margin: 14px 0; }
.key-point { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; transition: border-color var(--transition); }
.key-point:hover { border-color: rgba(88,166,255,0.3); }
.kp-icon  { font-size: 20px; margin-bottom: 8px; }
.kp-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.kp-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Q&A Accordion */
.qa-section { margin-top: 8px; }
.qa-item { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 10px; overflow: hidden; transition: border-color var(--transition); }
.qa-item:hover { border-color: rgba(88,166,255,0.3); }
.qa-question { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; cursor: pointer; background: var(--bg-card); transition: background var(--transition); user-select: none; }
.qa-question:hover { background: var(--bg-hover); }
.qa-q-badge { background: linear-gradient(135deg,var(--accent-blue),var(--accent-purple)); color: white; font-weight: 700; font-size: 11px; padding: 3px 8px; border-radius: 4px; flex-shrink: 0; margin-top: 2px; }
.qa-question p { flex: 1; font-weight: 600; font-size: 14px; color: var(--text-primary); margin: 0; line-height: 1.5; }
.qa-arrow { color: var(--text-muted); font-size: 12px; transition: transform var(--transition); flex-shrink: 0; margin-top: 4px; }
.qa-item.open .qa-arrow { transform: rotate(180deg); }
.qa-answer { display: none; padding: 16px 18px; background: var(--bg-secondary); border-top: 1px solid var(--border); }
.qa-item.open .qa-answer { display: block; }
.qa-answer p, .qa-answer li { color: var(--text-secondary); font-size: 14px; line-height: 1.8; }
.qa-answer strong { color: var(--text-primary); }
.qa-answer ul { padding-left: 20px; }
.qa-answer .code-block { margin-top: 12px; }

/* ─── Home ──────────────────────────────────────── */
.home-hero {
  background: linear-gradient(135deg,rgba(88,166,255,0.1),rgba(188,140,255,0.06));
  border: 1px solid rgba(88,166,255,0.2); border-radius: var(--radius-xl);
  padding: 40px 44px; margin-bottom: 32px; position: relative; overflow: hidden;
}
.home-hero::before {
  content: ''; position: absolute; top: -40%; right: -5%;
  width: 280px; height: 280px;
  background: radial-gradient(circle,rgba(88,166,255,0.12),transparent 70%);
  pointer-events: none;
}
.home-hero h1 {
  font-size: 34px; font-weight: 800;
  background: linear-gradient(135deg,var(--accent-blue),var(--accent-purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 12px;
}
.home-hero p { color: var(--text-secondary); font-size: 15px; max-width: 560px; line-height: 1.7; margin-bottom: 24px; }
.home-stats { display: flex; gap: 28px; flex-wrap: wrap; }
.stat-number { font-size: 28px; font-weight: 800; color: var(--text-primary); }
.stat-label  { font-size: 12px; color: var(--text-muted); }

.topics-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(210px,1fr)); gap: 12px; margin-bottom: 28px; }
.topic-grid-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px; cursor: pointer;
  transition: all var(--transition); display: flex; flex-direction: column; gap: 8px;
}
.topic-grid-card:hover { border-color: rgba(88,166,255,0.4); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tgc-icon { font-size: 24px; }
.tgc-title { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.tgc-count { font-size: 12px; color: var(--text-muted); }
.tgc-progress { height: 3px; background: var(--bg-hover); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.tgc-progress-fill { height: 100%; background: var(--accent-green); border-radius: 2px; width: 0; transition: width 0.5s ease; }

.overall-progress-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 26px; margin-bottom: 20px;
}
.overall-progress-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.overall-progress-card h3 span { font-size: 14px; color: var(--accent-green); font-weight: 700; }
.big-progress-bar { height: 10px; background: var(--bg-hover); border-radius: 5px; overflow: hidden; margin-bottom: 10px; }
.big-progress-fill { height: 100%; background: linear-gradient(90deg,var(--accent-blue),var(--accent-green)); border-radius: 5px; transition: width 0.6s cubic-bezier(0.34,1.56,0.64,1); }

.how-to-use { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 26px; }
.how-to-use h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.how-to-steps { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 16px; }
.how-step { display: flex; gap: 12px; align-items: flex-start; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg,var(--accent-blue),var(--accent-purple)); color: white; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.how-step p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.how-step strong { color: var(--text-primary); }

/* Two Column */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 14px 0; }
.mini-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; }
.mini-card h4 { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.mini-card p, .mini-card li { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }
.mini-card ul { padding-left: 16px; }

/* Tip Box */
.tip-box { display: flex; gap: 12px; background: rgba(63,185,80,0.06); border: 1px solid rgba(63,185,80,0.25); border-radius: var(--radius-md); padding: 14px 16px; margin: 14px 0; }
.tip-icon { font-size: 18px; flex-shrink: 0; }
.tip-box p { font-size: 13.5px; color: var(--text-secondary); margin: 0; line-height: 1.7; }
.tip-box strong { color: var(--accent-green); }

/* Section Divider */
.section-divider { height: 1px; background: var(--border); margin: 28px 0; }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 12px 0; }
.checklist li { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 13.5px; color: var(--text-secondary); border-bottom: 1px solid var(--border-light); }
.checklist li:last-child { border: none; }
.checklist li::before { content: '□'; color: var(--text-muted); font-size: 15px; flex-shrink: 0; }

/* Highlight.js overrides */
.hljs { background: var(--bg-code) !important; color: #adbac7; }
.hljs-comment { color: #768390; font-style: italic; }
.hljs-keyword,.hljs-selector-tag { color: #f47067; }
.hljs-string,.hljs-attr { color: #96d0ff; }
.hljs-number,.hljs-literal { color: #6cb6ff; }
.hljs-title,.hljs-name { color: #dcbdfb; }
.hljs-type { color: #6cb6ff; }
.hljs-built_in { color: #f69d50; }
.hljs-function { color: #dcbdfb; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .top-header { padding-left: 20px; }
  .hamburger { display: block; }
  .content-section { padding: 24px 18px; }
  .two-col { grid-template-columns: 1fr; }
  .topics-grid { grid-template-columns: repeat(2,1fr); }
  #search-input { width: 160px; }
  .progress-badge { display: none; }
  .home-hero { padding: 24px 20px; }
  .home-hero h1 { font-size: 24px; }
}

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 150; }
.sidebar-overlay.active { display: block; }
