/* ========================================
   RotationKit Documentation - Enterprise CSS
   ======================================== */

:root {
  /* Color System */
  --color-primary: #667eea;
  --color-primary-dark: #764ba2;
  --color-navy: #253A55;
  --color-periwinkle: #A6B1E1;
  --color-gold: #E6B44C;

  /* Neutrals */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f5f7fa;
  --color-bg-tertiary: #e8eaed;
  --color-text-primary: #1a1a1a;
  --color-text-secondary: #64748b;
  --color-text-tertiary: #94a3b8;

  /* Code Highlighting */
  --color-code-bg: #1e293b;
  --color-code-text: #e2e8f0;
  --color-inline-code-bg: #f1f5f9;
  --color-inline-code-text: #e11d48;

  /* Borders & Shadows */
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

  /* Layout */
  --sidebar-width: 280px;
  --toc-width: 240px;
  --content-max-width: 800px;
  --header-height: 64px;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg-primary: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-tertiary: #334155;
    --color-text-primary: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-tertiary: #94a3b8;
    --color-inline-code-bg: #1e293b;
    --color-inline-code-text: #fca5a5;
    --border-color: #334155;
  }
}

/* ========================================
   Reset & Base Styles
   ======================================== */

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

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

body {
  font-family: var(--font-sans);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Layout Structure
   ======================================== */

.docs-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr var(--toc-width);
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "header header header"
    "sidebar content toc";
  min-height: 100vh;
  gap: 0;
}

.docs-header {
  grid-area: header;
  background: var(--color-bg-primary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
}

.docs-sidebar {
  grid-area: sidebar;
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  padding: var(--space-6);
}

.docs-content {
  grid-area: content;
  padding: var(--space-8);
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}

.docs-toc {
  grid-area: toc;
  background: var(--color-bg-secondary);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  padding: var(--space-6);
}

/* ========================================
   Header
   ======================================== */

.docs-header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-navy);
  text-decoration: none;
  transition: opacity 0.2s;
}

.docs-header__logo:hover {
  opacity: 0.8;
}

.docs-header__logo svg {
  width: 32px;
  height: 32px;
}

.docs-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.platform-switcher {
  display: flex;
  gap: var(--space-2);
  background: var(--color-bg-secondary);
  padding: var(--space-1);
  border-radius: var(--border-radius);
}

.platform-switcher__btn {
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.platform-switcher__btn:hover {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.platform-switcher__btn--active {
  background: var(--color-primary);
  color: white;
}

.platform-switcher__btn--active:hover {
  background: var(--color-primary-dark);
}

.search-box {
  position: relative;
  width: 300px;
}

.search-box__input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  transition: all 0.2s;
}

.search-box__input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box__icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-tertiary);
  pointer-events: none;
}

.header-cta {
  padding: var(--space-2) var(--space-4);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
  text-decoration: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.header-cta:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ========================================
   Sidebar Navigation
   ======================================== */

.sidebar-section {
  margin-bottom: var(--space-8);
}

.sidebar-section__title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav__item {
  margin-bottom: var(--space-1);
}

.sidebar-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  transition: all 0.2s;
}

.sidebar-nav__link:hover {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.sidebar-nav__link--active {
  background: var(--color-primary);
  color: white;
  font-weight: 500;
}

.sidebar-nav__link--active:hover {
  background: var(--color-primary-dark);
}

.sidebar-nav__icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* Nested navigation */
.sidebar-nav--nested {
  margin-left: var(--space-4);
  margin-top: var(--space-2);
}

/* ========================================
   Table of Contents
   ======================================== */

.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
}

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

.toc-list__item {
  margin-bottom: var(--space-2);
}

.toc-list__link {
  display: block;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.8125rem;
  line-height: 1.5;
  padding-left: var(--space-3);
  border-left: 2px solid transparent;
  transition: all 0.2s;
}

.toc-list__link:hover {
  color: var(--color-primary);
  border-left-color: var(--color-primary);
}

.toc-list__link--active {
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-weight: 500;
}

/* Nested TOC */
.toc-list--nested {
  margin-left: var(--space-3);
  margin-top: var(--space-2);
}

/* ========================================
   Typography
   ======================================== */

.docs-content h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--space-4);
  color: var(--color-navy);
}

.docs-content h2 {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.3;
  margin-top: var(--space-12);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color);
  color: var(--color-text-primary);
}

.docs-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  color: var(--color-text-primary);
}

.docs-content h4 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
  color: var(--color-text-primary);
}

.docs-content p {
  margin-bottom: var(--space-4);
  max-width: 65ch;
  color: var(--color-text-secondary);
}

