/* ============================================
   NCT Infra Documentation - Styles
   Brand: Royal Blue #0257E0
   Background: #0A0A0F
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --brand: #0257E0;
  --brand-light: #3B7EF0;
  --brand-glow: rgba(2, 87, 224, 0.15);
  --brand-glow-strong: rgba(2, 87, 224, 0.25);
  --bg-primary: #0A0A0F;
  --bg-secondary: #101018;
  --bg-tertiary: #16161F;
  --bg-elevated: #1A1A25;
  --bg-card: #13131C;
  --border: #1E1E2A;
  --border-light: #2A2A38;
  --text-primary: #EDEDF0;
  --text-secondary: #97979F;
  --text-muted: #6B6B78;
  --sidebar-width: 280px;
  --header-height: 60px;
  --content-max: 860px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--brand-light);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--text-primary);
}

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
  max-width: 1440px;
  margin: 0 auto;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.mobile-menu-btn:hover {
  background: var(--bg-tertiary);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--text-primary);
}

.logo-text {
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--brand-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Search Bar */
.header-center {
  flex: 1;
  max-width: 400px;
  margin: 0 32px;
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-bar input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 40px 8px 36px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar input::placeholder {
  color: var(--text-muted);
}

.search-bar input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.search-kbd {
  position: absolute;
  right: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  padding: 2px 6px;
  pointer-events: none;
}

/* Header Nav */
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-right .nav-link {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.header-right .nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.header-right .nav-link.active {
  color: var(--brand-light);
}

/* --- Search Overlay --- */
.search-overlay {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(4px);
  z-index: 90;
}

.search-overlay.active {
  display: block;
}

.search-results {
  max-width: 560px;
  margin: 8px auto 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  max-height: 420px;
  overflow-y: auto;
  padding: 8px;
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}

.search-result-item:hover,
.search-result-item.active {
  background: var(--bg-tertiary);
}

.search-result-item .result-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}

.search-result-item .result-category {
  color: var(--text-muted);
  font-size: 12px;
}

.search-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* --- Layout --- */
.layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

.sidebar-nav {
  padding: 16px 0 32px;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 16px 20px 6px;
}

.sidebar-list {
  list-style: none;
}

.sidebar-link {
  display: block;
  padding: 6px 20px 6px 28px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 400;
  border-left: 2px solid transparent;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.sidebar-link.active {
  color: var(--brand-light);
  border-left-color: var(--brand);
  background: var(--brand-glow);
  font-weight: 500;
}

/* --- Main Content --- */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 40px 48px 80px;
  max-width: calc(var(--content-max) + var(--sidebar-width) + 96px);
  min-height: calc(100vh - var(--header-height) - 100px);
}

.content h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.content h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-primary);
}

.content h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

.content h3 {
  font-size: 17px;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.content h4 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.content .lead {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

.content ul, .content ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.content li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--brand-light);
}

.content pre {
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: 1px solid var(--border);
  background: var(--bg-tertiary) !important;
}

.content pre code {
  display: block;
  padding: 20px 24px;
  border: none;
  background: transparent !important;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

/* Tables */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

.content table th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-tertiary);
}

.content table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.content table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.content table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

.content table tr:last-child td {
  border-bottom: none;
}

.content table td code {
  font-size: 12.5px;
}

/* --- Feature Grid --- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 20px 0 32px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  border-color: var(--brand);
  box-shadow: 0 0 24px var(--brand-glow);
}

.feature-icon {
  color: var(--brand-light);
  margin-bottom: 14px;
}

.feature-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.6;
}

.feature-card a {
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-light);
}

.feature-card a:hover {
  color: var(--text-primary);
}

/* --- Info Grid --- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}

.info-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.info-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text-primary);
}

.info-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* --- Tag List --- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 24px;
}

.tag {
  display: inline-block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s;
}

.tag:hover {
  border-color: var(--brand);
  color: var(--brand-light);
}

/* --- Callout --- */
.callout {
  background: var(--brand-glow);
  border: 1px solid rgba(2, 87, 224, 0.2);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 20px 0 24px;
}

.callout p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Checklist --- */
.checklist {
  margin: 16px 0 24px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
}

.checklist-item:last-child {
  border-bottom: none;
}

.check-icon {
  color: var(--text-muted);
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* --- Footer --- */
.footer {
  margin-left: var(--sidebar-width);
  border-top: 1px solid var(--border);
  padding: 32px 48px;
  background: var(--bg-secondary);
}

.footer-inner {
  max-width: var(--content-max);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 13px;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--text-primary);
}

.footer-copy {
  color: var(--text-muted);
  font-size: 12px;
}

/* --- Scrollbar for content --- */
.content::-webkit-scrollbar {
  width: 6px;
}

.content::-webkit-scrollbar-track {
  background: transparent;
}

.content::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

/* --- Mobile Responsive --- */
@media (max-width: 1024px) {
  .header-center {
    max-width: 280px;
    margin: 0 16px;
  }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    background: var(--bg-primary);
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  .content {
    margin-left: 0;
    padding: 28px 20px 60px;
  }

  .footer {
    margin-left: 0;
    padding: 24px 20px;
  }

  .header-center {
    display: none;
  }

  .header-right {
    gap: 0;
  }

  .header-right .nav-link {
    font-size: 13px;
    padding: 6px 10px;
  }

  .content h1 {
    font-size: 26px;
  }

  .content h2 {
    font-size: 20px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .content table {
    font-size: 13px;
  }

  .content table th,
  .content table td {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 12px;
  }

  .content {
    padding: 20px 16px 48px;
  }

  .content pre code {
    padding: 16px;
    font-size: 12px;
  }
}

/* --- Backdrop for mobile sidebar --- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.sidebar-backdrop.active {
  display: block;
}

/* --- Highlight.js overrides --- */
.hljs {
  background: transparent !important;
  padding: 0 !important;
}

/* --- Loading state --- */
.content-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-muted);
  font-size: 14px;
}

/* --- Smooth page transitions --- */
.content-fade-in {
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Print styles --- */
@media print {
  .header, .sidebar, .footer, .search-bar {
    display: none !important;
  }
  .content {
    margin: 0;
    padding: 20px;
    max-width: 100%;
  }
  body {
    background: white;
    color: black;
  }
}
