:root {
  /* Document Theme Variables */
  --bg-body: #ffffff;
  --bg-sidebar: #f8fafc;
  --bg-surface: #ffffff;
  --text-main: #334155;
  --text-heading: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --accent-bg: #f0f9ff;
  
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-header: #1e293b;
  
  --sidebar-width: 280px;
  --header-height: 64px;
  --content-max: 860px;
}

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

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

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ========================================= */
/* Header */
/* ========================================= */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 50;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-heading);
}

.brand-logo {
  background: var(--text-heading);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

.brand-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.header-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.header-links a:hover {
  color: var(--text-heading);
}

/* ========================================= */
/* Layout Wrapper */
/* ========================================= */
.docs-wrapper {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-height);
}

/* ========================================= */
/* Sidebar */
/* ========================================= */
.docs-sidebar {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 2rem 1.5rem;
  z-index: 40;
}

.nav-group {
  margin-bottom: 2rem;
}

.nav-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-heading);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.75rem 0;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-link {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--text-heading);
  background-color: #f1f5f9;
}

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

/* ========================================= */
/* Main Content */
/* ========================================= */
.docs-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 3rem 2rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.docs-content {
  width: 100%;
  max-width: var(--content-max);
}

/* Headings */
h1, h2, h3, h4 {
  color: var(--text-heading);
  margin-top: 0;
  font-weight: 600;
}

.docs-title-area {
  margin-bottom: 2rem;
}

.docs-eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.docs-title {
  font-size: 2.5rem;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.docs-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 65ch;
}

.divider {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 1rem 0 2rem;
}

/* ========================================= */
/* Landing Intro & Feature Grid */
/* ========================================= */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: hidden;
  position: relative;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -10px rgba(0,0,0,0.1);
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-heading);
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* ========================================= */
/* Interactive Showcase Animations (V9) */
/* ========================================= */
.interactive-showcase {
  display: flex;
  gap: 2rem;
  margin: 2rem 0;
  min-height: 320px;
}

@media (max-width: 768px) {
  .interactive-showcase {
    flex-direction: column;
  }
}

/* Left Nav */
.showcase-nav {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.showcase-tab {
  text-align: left;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.showcase-tab:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-heading);
}