.docs-content a {
  color: var(--color-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.docs-content a:hover {
  border-bottom-color: var(--color-primary);
}

.docs-content strong {
  font-weight: 600;
  color: var(--color-text-primary);
}

.docs-content ul, .docs-content ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

.docs-content li {
  margin-bottom: var(--space-2);
  color: var(--color-text-secondary);
}

.docs-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: var(--space-12) 0;
}

/* ========================================
   Code Blocks
   ======================================== */

.docs-content code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.docs-content :not(pre) > code {
  background: var(--color-inline-code-bg);
  color: var(--color-inline-code-text);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-weight: 500;
}

.code-block {
  position: relative;
  margin: var(--space-6) 0;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
}

.code-block__language {
  font-size: 0.75rem;
  font-weight: 500;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-block__copy-btn {
  padding: var(--space-1) var(--space-3);
  background: transparent;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 0.75rem;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.code-block__copy-btn:hover {
  background: #1e293b;
  border-color: #475569;
}

.code-block__copy-btn--copied {
  color: #22c55e;
  border-color: #22c55e;
}

.code-block pre {
  margin: 0;
  padding: var(--space-4);
  background: var(--color-code-bg);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.7;
}

.code-block pre code {
  background: none;
  color: var(--color-code-text);
  padding: 0;
}

/* Line numbers */
.code-block--numbered pre {
  counter-reset: line;
}

.code-block--numbered pre code {
  display: block;
}

.code-block--numbered pre code::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 2rem;
  margin-right: var(--space-4);
  color: #475569;
  text-align: right;
  user-select: none;
}

/* ========================================
   Badges & Pills
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.125rem var(--space-2);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge--primary {
  background: #dbeafe;
  color: #1e40af;
}

.badge--success {
  background: #dcfce7;
  color: #166534;
}

.badge--warning {
  background: #fef3c7;
  color: #92400e;
}

.badge--danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge--info {
  background: #e0e7ff;
  color: #3730a3;
}

.badge--gold {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid var(--color-gold);
}

/* ========================================
   Callouts & Alerts
   ======================================== */

.callout {
  padding: var(--space-4);
  border-left: 4px solid;
  border-radius: var(--border-radius);
  margin: var(--space-6) 0;
  background: var(--color-bg-secondary);
}

.callout--info {
  border-left-color: #3b82f6;
  background: #eff6ff;
}

.callout--success {
  border-left-color: #22c55e;
  background: #f0fdf4;
}

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

.callout--danger {
  border-left-color: #ef4444;
  background: #fef2f2;
}

.callout__title {
  font-weight: 600;
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.callout p:last-child {
  margin-bottom: 0;
}

/* ========================================
   Tables
   ======================================== */

.docs-content table {
  width: 100%;
  margin: var(--space-6) 0;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.docs-content thead {
  background: var(--color-bg-secondary);
}

.docs-content th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  color: var(--color-text-primary);
}

.docs-content td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-color);
  color: var(--color-text-secondary);
}

.docs-content tr:hover {
  background: var(--color-bg-secondary);
}

/* ========================================
   Progress Indicator (Quick Start)
   ======================================== */

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-8) 0;
  padding: 0;
  list-style: none;
}

.progress-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

.progress-step::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border-color);
  z-index: -1;
}

.progress-step:last-child::after {
  display: none;
}

.progress-step__number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-bg-secondary);
  border: 2px solid var(--border-color);
  font-weight: 600;
  color: var(--color-text-tertiary);
  transition: all 0.3s;
}

.progress-step--active .progress-step__number {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.progress-step--completed .progress-step__number {
  background: #22c55e;
  border-color: #22c55e;
  color: white;
}

.progress-step__label {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-align: center;
}

.progress-step--active .progress-step__label {
  color: var(--color-primary);
  font-weight: 500;
}

/* ========================================
   Buttons & CTAs
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: white;
}

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

.btn--large {
  padding: var(--space-4) var(--space-8);
  font-size: 1.0625rem;
}

/* ========================================
   Mobile Responsive
   ======================================== */

@media (max-width: 1200px) {
  .docs-container {
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-areas:
      "header header"
      "sidebar content";
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 768px) {
  .docs-container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "content";
  }

  .docs-sidebar {
    display: none;
  }

  .docs-content {
    padding: var(--space-4);
  }

  .search-box {
    width: 200px;
  }

  .platform-switcher {
    position: fixed;
    bottom: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
  }
}

/* ========================================
   Utilities
   ======================================== */

.text-center {
  text-align: center;
}

.mt-8 {
  margin-top: var(--space-8);
}

.mb-8 {
  margin-bottom: var(--space-8);
}

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

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

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
