/* InfraWatch Docs — Shared Styles */

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

:root {
  --background: #0a0a0a;
  --foreground: #fafafa;
  --muted: #171717;
  --muted-foreground: #a1a1aa;
  --border: #27272a;
  --primary: #22c55e;
  --primary-foreground: #0a0a0a;
  --card: #141414;
  --card-foreground: #fafafa;
  --accent: #18181b;
  --accent-foreground: #fafafa;
  --radius: 0.75rem;
  --nav-bg: rgba(10, 10, 10, 0.8);
  --logo-amber: #f5a623;
  --sidebar-width: 240px;
  --dim: #71717a;
  --green: #22c55e;
}

[data-theme="light"] {
  --background: #f8fafc;
  --foreground: #0f172a;
  --muted: #e2e8f0;
  --muted-foreground: #475569;
  --border: #cbd5e1;
  --primary: #16a34a;
  --primary-foreground: #f8fafc;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --accent: #f1f5f9;
  --accent-foreground: #0f172a;
  --nav-bg: rgba(248, 250, 252, 0.85);
  --logo-amber: #f5a623;
  --dim: #64748b;
  --green: #16a34a;
}

html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Top nav */
.docs-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.docs-nav-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.docs-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--foreground);
  text-decoration: none;
}

.docs-logo-glyph {
  color: var(--logo-amber);
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 700;
  filter: drop-shadow(0 0 8px rgba(245, 166, 35, 0.3));
}

.docs-label {
  font-size: 0.8rem;
  color: var(--dim);
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-weight: 500;
}

.docs-nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.docs-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--foreground);
  cursor: pointer;
  padding: 0.25rem;
}

.docs-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem;
  gap: 0.15rem;
}

.theme-toggle button {
  border: none;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  font-family: inherit;
}

.theme-toggle button[aria-pressed="true"] {
  background: var(--foreground);
  color: var(--background);
}

/* Layout */
.docs-layout {
  display: flex;
  max-width: 1200px;
  margin: 56px auto 0;
  min-height: calc(100vh - 56px);
  padding: 0 1.5rem;
}

/* Sidebar */
.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 0 1rem;
  margin-bottom: 1.5rem;
}

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

.sidebar-link {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.sidebar-link:hover {
  color: var(--foreground);
  background: var(--accent);
}

.sidebar-link.active {
  color: var(--green);
  background: var(--accent);
  font-weight: 500;
}

.sidebar-sub {
  padding-left: 0.75rem;
}

.sidebar-sub .sidebar-link {
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  color: var(--dim);
}

.sidebar-sub .sidebar-link:hover {
  color: var(--muted-foreground);
}

.sidebar-theme-toggle {
  display: none;
  padding: 1rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.sidebar-theme-toggle .theme-toggle {
  display: inline-flex;
}

/* Right TOC */
.docs-toc {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 1.5rem 0 1.5rem 1rem;
  order: 2;
}

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

.toc-link {
  display: block;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem;
  color: var(--muted-foreground);
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.15s;
  line-height: 1.5;
}

.toc-link:hover {
  color: var(--foreground);
}

/* Content */
.docs-content {
  flex: 1;
  min-width: 0;
  max-width: 760px;
  padding: 2.5rem 3rem 4rem;
  order: 1;
  overflow-x: hidden;
}

.docs-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.docs-content .subtitle {
  color: var(--muted-foreground);
  font-size: 1.05rem;
  margin-bottom: 2.5rem;
}

.docs-content h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.docs-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.docs-content p {
  margin-bottom: 1rem;
  color: var(--card-foreground);
}

.docs-content a {
  color: var(--green);
  text-decoration: none;
}

.docs-content a:hover {
  text-decoration: underline;
}

.docs-content a.docs-footer-link:hover {
  text-decoration: none;
}

.docs-content ul, .docs-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.docs-content li {
  margin-bottom: 0.4rem;
}

/* Code */
.docs-content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--accent);
  border: 1px solid var(--border);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--green);
}

.docs-content pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  position: relative;
}

.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  color: var(--card-foreground);
  line-height: 1.65;
}

/* Code block with title */
.code-block {
  margin-bottom: 1.5rem;
}

.code-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0.5rem 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--dim);
  font-weight: 500;
}

.code-block pre {
  margin-bottom: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

.copy-btn {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.copy-btn:hover {
  color: var(--foreground);
}

.copy-btn.copied {
  color: var(--green);
}

/* Tables */
.docs-content .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
}

.docs-content .table-wrap table {
  margin-bottom: 0;
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
}

.docs-content th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: var(--accent);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}

.docs-content td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

.docs-content tr:hover td {
  background: var(--accent);
}

/* Callouts */
.callout {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  border-left: 3px solid;
}

.callout-info {
  background: rgba(34, 197, 94, 0.06);
  border-color: var(--green);
}

.callout-warn {
  background: rgba(245, 166, 35, 0.06);
  border-color: var(--logo-amber);
}

.callout-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

/* Step indicators */
.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--green);
  color: var(--background);
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.step-body {
  flex: 1;
  min-width: 0;
}

.step-body h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

/* Nav buttons (bottom of page) */
.docs-footer-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.docs-footer-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  min-width: 0;
}

.docs-footer-link:hover {
  border-color: var(--green);
  background: var(--accent);
  transform: translateY(-2px);
}

.docs-footer-link.next {
  text-align: right;
  margin-left: auto;
}

.docs-footer-link .label {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

.docs-footer-link .title {
  font-size: 1.05rem;
  color: var(--foreground);
  font-weight: 600;
}

/* Tablet & Mobile — collapse sidebar into hamburger */
@media (max-width: 1024px) {
  .docs-toc {
    display: none;
  }

  .docs-menu-btn {
    display: flex;
  }

  .docs-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 91;
    background: var(--background);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .docs-sidebar-overlay.open {
    display: block;
  }

  .docs-content {
    margin-left: 0;
  }

  .theme-toggle {
    display: none;
  }

  .sidebar-theme-toggle {
    display: block;
  }
}

@media (max-width: 768px) {
  .docs-content {
    padding: 2rem 1.25rem 3rem;
  }

  .docs-content h1 {
    font-size: 1.6rem;
  }

  .docs-content pre {
    padding: 1rem;
    font-size: 0.78rem;
  }

  .docs-footer-nav {
    flex-direction: column;
  }

  .docs-footer-link.next {
    text-align: left;
  }

  .docs-label {
    display: none;
  }
}
