/* ============================================================
   Red Teaming Guide - Professional Dark Theme
   Color: Navy/Slate with blue accents
   ============================================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-hover: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-tertiary: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --accent-muted: rgba(56, 139, 253, 0.15);
  --border-primary: #30363d;
  --border-secondary: #21262d;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --code-bg: #161b22;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --sidebar-width: 280px;
  --header-height: 60px;
  --content-max-width: 860px;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  z-index: 1000;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-inner {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}
.header-brand:hover { color: var(--accent); }

.header-brand svg {
  width: 28px;
  height: 28px;
  fill: var(--accent);
}

.header-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.header-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  font-size: 14px;
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.header-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
.header-search input::placeholder { color: var(--text-tertiary); }

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

.header-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-nav a {
  color: var(--text-secondary);
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.header-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-github {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  color: var(--text-primary) !important;
  font-size: 13px;
  font-weight: 500;
}
.btn-github:hover { background: var(--bg-hover); }
.btn-github svg { width: 18px; height: 18px; fill: var(--text-primary); }

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
}
.sidebar-toggle:hover { background: var(--bg-hover); }
.sidebar-toggle svg { width: 22px; height: 22px; }

/* ============================================================
   LAYOUT
   ============================================================ */

.site-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 900;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 3px; }

.nav-section { margin-bottom: 4px; }

.nav-section-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-section-toggle:hover { color: var(--text-primary); }

.nav-section-toggle::after {
  content: '';
  margin-left: auto;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform 0.2s;
}
.nav-section.collapsed .nav-section-toggle::after {
  transform: rotate(-90deg);
}

.nav-section-items {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.nav-section.collapsed .nav-section-items {
  max-height: 0 !important;
}

.nav-section-items li a {
  display: block;
  padding: 6px 16px 6px 24px;
  color: var(--text-secondary);
  font-size: 14px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.nav-section-items li a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-left-color: var(--border-primary);
}
.nav-section-items li a.active {
  color: var(--accent);
  background: var(--accent-muted);
  border-left-color: var(--accent);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.content {
  grid-column: 2;
  padding: 32px 40px;
  max-width: calc(var(--content-max-width) + 80px);
  min-width: 0;
}

.content article { max-width: var(--content-max-width); }

/* Typography */
.content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-primary);
  color: var(--text-primary);
}
.content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  color: var(--text-primary);
}
.content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--text-primary);
}
.content h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
  color: var(--text-secondary);
}

.content p { margin: 0 0 1rem; }

.content ul, .content ol {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}
.content li { margin-bottom: 0.25rem; }
.content li a { font-weight: 500; }

/* Code */
.content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-secondary);
}

.content pre {
  background: var(--code-bg);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin: 0 0 1rem;
}
.content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* Blockquotes */
.content blockquote {
  margin: 0 0 1rem;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-muted);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}
.content blockquote p:last-child { margin-bottom: 0; }

/* Tables */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1rem;
  font-size: 14px;
}
.content th, .content td {
  padding: 8px 12px;
  border: 1px solid var(--border-primary);
  text-align: left;
}
.content th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}
.content tr:nth-child(even) td { background: var(--bg-tertiary); }

/* Horizontal rule */
.content hr {
  border: none;
  border-top: 1px solid var(--border-primary);
  margin: 2rem 0;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  margin-bottom: 16px;
}
.badge--beginner { background: var(--success); color: #0d1117; }
.badge--intermediate { background: var(--warning); color: #0d1117; }
.badge--advanced { background: var(--danger); color: #fff; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0 4px 4px 0;
}

/* ============================================================
   TABLE OF CONTENTS
   ============================================================ */

.toc {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.toc:empty { display: none; }

.toc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc li { margin-bottom: 4px; }
.toc li li { padding-left: 16px; }

.toc a {
  color: var(--text-secondary);
  font-size: 13px;
  transition: color 0.15s;
}
.toc a:hover { color: var(--accent); }
.toc a.active { color: var(--accent); font-weight: 500; }

/* ============================================================
   SEARCH RESULTS
   ============================================================ */

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 420px;
  overflow-y: auto;
  display: none;
  box-shadow: var(--shadow);
  z-index: 1100;
}
.search-results.active { display: block; }

.search-result-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-secondary);
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text-primary);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover,
.search-result-item.selected { background: var(--bg-hover); }

.search-result-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.search-result-path {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}
.search-result-snippet {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.search-result-snippet mark {
  background: transparent;
  color: var(--accent);
  font-weight: 600;
}

.search-meta {
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-secondary);
}

.search-hint {
  padding: 8px 14px;
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
  border-top: 1px solid var(--border-secondary);
}
.search-hint kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ============================================================
   BACK TO TOP
   ============================================================ */

.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 800;
}
.back-to-top:hover {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}
.back-to-top.visible { display: flex; }

/* ============================================================
   HOMEPAGE
   ============================================================ */

/* Roadmap */
.roadmap {
  margin-bottom: 48px;
}

.roadmap-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.roadmap-track {
  position: relative;
  padding-left: 32px;
}
.roadmap-track::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-primary);
}

.roadmap-level {
  position: relative;
  margin-bottom: 32px;
}
.roadmap-level:last-child { margin-bottom: 0; }

.roadmap-dot {
  position: absolute;
  left: -32px;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #0d1117;
}
.roadmap-dot--beginner { background: var(--success); }
.roadmap-dot--intermediate { background: var(--warning); }
.roadmap-dot--advanced { background: var(--danger); }
.roadmap-dot--practice { background: var(--accent); }

.roadmap-level-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.roadmap-level-title--beginner { color: var(--success); }
.roadmap-level-title--intermediate { color: var(--warning); }
.roadmap-level-title--advanced { color: var(--danger); }
.roadmap-level-title--practice { color: var(--accent); }

.roadmap-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.roadmap-item {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.roadmap-item:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

/* Topic cards */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.topic-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
}
.topic-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.topic-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.topic-card-count {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}
.topic-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */

.breadcrumb {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { margin: 0 6px; color: var(--text-tertiary); }

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  padding: 24px 40px;
  border-top: 1px solid var(--border-primary);
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .sidebar-toggle { display: block; }

  .site-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
  }

  .content {
    grid-column: 1;
    padding: 24px 16px;
  }

  .header-search { max-width: none; }
  .header-nav { display: none; }

  .topic-grid {
    grid-template-columns: 1fr;
  }

  .roadmap-items { gap: 6px; }
  .roadmap-item { font-size: 12px; padding: 3px 10px; }
}

@media (max-width: 480px) {
  .header-brand span { display: none; }
  .content h1 { font-size: 1.5rem; }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 899;
}
.sidebar-overlay.active { display: block; }
