/* ========================================
   NOXCORE Docs - GitBook Style Theme
   ======================================== */

:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #1a1a1a;
  --bg-hover: #222222;
  
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #6b6b6b;
  
  --accent: #efd898;
  --accent-light: #f5e6b8;
  --accent-dark: #c9b06e;
  
  --border-color: #2d2d2d;
  --border-light: #222222;
  
  --header-height: 60px;
  --sidebar-width: 280px;
  --toc-width: 240px;
  --content-max-width: 860px;
  
  --radius: 6px;
  --transition: 0.15s ease;
}

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

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

a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--text-primary);
}

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

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 200;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 15px;
}

.header-logo img {
  width: 28px;
  height: 28px;
}

.header-logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--bg-primary);
}

.header-logo-img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

/* ========================================
   Home Page
   ======================================== */

.home-page .docs-layout {
  display: none;
}

.home-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 100px 40px 60px;
}

.home-hero {
  text-align: center;
  margin-bottom: 60px;
}

.home-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
}

.home-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.home-hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 60px;
}

.home-grid .nav-category {
  grid-column: 1 / -1;
  padding: 24px 0 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 8px;
}

.home-grid .nav-category:first-child {
  padding-top: 0;
}

.home-grid .nav-category-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.home-grid .nav-group {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}

.home-grid .nav-group:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.home-grid .nav-item {
  padding: 20px;
  border: none;
  font-size: 15px;
  font-weight: 500;
}

.home-grid .nav-item:hover {
  background: var(--bg-tertiary);
}

.home-grid .nav-item-icon {
  font-size: 20px;
  margin-right: 12px;
}

.home-grid .nav-children {
  display: none;
}

.home-grid .nav-arrow {
  color: var(--accent);
}

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

.home-discord h3 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 500;
}

.discord-iframe-wrapper {
  display: flex;
  justify-content: center;
}

.discord-iframe-wrapper iframe {
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

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

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-nav a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.header-nav a:hover {
  color: var(--text-primary);
}

.header-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition);
}

.header-search:hover {
  border-color: var(--text-muted);
}

.header-search svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.header-search span {
  color: var(--text-muted);
  font-size: 13px;
}

.header-search kbd {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: inherit;
}

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

.docs-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-height);
}

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

.sidebar {
  position: fixed;
  left: 200px;
  top: var(--header-height);
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: transparent;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar-header {
  padding: 24px 20px 16px;
}

.sidebar-title {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 20px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* Category Groups */
.nav-category {
  padding: 20px 20px 10px;
}

.nav-category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.nav-category-title svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.nav-group {
  margin-bottom: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 10px 28px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all var(--transition);
  border-left: 2px solid transparent;
  margin-left: 8px;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.current {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-left-color: var(--accent);
}

.nav-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  font-size: 14px;
  vertical-align: middle;
}

.nav-item-content {
  display: flex;
  align-items: center;
  flex: 1;
  line-height: 1;
}

.nav-arrow {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.nav-group.active .nav-arrow {
  transform: rotate(90deg);
}

.nav-children {
  display: none;
}

.nav-children.expanded {
  display: block;
}

.nav-child {
  display: block;
  padding: 8px 20px 8px 52px;
  color: var(--text-muted);
  font-size: 13px;
  transition: all var(--transition);
}

.nav-child:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-child.current {
  color: var(--accent);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  background: transparent;
}

.powered-by {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 12px;
}

.powered-by svg {
  width: 16px;
  height: 16px;
}

/* ========================================
   Main Content
   ======================================== */

.content {
  flex: 1;
  margin-left: calc(200px + var(--sidebar-width) + 60px);
  margin-right: calc(var(--toc-width) + 40px);
  min-height: calc(100vh - var(--header-height));
  padding: 40px 60px 80px;
  background: var(--bg-primary);
  max-width: var(--content-max-width);
}

.markdown-body {
  max-width: var(--content-max-width);
  margin: 0 auto;
}

/* Copy Button */
.copy-button {
  position: absolute;
  top: 40px;
  right: 60px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.copy-button:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.copy-button svg {
  width: 14px;
  height: 14px;
}

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

.markdown-body h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.markdown-body > p:first-of-type {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.markdown-body h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.markdown-body h2:first-child {
  margin-top: 0;
}

.markdown-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--text-primary);
}

.markdown-body h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text-primary);
}

.markdown-body p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
}

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

.markdown-body em {
  font-style: italic;
}

/* Hero Image */
.hero-image {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 40px 0;
}

.hero-image img {
  max-width: 400px;
  height: auto;
}

/* ========================================
   Lists
   ======================================== */

.markdown-body ul,
.markdown-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.markdown-body li {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.markdown-body li::marker {
  color: var(--accent);
}

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

.markdown-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875em;
  padding: 2px 6px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  color: var(--accent);
}

.markdown-body pre {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow-x: auto;
}

.markdown-body pre code {
  padding: 0;
  background: none;
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.6;
}

.markdown-body pre::-webkit-scrollbar {
  height: 8px;
}

.markdown-body pre::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.markdown-body pre::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* ========================================
   Blockquote / Hints
   ======================================== */

