/* =====================================================
   DSA Interview Prep — Common Stylesheet
   Used by all HTML pages
   ===================================================== */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #13152a;
  --border: #2a2d3e;
  --accent: #6c63ff;
  --accent2: #00d4aa;
  --accent3: #ff6b6b;
  --accent4: #ffd93d;
  --text: #e2e8f0;
  --muted: #8892a4;
  --easy: #00d4aa;
  --medium: #ffd93d;
  --hard: #ff6b6b;
  --code-bg: #0d1117;
  --code-text: #c9d1d9;
  --inline-code-bg: rgba(108,99,255,.15);
  --link: #7c74ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
}

/* ── HEADER ─────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 2rem;
}
.site-header h1 {
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: .3rem;
}
.site-header .breadcrumb {
  font-size: .82rem;
  color: var(--muted);
}
.site-header .breadcrumb a {
  color: var(--accent2);
  text-decoration: none;
}
.site-header .breadcrumb a:hover { text-decoration: underline; }
.site-header .breadcrumb span { margin: 0 .4rem; opacity: .5; }

/* ── TOPNAV ─────────────────────────────────────────── */
.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

/* Row 1: primary bar */
.nav-primary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.nav-primary a {
  color: var(--muted);
  text-decoration: none;
  font-size: .82rem;
  padding: .3rem .7rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-primary a:hover { background: var(--accent); color: #fff; }
.nav-primary a.nav-home { color: var(--accent2); border: 1px solid var(--accent2); }
.nav-primary a.nav-home:hover { background: var(--accent2); color: #000; }
.nav-primary a.nav-dsa  { color: var(--muted); }
.nav-sep { color: var(--border); margin: 0 .2rem; font-size: 1.1rem; }

/* Language toggle buttons */
.lang-btn {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .9rem;
  font-size: .82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.lang-btn:hover  { border-color: var(--accent); color: var(--accent); }
.lang-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Row 2: topic buttons */
.nav-topics {
  display: none;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: rgba(255,255,255,.02);
}
.topic-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .28rem .8rem;
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.topic-btn:hover  { border-color: var(--accent2); color: var(--accent2); }
.topic-btn.active { background: var(--accent2); color: #000; border-color: var(--accent2); font-weight: 600; }

/* Row 3: subtopic links */
.nav-subtopics {
  display: none;
  align-items: center;
  gap: .35rem;
  padding: .45rem 1.5rem;
  flex-wrap: wrap;
  background: rgba(0,212,170,.04);
}
.nav-subtopics a {
  color: var(--muted);
  text-decoration: none;
  font-size: .78rem;
  padding: .22rem .6rem;
  border-radius: 5px;
  white-space: nowrap;
  transition: all .15s;
  border: 1px solid transparent;
}
.nav-subtopics a:hover { background: rgba(108,99,255,.15); color: var(--accent); border-color: var(--accent); }

/* ── MAIN CONTENT WRAPPER ───────────────────────────── */
.content {
  max-width: 980px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ── TYPOGRAPHY ─────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: .75rem;
  scroll-margin-top: 70px;
}
h1 { font-size: 2rem;   color: var(--accent);  margin-top: 0; }
h2 { font-size: 1.5rem; color: var(--accent2); border-bottom: 1px solid var(--border); padding-bottom: .4rem; }
h3 { font-size: 1.2rem; color: var(--accent4); }
h4 { font-size: 1rem;   color: #a29bfe; }
h5 { font-size: .9rem;  color: var(--muted); }

p { margin-bottom: 1rem; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent); }

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
li { margin-bottom: .35rem; }
li > ul, li > ol { margin-top: .35rem; margin-bottom: 0; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding: .6rem 1rem;
  margin: 1rem 0;
  background: rgba(108,99,255,.07);
  border-radius: 0 6px 6px 0;
  color: var(--muted);
  font-style: italic;
}
blockquote strong { color: var(--text); }

strong { color: #fff; }
em     { color: var(--accent4); font-style: italic; }

/* ── INLINE CODE ────────────────────────────────────── */
code {
  background: var(--inline-code-bg);
  color: var(--accent4);
  padding: .1em .4em;
  border-radius: 4px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: .87em;
}

/* ── CODE BLOCKS ────────────────────────────────────── */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
  position: relative;
}
pre code {
  background: none;
  color: var(--code-text);
  padding: 0;
  font-size: .88rem;
  line-height: 1.65;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
/* Language label */
pre[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: .5rem;
  right: .75rem;
  font-size: .68rem;
  font-family: 'Segoe UI', sans-serif;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  background: var(--border);
  padding: .15rem .5rem;
  border-radius: 4px;
}

/* Syntax color hints */
.kw  { color: #ff79c6; }   /* keyword */
.fn  { color: #8be9fd; }   /* function */
.str { color: #f1fa8c; }   /* string */
.cm  { color: #6272a4; }   /* comment */
.nb  { color: #bd93f9; }   /* number/bool */
.var { color: #f8f8f2; }   /* variable */

/* ── TABLES ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
  min-width: 400px;
}
thead th {
  background: var(--surface);
  color: var(--muted);
  text-align: left;
  padding: .6rem 1rem;
  border-bottom: 2px solid var(--border);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
tbody td {
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tbody tr:hover td { background: rgba(108,99,255,.04); }
tbody td:first-child { color: var(--muted); }
tbody code { font-size: .82rem; }

/* ── BADGES / DIFFICULTY ────────────────────────────── */
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-E { background: rgba(0,212,170,.15);  color: var(--easy);   }
.badge-M { background: rgba(255,217,61,.15); color: var(--medium); }
.badge-H { background: rgba(255,107,107,.15);color: var(--hard);   }
.badge-php     { background: #4f3bc9; color: #fff; }
.badge-js      { background: #c9a327; color: #000; }
.badge-laravel { background: #c9392e; color: #fff; }

/* ── CALLOUT / TIP BOXES ────────────────────────────── */
.callout {
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-left: 4px solid;
}
.callout.tip    { background: rgba(0,212,170,.08);  border-color: var(--accent2); }
.callout.warn   { background: rgba(255,217,61,.08); border-color: var(--accent4); }
.callout.danger { background: rgba(255,107,107,.08);border-color: var(--hard); }
.callout.info   { background: rgba(108,99,255,.08); border-color: var(--accent); }
.callout strong { display: block; margin-bottom: .4rem; font-size: .9rem; }

/* ── SECTION DIVIDER ────────────────────────────────── */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent2);
  margin: 2.5rem 0 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── NAV CARD GRID ──────────────────────────────────── */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .85rem;
  margin: 1rem 0;
}
.nav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .15s, box-shadow .15s;
  display: block;
}
.nav-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108,99,255,.18);
  text-decoration: none;
  color: var(--text);
}
.nav-card .nc-icon { font-size: 1.5rem; margin-bottom: .4rem; }
.nav-card .nc-title { font-weight: 600; font-size: .95rem; margin-bottom: .2rem; }
.nav-card .nc-desc  { font-size: .78rem; color: var(--muted); }

/* ── TOC (Table of Contents) ────────────────────────── */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}
.toc h2 {
  font-size: 1rem;
  border: none;
  margin-top: 0;
  padding-bottom: 0;
  color: var(--accent4);
  margin-bottom: .75rem;
}
.toc ul { padding-left: 1rem; margin: 0; }
.toc li { margin-bottom: .25rem; }
.toc a  { font-size: .87rem; color: var(--muted); }
.toc a:hover { color: var(--accent); text-decoration: none; }

/* ── FOOTER ─────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  font-size: .8rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.site-footer a { color: var(--accent2); }

/* ── RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 640px) {
  .content { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
  .topnav { padding: .5rem 1rem; }
  pre { padding: 1rem; }
}
