/* ══════════════════════════════════════════════════
   The Gear — Documentation Site Stylesheet
   Matches main site aesthetic: dark, monochrome, Consolas
   ══════════════════════════════════════════════════ */

:root {
  --bg-color: #080808;
  --bg-sidebar: #0c0c0c;
  --bg-card: rgba(255, 255, 255, 0.02);
  --border-color: rgba(255, 255, 255, 0.06);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.75);
  --text-muted: #8e8e93;
  --accent: rgba(255, 255, 255, 0.9);
  --font-mono: 'Consolas', 'Fira Code', monospace;
  --font-sans: 'Inter', sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Top Header Bar ── */
.doc-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(8, 8, 8, 0.95);
  flex-shrink: 0;
  z-index: 100;
}

.doc-logo {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.doc-logo:hover {
  color: rgba(255, 255, 255, 0.7);
}

.doc-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.doc-version-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  padding: 3px 10px;
  border-radius: 10px;
  letter-spacing: 0.5px;
}

.doc-header-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: 4px;
  background-color: var(--text-primary);
  color: #000000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.doc-header-btn:hover {
  background-color: rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.doc-header-btn svg {
  fill: currentColor;
}

/* ── Layout: 3-Column Grid ── */
.doc-layout {
  display: grid;
  grid-template-columns: 240px 1fr 200px;
  flex-grow: 1;
  overflow: hidden;
}

/* ── Left Sidebar ── */
.doc-sidebar {
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 24px 0;
  overflow-y: auto;
}

.doc-sidebar::-webkit-scrollbar {
  width: 3px;
}

.doc-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.doc-sidebar::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-group {
  padding: 0 16px;
  margin-bottom: 8px;
}

.sidebar-group-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 12px 12px 8px 12px;
  user-select: none;
}

.sidebar-link {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.sidebar-link.active {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-weight: 600;
}

.sidebar-icon {
  font-size: 0.7rem;
  color: var(--text-muted);
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link.active .sidebar-icon {
  color: var(--text-primary);
}

/* ── Main Content Area ── */
.doc-content {
  padding: 48px 56px;
  overflow-y: auto;
}

.doc-content::-webkit-scrollbar {
  width: 4px;
}

.doc-content::-webkit-scrollbar-track {
  background: transparent;
}

.doc-content::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.doc-content::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* ── Page Visibility ── */
.doc-page {
  display: none;
  max-width: 760px;
  animation: docFadeIn 0.3s ease forwards;
}

.doc-page.active {
  display: block;
}

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

/* ── Typography ── */
.doc-page h1 {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.doc-lead {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 32px 0;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.doc-page h2 {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 40px 0 16px 0;
  padding-top: 16px;
  letter-spacing: -0.3px;
}

.doc-page h2:first-of-type {
  margin-top: 0;
}

.doc-page p {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 16px 0;
}

.doc-page ul,
.doc-page ol {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 20px 0;
  padding-left: 24px;
}

.doc-page li {
  margin-bottom: 6px;
}

.doc-page li strong {
  color: var(--text-primary);
}

.doc-page code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 2px 7px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.85);
}

/* ── Code Blocks ── */
.doc-code {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
  background-color: #0d0d0d;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px 22px;
  line-height: 1.75;
  overflow-x: auto;
  margin: 0 0 24px 0;
  white-space: pre;
  tab-size: 4;
}

.doc-code code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.doc-code::-webkit-scrollbar {
  height: 4px;
}

.doc-code::-webkit-scrollbar-track {
  background: transparent;
}

.doc-code::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

/* ── Tables ── */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 24px 0;
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.doc-table thead th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.02);
}

.doc-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: top;
}

.doc-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.doc-table tbody td code {
  font-size: 0.8rem;
}

/* ── Callouts ── */
.doc-callout {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid rgba(255, 255, 255, 0.25);
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 0 0 24px 0;
}