.showcase-tab.is-active {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Right Viewer */
.showcase-viewer {
  flex: 1;
  position: relative;
  background: #fafafa;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Fallback for dark mode via nested selector if needed, assuming default docs */
@media (prefers-color-scheme: dark) {
  .showcase-viewer { background: #111827; }
  .showcase-tab:hover { background: rgba(255, 255, 255, 0.05); }
}

.stage-item {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.stage-item.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Stage Inner Content */
.stage-frame {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.stage-desc {
  text-align: center;
  max-width: 80%;
}

.stage-desc p {
  font-size: 1.05rem;
  color: var(--text-heading);
  line-height: 1.6;
  margin: 0;
}

/* 1. Parking Flat */
.anim-flat-parking { background: #fee2e2; border: 1px solid #fecaca; }
.clock-icon {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid #ef4444; position: relative;
}
.clock-icon::after {
  content: ''; position: absolute; top: 10px; left: 10px; width: 8px; height: 2px;
  background: #ef4444; transform-origin: left; animation: spinClock 3s linear infinite;
}
@keyframes spinClock { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* 2. Drain Flat */
.anim-flat-drain { background: #fef3c7; border: 1px solid #fde68a; }
.battery-icon {
  width: 26px; height: 14px; border: 2px solid #f59e0b; border-radius: 3px; position: relative;
}
.battery-icon::after { content: ''; position: absolute; right: -4px; top: 3px; width: 2px; height: 4px; background: #f59e0b; }
.batt-fill {
  position: absolute; left: 1px; top: 1px; bottom: 1px; background: #ef4444; border-radius: 1px;
  animation: drainFlat 4s ease-in-out infinite;
}
@keyframes drainFlat { 0%, 20% { width: 20px; background: #10b981; } 50% { width: 10px; background: #f59e0b; } 80%, 100% { width: 4px; background: #ef4444; } }

/* 3. Trip Flat */
.anim-flat-trip { background: #e0f2fe; border: 1px solid #bae6fd; }
.path-icon { width: 36px; height: 2px; border-top: 2px dashed #0284c7; position: relative; }
.path-icon .dot {
  position: absolute; top: -5px; left: 0; width: 8px; height: 8px; background: #0284c7; border-radius: 50%;
  animation: pathFlat 3s ease infinite;
}
@keyframes pathFlat { 0% { left: 0; } 70%, 100% { left: 100%; } }

/* 4. Charge Flat */
.anim-flat-charge { background: #dcfce7; border: 1px solid #bbf7d0; }
.charge-icon { font-size: 1.5rem; color: #16a34a; animation: pulseCharge 2s ease-in-out infinite alternate; }
@keyframes pulseCharge { from { transform: scale(0.9); opacity: 0.8; } to { transform: scale(1.1); opacity: 1; } }

/* 5. Unsecured Warn Flat */
.anim-flat-warn { background: #ffedd5; border: 1px solid #fed7aa; }
.lock-icon { width: 16px; height: 12px; background: #f97316; border-radius: 2px; position: relative; animation: shakeLockFlat 4s infinite; }
.lock-icon::before { content: ''; position: absolute; top: -8px; left: 2px; width: 8px; height: 8px; border: 2px solid #f97316; border-bottom: 0; border-radius: 6px 6px 0 0; }
@keyframes shakeLockFlat { 0%, 90% { transform: rotate(0); } 92% { transform: rotate(15deg); } 94% { transform: rotate(-15deg); } 96% { transform: rotate(10deg); } 98% { transform: rotate(-10deg); } 100% { transform: rotate(0); } }

/* 6. OTA Flat */
.anim-flat-ota { background: #f3e8ff; border: 1px solid #e9d5ff; }
.update-icon { font-size: 1.2rem; font-weight: bold; color: #9333ea; animation: floatOta 2s ease-in-out infinite alternate; }
@keyframes floatOta { from { transform: translateY(-3px); } to { transform: translateY(3px); } }

/* 7. Channel Flat */
.anim-flat-channel { background: #e0e7ff; border: 1px solid #c7d2fe; }
.channel-nodes { display: flex; gap: 4px; }
.channel-nodes span { width: 8px; height: 8px; background: #4f46e5; border-radius: 50%; opacity: 0.3; }
.channel-nodes span:nth-child(1) { animation: nodeBlink 1.5s infinite 0s; }
.channel-nodes span:nth-child(2) { animation: nodeBlink 1.5s infinite 0.5s; }
.channel-nodes span:nth-child(3) { animation: nodeBlink 1.5s infinite 1s; }
@keyframes nodeBlink { 0%, 100% { opacity: 0.3; transform: scale(1); } 50% { opacity: 1; transform: scale(1.3); } }

/* 8. Dash Flat */
.anim-flat-dash { background: #f1f5f9; border: 1px solid #e2e8f0; }
.dash-icon { width: 28px; height: 18px; border: 2px solid #64748b; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.blink-dot { width: 6px; height: 6px; background: #ef4444; border-radius: 50%; animation: sentryBlink 1s infinite alternate; }
@keyframes sentryBlink { from { opacity: 0.2; } to { opacity: 1; } }

/* button-primary modifier */
.button-primary {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--accent) !important;
  transition: all 0.2s ease;
}
.button-primary:hover {
  background: #2563eb !important;
}

/* ========================================= */
/* Wizard Step Framework */
/* ========================================= */
.wizard-step {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.wizard-step.is-active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.docs-section {
  margin-bottom: 2rem;
}

.docs-section h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.docs-section h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

p {
  margin: 0 0 1rem 0;
}

strong {
  font-weight: 600;
  color: var(--text-heading);
}

/* ========================================= */
/* Wizard Footer Navbar */
/* ========================================= */
.wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.btn-step {
  appearance: none;
  background: none;
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-step .arr {
  color: var(--text-muted);
  transition: transform 0.2s;
}

.btn-step.btn-prev:hover {
  background: var(--bg-sidebar);
  border-color: #cbd5e1;
}

.btn-step.btn-prev:hover .arr {
  transform: translateX(-3px);
}

.btn-step.btn-next {
  background: var(--text-heading);
  color: #fff;
  border-color: var(--text-heading);
}

.btn-step.btn-next .arr {
  color: rgba(255, 255, 255, 0.7);
}

.btn-step.btn-next:hover {
  background: #334155;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.btn-step.btn-next:hover .arr {
  transform: translateX(3px);
}

/* ========================================= */
/* Callouts */
/* ========================================= */
.callout {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  border-left: 4px solid var(--border-color);
  background: #f8fafc;
}

.callout.reference {
  border-left-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
}
.callout.reference a {
  color: #047857;
  font-weight: 600;
}

.callout.warning {

  border-left-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}
.callout.warning strong {
  color: #92400e;
}

.callout.info {
  border-left-color: var(--accent);
  background: var(--accent-bg);
  color: #0369a1;
}
.callout.info strong {
  color: #0369a1;
}

/* ========================================= */
/* Code Elements */
/* ========================================= */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background-color: #f1f5f9;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  color: #0f172a;
}

.code-block {
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--code-bg);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background-color: var(--code-header);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', monospace;
}

.code-block pre {
  margin: 0;
  padding: 1.25rem;
  overflow-x: auto;
}

.code-block code {
  background: transparent;
  padding: 0;
  color: var(--code-text);
  font-size: 0.9rem;
}

.copy-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cbd5e1;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ========================================= */
/* Footer */
/* ========================================= */
.docs-footer {
  width: 100%;
  max-width: var(--content-max);
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* ========================================= */
/* Responsive */
/* ========================================= */
@media (max-width: 900px) {
  .docs-sidebar {
    display: none; /* In a real app we'd add a hamburger menu */
  }
  .docs-main {
    margin-left: 0;
    padding: 2rem 1.5rem;
  }
}
