/* Reset & Base Variables */
:root {
  --bg-primary: #090d16;
  --bg-secondary: #0f1424;
  --bg-glass: rgba(15, 22, 42, 0.65);
  --bg-glass-active: rgba(30, 41, 59, 0.8);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(139, 92, 246, 0.2);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-purple: #a78bfa;
  --accent-indigo: #818cf8;
  --accent-blue: #60a5fa;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --gradient-accent: linear-gradient(135deg, var(--accent-purple), var(--accent-indigo));
  --gradient-glow: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(99, 102, 241, 0.15));
  
  --header-height: 70px;
  --sidebar-width: 280px;
  --toc-width: 220px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2.8rem;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: 1.8rem;
  margin-top: 2.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.3rem;
  margin-top: 1.8rem;
}

p {
  margin-bottom: 1.2rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

p.lead {
  font-size: 1.25rem;
  color: var(--text-primary);
  font-weight: 300;
}

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

a:hover {
  color: #c084fc;
}

/* Background Glow Decorations */
.decor-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(150px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
}

.glow-top-left {
  background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, rgba(99, 102, 241, 0) 70%);
  top: -100px;
  left: -100px;
}

.glow-bottom-right {
  background: radial-gradient(circle, rgba(96, 165, 250, 0.3) 0%, rgba(139, 92, 246, 0) 70%);
  bottom: -200px;
  right: -100px;
}

/* Glassmorphism Panel Helper */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Header Styles */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 2rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--text-primary);
  font-weight: 700;
}

.logo-icon-container {
  position: relative;
  width: 38px;
  height: 38px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-pulse {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-indigo));
  z-index: -1;
  opacity: 0.6;
  filter: blur(4px);
  animation: logo-glow-anim 3s infinite alternate;
}

@keyframes logo-glow-anim {
  0% { transform: scale(0.98); opacity: 0.4; }
  100% { transform: scale(1.03); opacity: 0.8; }
}

