/* ───────────────────────────────────────────────────────────
   RESET & BASE
─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #1e3a5f;
  --navy-dark:  #0f2647;
  --blue:       #3b82f6;
  --blue-light: #60a5fa;
  --blue-pale:  #eff6ff;
  --blue-mid:   #dbeafe;
  --slate:      #475569;
  --text:       #1a202c;
  --border:     #e2e8f0;
  --bg:         #f8fafc;
  --success:    #059669;
  --warning:    #d97706;
  --danger:     #dc2626;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
}

/* ───────────────────────────────────────────────────────────
   SIDEBAR NAVIGATION
─────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 270px;
  height: 100vh;
  background: var(--navy);
  color: #fff;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand-logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.sidebar-brand-logo span { color: var(--blue-light); }

.sidebar-brand-sub {
  font-size: 0.65rem;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 2px;
}

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

.sidebar-section {
  padding: 12px 20px 4px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.sidebar-nav a {
  display: block;
  padding: 7px 20px;
  color: #bfdbfe;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 400;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,0.07);
  color: #fff;
  border-left-color: var(--blue-light);
}

.sidebar-nav a.top-level {
  font-weight: 600;
  font-size: 0.82rem;
  color: #e0f2fe;
  margin-top: 6px;
}

.sidebar-nav a.sub {
  padding-left: 36px;
  font-size: 0.75rem;
}

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 14px 20px;
  font-size: 0.68rem;
  color: #64748b;
}

/* ───────────────────────────────────────────────────────────
   MAIN CONTENT
─────────────────────────────────────────────────────────── */
.main {
  margin-left: 270px;
  min-height: 100vh;
  background: #fff;
}

/* ───────────────────────────────────────────────────────────
   COVER PAGE
─────────────────────────────────────────────────────────── */
.cover {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f2647 55%, #071629 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2360a5fa' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.cover-inner {
  position: relative;
  max-width: 700px;
  width: 100%;
}

.cover-logo-text {
  font-size: 3.8rem;
  font-weight: 800;
  letter-spacing: -2px;
  margin-bottom: 6px;
}

.cover-logo-text span { color: var(--blue-light); }

.cover-tagline {
  font-size: 0.72rem;
  font-weight: 300;
  color: #93c5fd;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 48px;
}

.cover-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 10px;
}

.cover-divider {
  width: 60px;
  height: 3px;
  background: var(--blue-light);
  margin: 20px auto;
  border-radius: 2px;
}

.cover-desc {
  font-size: 0.88rem;
  color: #bfdbfe;
  max-width: 520px;
  margin: 0 auto 52px;
  line-height: 1.7;
}

.cover-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  max-width: 480px;
  margin: 0 auto;
}

.cover-meta-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 14px 18px;
  text-align: left;
}

.cover-meta-label {
  font-size: 0.6rem;
  color: #93c5fd;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 5px;
}

.cover-meta-value {
  font-size: 0.82rem;
  color: #f0f9ff;
  font-weight: 500;
}

/* ───────────────────────────────────────────────────────────
   CONTENT SECTIONS
─────────────────────────────────────────────────────────── */
.content-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 60px 48px;
}

/* ───────────────────────────────────────────────────────────
   TOC
─────────────────────────────────────────────────────────── */
.toc-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 48px;
  margin-bottom: 60px;
}

.toc-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  border-bottom: 3px solid var(--blue);
  padding-bottom: 12px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.toc-title::before {
  content: '≡';
  color: var(--blue);
  font-size: 1.6rem;
}

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

.toc-list > li {
  border-bottom: 1px solid var(--border);
}

.toc-list > li:last-child { border-bottom: none; }

.toc-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  text-decoration: none;
  color: var(--navy);
  font-weight: 600;
  font-size: 0.88rem;
  transition: color 0.15s;
}

.toc-list a:hover { color: var(--blue); }

.toc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--blue-pale);
  color: var(--blue);
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.toc-sub { list-style: none; padding: 0 0 8px 36px; }

.toc-sub a {
  font-weight: 400;
  color: var(--slate);
  font-size: 0.82rem;
  padding: 4px 0;
  border-bottom: none;
}

.toc-sub a:hover { color: var(--blue); }

/* ───────────────────────────────────────────────────────────
   HEADINGS
─────────────────────────────────────────────────────────── */
.doc-section {
  margin-bottom: 72px;
  scroll-margin-top: 32px;
}

h1.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--navy);
  border-bottom: 3px solid var(--navy);
  padding-bottom: 12px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--navy);
  color: #fff;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}

h2.subsection-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  border-left: 4px solid var(--blue);
  padding-left: 14px;
  margin: 32px 0 14px;
}

h3.sub-subsection {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e40af;
  margin: 22px 0 10px;
}

h4.field-group {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 18px 0 8px;
}