.doc-callout.doc-callout-warning {
  border-left-color: rgba(255, 180, 50, 0.5);
  background-color: rgba(255, 180, 50, 0.03);
}

.doc-callout-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.doc-callout-warning .doc-callout-title {
  color: rgba(255, 180, 50, 0.8);
}

.doc-callout p {
  margin: 0;
  font-size: 0.86rem;
}

/* ── Right Sidebar (Table of Contents) ── */
.doc-toc {
  padding: 48px 16px 24px 16px;
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
  padding-left: 10px;
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 5px 10px;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  line-height: 1.4;
}

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

.toc-link.active {
  color: var(--text-primary);
  border-left-color: var(--text-primary);
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .doc-toc {
    display: none;
  }
  .doc-layout {
    grid-template-columns: 240px 1fr;
  }
}

@media (max-width: 768px) {
  .doc-sidebar {
    display: none;
  }
  .doc-layout {
    grid-template-columns: 1fr;
  }
  .doc-content {
    padding: 32px 20px;
  }
  .doc-page h1 {
    font-size: 1.6rem;
  }
  .doc-search-container {
    margin: 0 12px;
    flex: 1;
  }
  #doc-search-input {
    font-size: 0.75rem;
  }
}

/* ── Search Bar Styling ── */
.doc-search-container {
  position: relative;
  flex: 0 1 320px;
  margin: 0 24px;
}

#doc-search-input {
  width: 100%;
  height: 34px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0 12px;
  padding-right: 36px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  outline: none;
  transition: all 0.2s ease;
}

#doc-search-input:focus {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.doc-search-container::after {
  content: "/";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  pointer-events: none;
}

.doc-search-container:focus-within::after {
  opacity: 0;
}

/* Dropdown */
.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: #0c0c0c;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  display: none;
}

.search-results-dropdown::-webkit-scrollbar {
  width: 4px;
}

.search-results-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.search-results-dropdown.active {
  display: block;
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background 0.15s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.selected {
  background: rgba(255, 255, 255, 0.04);
}

.search-result-page {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.search-result-title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.search-result-snippet {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-snippet mark {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  border-radius: 2px;
  padding: 0 2px;
}

.search-no-results {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ── Coming Soon Sidebar Element ── */
.sidebar-coming-soon {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  user-select: none;
}

.coming-soon-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  display: inline-block;
}

.coming-soon-progress {
  width: 100%;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.coming-soon-progress-bar {
  width: 40%;
  height: 100%;
  background-color: var(--text-primary);
  border-radius: 1px;
  position: absolute;
  left: -40%;
  animation: loadingBar 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

@keyframes loadingBar {
  0% {
    left: -40%;
  }
  50% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

/* ── Bento Grid ── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 32px;
}

.bento-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.bento-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.03), transparent 70%);
  pointer-events: none;
}

.bento-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  background-color: rgba(255, 255, 255, 0.03);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.card-icon {
  font-size: 1.8rem;
  margin-bottom: 16px;
}

.bento-card h3 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.bento-card p {
  font-family: var(--font-mono);
  font-size: 0.8rem !important;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px !important;
  flex-grow: 1;
  border-bottom: none;
  padding-bottom: 0;
}

.bento-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 20px;
  height: 38px;
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  width: fit-content;
}

.bento-btn:hover {
  background-color: var(--text-primary);
  color: #000000;
  border-color: var(--text-primary);
}

/* Upgrade Card spans across two columns */
.card-upgrade {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.01) 0%, rgba(255, 255, 255, 0.03) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-upgrade h3 {
  font-size: 1.35rem;
}

.badge-elite {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: #000000;
  background-color: #ffffff;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  width: fit-content;
  margin-bottom: 12px;
}

.btn-premium {
  background-color: var(--text-primary);
  color: #000000;
  border-color: var(--text-primary);
}

.btn-premium:hover {
  background-color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.85);
  color: #000000;
}

/* Responsive bento grid */
@media (max-width: 650px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .card-upgrade {
    grid-column: span 1;
  }
}