.logo-symbol {
  font-size: 1.2rem;
}

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-subtext {
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.1rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.search-wrapper {
  position: relative;
  width: 260px;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

#docs-search {
  width: 100%;
  height: 38px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 0 1rem 0 2.2rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

#docs-search:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 38px;
  padding: 0 1.2rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-github {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-github:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.mobile-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
}

/* Layout Container */
.docs-layout {
  display: flex;
  max-width: 1440px;
  margin: var(--header-height) auto 0;
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

/* Sidebar Navigation */
.sidebar-nav {
  width: var(--sidebar-width);
  border-right: 1px solid var(--border-color);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 2rem 1.5rem;
  background: rgba(9, 13, 22, 0.4);
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
}

.nav-section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.nav-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nav-section a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 400;
  transition: all 0.15s ease;
}

.nav-section a i {
  width: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-section a:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.nav-section a:hover i {
  color: var(--accent-purple);
}

.nav-section a.active {
  background: rgba(167, 139, 250, 0.08);
  border-left: 2px solid var(--accent-purple);
  color: var(--accent-purple);
  font-weight: 500;
}

.nav-section a.active i {
  color: var(--accent-purple);
}

/* Main Content Styles */
.docs-content {
  flex: 1;
  padding: 3rem 4rem 6rem;
  max-width: calc(1440px - var(--sidebar-width) - var(--toc-width));
}

.content-section {
  display: none;
  animation: section-fade-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.content-section.active-section {
  display: block;
}

@keyframes section-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.badge {
  display: inline-block;
  background: rgba(167, 139, 250, 0.1);
  color: var(--accent-purple);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.8rem;
  border: 1px solid rgba(167, 139, 250, 0.15);
}

/* Docs Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.docs-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.8rem;
  transition: all 0.25s ease;
}

.docs-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-purple);
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.08);
}

.card-icon {
  font-size: 1.8rem;
  color: var(--accent-purple);
  margin-bottom: 1.2rem;
}

.docs-card h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
}

.docs-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-bottom: 0;
}

/* Architecture Diagram */
.architecture-diagram {
  padding: 2.5rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 2rem 0;
  position: relative;
  overflow: hidden;
}

.dia-column {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dia-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  text-align: center;
  min-width: 160px;
  position: relative;
}

.dia-box.active-node {
  border-color: var(--success);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.dia-box.atc-daemon {
  border-color: var(--accent-purple);
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.15);
}

.dia-icon {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  display: block;
}

.dia-box h4 {
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.dia-box p {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.dia-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
}

.dia-arrow-fork {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  padding-left: 2rem;
}

.dia-arrow-fork::before {
  content: "";
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 2px;
  background: var(--border-color);
}

.fork-up, .fork-down {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.fork-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  width: 70px;
}

.consul-resolver {
  border-color: rgba(99, 102, 241, 0.4);
}

.meta-indicator {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent-purple);
  white-space: nowrap;
}

/* Tables */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.docs-table th, .docs-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

.docs-table th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  font-weight: 600;
}

.docs-table td {
  color: var(--text-secondary);
}

.docs-table code {
  color: var(--accent-blue);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Code Snippets & Copy Buttons */
pre {
  position: relative;
  background: rgba(15, 22, 42, 0.5) !important;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin: 1.5rem 0;
  padding: 1.2rem !important;
  overflow-x: auto;
}

code {
  font-family: 'Fira Code', 'Courier New', Courier, monospace;
  font-size: 0.9rem !important;
}

.btn-copy {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
}

pre:hover .btn-copy {
  opacity: 1;
}

.btn-copy:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-copy.success {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--success);
  color: var(--success);
}

/* Lists */
ul {
  padding-left: 1.5rem;
  margin-bottom: 1.2rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.4rem;
}

/* Right Sidebar TOC */
.sidebar-toc {
  width: var(--toc-width);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 3rem 1rem 3rem 0;
  font-size: 0.85rem;
}

.toc-container h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.toc-container ul {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toc-container a {
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.toc-container a:hover, .toc-container a.active {
  color: var(--accent-purple);
}

/* Live Dashboard Preview */
.dashboard-preview {
  margin: 2rem 0;
  overflow: hidden;
  border-radius: 12px;
}

.preview-header {
  height: 40px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.4rem;
}

.preview-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-red { background: var(--danger); }
.dot-yellow { background: var(--warning); }
.dot-green { background: var(--success); }

.preview-title {
  margin-left: auto;
  margin-right: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.preview-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  position: relative;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-active { background: var(--success); }
.dot-offline { background: var(--danger); }

.badge-type {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-type.failover {
  background: rgba(96, 165, 250, 0.1);
  color: var(--accent-blue);
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.badge-type.redirect {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-offline {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--danger);
  font-weight: 500;
}

.card-details p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.strat {
  color: var(--accent-purple);
}

.vis-path {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  color: var(--text-primary);
  width: fit-content;
}

.node-red {
  color: var(--warning);
}

.card-offline {
  border-color: rgba(239, 68, 68, 0.2);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  background: rgba(9, 13, 22, 0.9);
  padding: 3rem 2rem;
  text-align: center;
  z-index: 10;
}

.footer-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.site-footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Responsive Breakpoints */
@media (max-width: 1100px) {
  .sidebar-toc {
    display: none;
  }
  .docs-content {
    max-width: calc(100vw - var(--sidebar-width));
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 250px;
  }
  
  .mobile-btn {
    display: block;
  }
  
  .search-wrapper {
    display: none;
  }
  
  .sidebar-nav {
    position: fixed;
    top: var(--header-height);
    left: calc(var(--sidebar-width) * -1);
    width: var(--sidebar-width);
    z-index: 99;
    background: var(--bg-secondary);
    transition: left 0.3s ease;
  }
  
  .sidebar-nav.menu-open {
    left: 0;
  }
  
  .docs-content {
    max-width: 100vw;
    padding: 2rem;
  }
}