/* ───────────────────────────────────────────────────────────
   TABLES
─────────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 24px;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
  min-width: 400px;
}

thead { background: var(--navy); }

thead th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.3px;
  color: #fff;
}

tbody tr:nth-child(even) { background: var(--blue-pale); }
tbody tr:nth-child(odd)  { background: #fff; }

tbody tr:hover { background: var(--blue-mid); }

tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}

tbody tr:last-child td { border-bottom: none; }

/* ───────────────────────────────────────────────────────────
   CODE BLOCKS
─────────────────────────────────────────────────────────── */
pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 20px 22px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.78rem;
  line-height: 1.65;
  border-left: 4px solid var(--blue);
  margin: 16px 0 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

code {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.8rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: #0369a1;
}

pre code {
  background: transparent;
  border: none;
  color: #e2e8f0;
  padding: 0;
  font-size: 0.78rem;
}

/* ───────────────────────────────────────────────────────────
   CALLOUT BOXES
─────────────────────────────────────────────────────────── */
.callout {
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.85rem;
  line-height: 1.6;
}

.callout-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

.callout.info    { background: var(--blue-pale); border: 1px solid #bfdbfe; color: #1e40af; }
.callout.warning { background: #fffbeb;          border: 1px solid #fcd34d; color: #92400e; }
.callout.danger  { background: #fef2f2;          border: 1px solid #fca5a5; color: #7f1d1d; }
.callout.success { background: #f0fdf4;          border: 1px solid #86efac; color: #14532d; }

/* ───────────────────────────────────────────────────────────
   IMAGES
─────────────────────────────────────────────────────────── */
.screenshot-wrap {
  margin: 18px 0 26px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.screenshot-caption {
  background: var(--navy);
  color: #bfdbfe;
  font-size: 0.72rem;
  padding: 8px 14px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.screenshot-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.screenshot-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 18px 0 26px;
}

/* ───────────────────────────────────────────────────────────
   BADGES / PILLS
─────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef3c7; color: #b45309; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-blue   { background: var(--blue-pale); color: #1d4ed8; }

/* ───────────────────────────────────────────────────────────
   DIVIDERS
─────────────────────────────────────────────────────────── */
hr.section-divider {
  border: none;
  border-top: 2px solid var(--border);
  margin: 48px 0;
}

hr.sub-divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 28px 0;
}

/* ───────────────────────────────────────────────────────────
   TEXT UTILITIES
─────────────────────────────────────────────────────────── */
p { margin-bottom: 12px; }
ul, ol { padding-left: 22px; margin-bottom: 14px; }
li { margin-bottom: 5px; }
strong { font-weight: 700; color: #0f172a; }

.url-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 5px;
  color: #0369a1;
}

.module-url {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -10px 0 20px;
  font-size: 0.8rem;
  color: var(--slate);
}

.purpose-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 0 10px 10px 0;
  padding: 14px 18px;
  margin-bottom: 22px;
  font-size: 0.86rem;
  color: var(--slate);
  line-height: 1.6;
}

/* ───────────────────────────────────────────────────────────
   PRINT / PDF STYLES
─────────────────────────────────────────────────────────── */
@media print {
  .sidebar { display: none !important; }
  .main { margin-left: 0 !important; }
  .cover { min-height: 100vh; page-break-after: always; }
  .toc-section { page-break-after: always; }
  .doc-section { page-break-before: always; }
  .doc-section:first-child { page-break-before: avoid; }
  .screenshot-wrap, .screenshot-2col { page-break-inside: avoid; }
  table { page-break-inside: avoid; }
  pre { page-break-inside: avoid; }

  @page {
    size: A4;
    margin: 20mm 18mm;
  }
  @page :first { margin: 0; }

  body { font-size: 9.5pt; }
  .content-wrapper { padding: 40px 0; }
  h1.section-title { font-size: 16pt; }
  h2.subsection-title { font-size: 12pt; }
}

/* ───────────────────────────────────────────────────────────
   SCROLLBAR
─────────────────────────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* ───────────────────────────────────────────────────────────
   MOBILE RESPONSIVE
─────────────────────────────────────────────────────────── */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.mobile-logo {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.mobile-logo span { color: var(--blue-light); }

.mobile-toggle {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* OVERLAY FOR SIDEBAR */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.3s;
}

body.sidebar-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }
  
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  }
  
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  
  .main {
    margin-left: 0;
  }
  
  .content-wrapper {
    padding: 30px 20px;
  }
  
  .cover {
    padding: 40px 20px;
  }
  
  .cover-title {
    font-size: 1.6rem;
  }
  
  .cover-meta-grid {
    grid-template-columns: 1fr;
  }
  
  .screenshot-2col {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .toc-section {
    padding: 24px;
  }
  
  h1.section-title {
    font-size: 1.4rem;
  }
  
  .section-num {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
}