/* Modern Cybersecurity Forensic Dossier Theme */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: #151d2e;
  --bg-card-hover: #1c273c;
  --border-color: #27354d;
  --border-subtle: #1e293b;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-red: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-purple: #a855f7;
  
  --code-bg: #0d131f;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, Monaco, monospace;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

/* Header & Navigation */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #f43f5e 0%, #a855f7 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
}

.brand-text h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--accent-red);
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

nav.main-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  text-decoration: none;
}

.nav-link.active {
  color: var(--accent-cyan);
  border: 1px solid var(--border-color);
}

/* Banner Alert */
.alert-banner {
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
  border-bottom: 1px solid rgba(244, 63, 94, 0.3);
  padding: 0.6rem 1.5rem;
  font-size: 0.85rem;
  color: #fda4af;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
}

.alert-tag {
  background: var(--accent-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Main Layout */
.layout-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2.5rem;
}

.layout-single {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/* Sticky Sidebar */
.sidebar {
  position: sticky;
  top: 5rem;
  height: calc(100vh - 6rem);
  overflow-y: auto;
  padding-right: 1rem;
}

.sidebar-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
}

.toc-list {
  list-style: none;
}

.toc-item {
  margin-bottom: 0.25rem;
}

.toc-link {
  display: block;
  padding: 0.4rem 0.6rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}

.toc-link:hover {
  color: var(--text-primary);
  background: var(--bg-card);
  text-decoration: none;
}

.toc-link.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  border-left-color: var(--accent-cyan);
  font-weight: 600;
}

/* Content Area */
.content-area {
  min-width: 0;
}

/* Hero Section */
.hero-box {
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(21, 29, 46, 0.4) 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-red), var(--accent-amber), var(--accent-cyan));
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: #fff;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  max-width: 900px;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.metric-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  position: relative;
}

.metric-card.danger { border-top: 3px solid var(--accent-red); }
.metric-card.warning { border-top: 3px solid var(--accent-amber); }
.metric-card.cyan { border-top: 3px solid var(--accent-cyan); }
.metric-card.emerald { border-top: 3px solid var(--accent-emerald); }
.metric-card.purple { border-top: 3px solid var(--accent-purple); }

.metric-val {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #fff;
  line-height: 1.2;
}

.metric-card.danger .metric-val { color: #fb7185; }
.metric-card.warning .metric-val { color: #fde047; }
.metric-card.cyan .metric-val { color: #7dd3fc; }
.metric-card.emerald .metric-val { color: #6ee7b7; }
.metric-card.purple .metric-val { color: #c084fc; }

.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-weight: 500;
}

/* Section Common */
section.doc-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: 5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-weight: 600;
  font-family: var(--font-mono);
}

/* Badges */
.badge-danger { background: rgba(244, 63, 94, 0.15); color: #fda4af; border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fde68a; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-cyan { background: rgba(56, 189, 248, 0.15); color: #bae6fd; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-emerald { background: rgba(16, 185, 129, 0.15); color: #a7f3d0; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: #e9d5ff; border: 1px solid rgba(168, 85, 247, 0.3); }

/* Cards & Containers */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: #3b4e72;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.75rem;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin: 1.25rem 0;
  background: var(--bg-card);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

table.data-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
}

/* Timeline Components */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin: 1.5rem 0;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 7px;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.75rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -2rem;
  top: 0.35rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 3px solid var(--accent-cyan);
}

.timeline-item.danger::before { border-color: var(--accent-red); }
.timeline-item.warning::before { border-color: var(--accent-amber); }
.timeline-item.success::before { border-color: var(--accent-emerald); }

.timeline-time {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.4rem;
}

/* Code & Pre */
pre, code {
  font-family: var(--font-mono);
}

p code, li code, td code {
  background: rgba(56, 189, 248, 0.1);
  color: #7dd3fc;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin: 1rem 0;
  overflow: hidden;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #111726;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.code-copy-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.code-copy-btn:hover {
  background: var(--bg-tertiary);
  color: #fff;
}

.code-block pre {
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #e2e8f0;
}

/* Diff Styling */
.diff-del {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  display: block;
  padding: 0.1rem 0.5rem;
}

.diff-add {
  background: rgba(16, 185, 129, 0.15);
  color: #a7f3d0;
  display: block;
  padding: 0.1rem 0.5rem;
}

/* Callout / Notes */
.callout {
  border-left: 4px solid var(--accent-cyan);
  background: rgba(56, 189, 248, 0.05);
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin: 1.25rem 0;
  font-size: 0.92rem;
}

.callout.danger {
  border-left-color: var(--accent-red);
  background: rgba(244, 63, 94, 0.08);
}

.callout.warning {
  border-left-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
}

.callout.success {
  border-left-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}

.callout-title {
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Evidence Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
}

.gallery-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}

.gallery-thumb-wrap {
  width: 100%;
  height: 200px;
  background: #0d131f;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
}

.gallery-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.3s;
}

.gallery-card:hover .gallery-thumb-wrap img {
  transform: scale(1.03);
}

.gallery-zoom-hint {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.gallery-meta {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.gallery-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.35rem;
}

.gallery-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 0.75rem;
  flex-grow: 1;
}

.gallery-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.5rem;
}

/* Lightbox Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  max-width: 95vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1.25rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.5rem;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 1rem;
  overflow: auto;
  display: flex;
  justify-content: center;
  background: #080c14;
}

.modal-body img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 4px;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Forum Archive Posts */
.forum-topic-wrapper {
  margin-bottom: 3rem;
}

.topic-header-card {
  background: linear-gradient(180deg, var(--bg-card) 0%, rgba(21, 29, 46, 0.6) 100%);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.topic-badge-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.topic-main-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.topic-meta-row {
  display: flex;
  gap: 1.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.forum-post {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.post-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
}

.user-name-box {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  color: #fff;
  font-size: 0.9rem;
}

.user-tag {
  font-size: 0.7rem;
  color: var(--accent-cyan);
}

.post-number-badge {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.post-body {
  padding: 1.5rem;
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1.7;
}

.post-body blockquote {
  border-left: 3px solid var(--accent-cyan);
  padding: 0.5rem 1rem;
  margin: 1rem 0;
  background: rgba(56, 189, 248, 0.05);
  color: var(--text-secondary);
}

.post-body hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: 1.5rem 0;
}

.post-body h1, .post-body h2, .post-body h3, .post-body h4 {
  color: #fff;
  margin: 1.25rem 0 0.75rem;
}

.post-body h1 { font-size: 1.35rem; }
.post-body h2 { font-size: 1.2rem; }
.post-body h3 { font-size: 1.05rem; }

.post-body ul, .post-body ol {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
}

.post-body li {
  margin-bottom: 0.35rem;
}

/* Footer */
footer.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Filter controls */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.filter-input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  color: #fff;
  font-size: 0.85rem;
  min-width: 200px;
}

.filter-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent-cyan);
  color: #0b0f19;
  font-weight: 600;
  border-color: var(--accent-cyan);
}

/* Responsive */
@media (max-width: 1024px) {
  .layout-container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
  nav.main-nav {
    width: 100%;
    justify-content: space-between;
  }
  .hero-title {
    font-size: 1.4rem;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