.markdown-body blockquote {
  margin: 16px 0;
  padding: 16px 20px;
  background: rgba(79, 209, 197, 0.08);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.markdown-body blockquote p {
  margin: 0;
  color: var(--text-secondary);
}

/* ========================================
   Discord Widget
   ======================================== */

.discord-widget {
  margin: 32px 0;
}

.discord-widget-title {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.discord-card {
  display: inline-flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.discord-card:hover {
  border-color: var(--text-muted);
}

.discord-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.discord-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.discord-icon svg {
  width: 24px;
  height: 24px;
  color: var(--bg-primary);
}

.discord-text {
  display: flex;
  flex-direction: column;
}

.discord-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.discord-members {
  font-size: 12px;
  color: var(--text-muted);
}

.discord-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #5865f2;
  color: white;
  font-weight: 600;
  font-size: 13px;
  height: 100%;
}

.discord-button svg {
  width: 18px;
  height: 18px;
}

.discord-external {
  margin-left: 8px;
  color: var(--accent);
}

/* ========================================
   Navigation Links
   ======================================== */

.page-nav {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: all var(--transition);
  flex: 1;
}

.page-nav-link.prev {
  align-items: flex-start;
}

.page-nav-link.next {
  align-items: flex-end;
  text-align: right;
}

.page-nav-link:hover {
  border-color: var(--accent);
  background: var(--bg-tertiary);
}

.page-nav-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.page-nav-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.page-nav-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

/* Last Updated */
.last-updated {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ========================================
   Table
   ======================================== */

.markdown-body table {
  width: 100%;
  margin-bottom: 16px;
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  padding: 12px 16px;
  text-align: left;
  border: 1px solid var(--border-color);
}

.markdown-body th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-body td {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.markdown-body tr:hover td {
  background: var(--bg-tertiary);
}

/* ========================================
   Links
   ======================================== */

.markdown-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all var(--transition);
}

.markdown-body a:hover {
  color: var(--accent-light);
  border-bottom-color: var(--accent-light);
}

/* ========================================
   Images
   ======================================== */

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 16px 0;
}

/* ========================================
   Horizontal Rule
   ======================================== */

.markdown-body hr {
  margin: 32px 0;
  border: none;
  border-top: 1px solid var(--border-color);
}

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

.toc {
  position: fixed;
  right: 200px;
  top: var(--header-height);
  width: var(--toc-width);
  height: calc(100vh - var(--header-height));
  background: transparent;
  padding: 32px 20px;
  overflow-y: auto;
}

.toc-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

.toc-item {
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 0 6px 12px;
  transition: all var(--transition);
  border-left: 2px solid var(--border-color);
}

.toc-item:hover {
  color: var(--text-primary);
  border-left-color: var(--text-muted);
}

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

.toc-level-3 {
  padding-left: 24px;
  font-size: 12px;
}

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

@media (max-width: 1200px) {
  .toc {
    display: none;
  }
  
  .content {
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .content {
    margin-left: 0;
    padding: 20px;
  }
  
  .markdown-body h1 {
    font-size: 1.75rem;
  }
  
  .markdown-body h2 {
    font-size: 1.25rem;
  }
}

/* ========================================
   Heading Anchors
   ======================================== */

.markdown-body h2[id],
.markdown-body h3[id] {
  scroll-margin-top: 24px;
}

.markdown-body h2[id]:hover::before,
.markdown-body h3[id]:hover::before {
  content: '#';
  position: absolute;
  margin-left: -24px;
  color: var(--accent);
  opacity: 0.5;
}

/* ========================================
   Info Boxes (hint, warning, etc.)
   ======================================== */

.markdown-body .hint {
  margin: 16px 0;
  padding: 16px 20px;
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.markdown-body .hint-info {
  background: rgba(88, 166, 255, 0.1);
  border-left: 4px solid #58a6ff;
}

.markdown-body .hint-success {
  background: rgba(46, 160, 67, 0.1);
  border-left: 4px solid #2ea043;
}

.markdown-body .hint-warning {
  background: rgba(210, 153, 34, 0.1);
  border-left: 4px solid #d29922;
}

.markdown-body .hint-danger {
  background: rgba(248, 81, 73, 0.1);
  border-left: 4px solid #f85149;
}

/* ========================================
   Search Results
   ======================================== */

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-top: 8px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}

.search-results.visible {
  display: block;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
}

.search-result-item:hover {
  background: var(--bg-hover);
}

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

.search-result-title {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-result-path {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========================================
   Search Modal
   ======================================== */

.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 100px;
  z-index: 1000;
}

.search-modal.visible {
  display: flex;
}

.search-modal-content {
  width: 100%;
  max-width: 600px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.search-modal-input {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.search-modal-input svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.search-modal-input input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
}

.search-modal-input input::placeholder {
  color: var(--text-muted);
}

.search-modal-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-modal-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.search-modal-item {
  display: block;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.search-modal-item:hover {
  background: var(--bg-hover);
}

.search-modal-item-title {
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 4px;
}

.search-modal-item-path {
  color: var(--text-muted);
  font-size: 12px;
}

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

@media (max-width: 1400px) {
  .sidebar {
    left: 0;
    background: var(--bg-secondary);
  }
  
  .toc {
    display: none;
  }
  
  .content {
    margin-left: var(--sidebar-width);
    margin-right: 0;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .content {
    margin-left: 0;
    padding: 24px;
  }
  
  .header-nav {
    display: none;
  }
}

@media (max-width: 600px) {
  .header-search span {
    display: none;
  }
  
  .header-search kbd {
    display: none;
  }
  
  .markdown-body h1 {
    font-size: 1.5rem;
  }
}
