/* DataMagik Documentation Styles - Professional Documentation Enhancement */

/* ============================================
   CSS Variables for Documentation Theme
   ============================================ */
:root {
  --docs-primary: #2563eb;
  --docs-primary-dark: #1d4ed8;
  --docs-secondary: #64748b;
  --docs-success: #16a34a;
  --docs-warning: #d97706;
  --docs-danger: #dc2626;
  --docs-info: #0ea5e9;
  --docs-bg-light: #f8fafc;
  --docs-bg-code: #1e293b;
  --docs-border: #e2e8f0;
  --docs-text: #1e293b;
  --docs-text-muted: #64748b;
}

/* ============================================
   Code Block Enhancements
   ============================================ */

/* Code block container */
.docs-code-block {
  position: relative;
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--docs-bg-code);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

/* Code block header with language label */
.docs-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: #0f172a;
  border-bottom: 1px solid #334155;
}

.docs-code-lang {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.docs-code-lang::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

/* Copy button */
.docs-copy-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #94a3b8;
  background: transparent;
  border: 1px solid #475569;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
}

.docs-copy-btn:hover {
  color: #f1f5f9;
  background: #334155;
  border-color: #64748b;
}

.docs-copy-btn.copied {
  color: #22c55e;
  border-color: #22c55e;
}

.docs-copy-btn svg {
  width: 14px;
  height: 14px;
}

/* Code content area */
.docs-code-content {
  overflow-x: auto;
}

.docs-code-content pre {
  margin: 0 !important;
  padding: 1rem !important;
  background: transparent !important;
  border-radius: 0 !important;
}

.docs-code-content code {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
    Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.7;
}

/* Line numbers */
.docs-code-content pre.line-numbers {
  padding-left: 3.5rem !important;
}

.docs-code-content .line-numbers-rows {
  position: absolute;
  left: 0;
  top: 1rem;
  width: 2.5rem;
  text-align: right;
  padding-right: 0.75rem;
  font-size: 0.8rem;
  color: #475569;
  border-right: 1px solid #334155;
  user-select: none;
}

/* Inline code */
.docs-content code:not(pre code) {
  background: #f1f5f9;
  color: #0f172a;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
    Menlo, Monaco, Consolas, monospace;
  font-size: 0.875em;
  font-weight: 500;
  border: 1px solid #e2e8f0;
}

/* ============================================
   Callout Boxes
   ============================================ */

.docs-callout {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  border-left: 4px solid;
}

.docs-callout-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.docs-callout-icon svg {
  width: 20px;
  height: 20px;
}

.docs-callout-content {
  flex: 1;
  min-width: 0;
}

.docs-callout-title {
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  margin-bottom: 0.25rem;
}

.docs-callout-body {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.docs-callout-body p:last-child {
  margin-bottom: 0;
}

/* Callout variants */
.docs-callout-tip {
  background: linear-gradient(to right, #f0fdf4, #ffffff);
  border-color: var(--docs-success);
}

.docs-callout-tip .docs-callout-icon {
  color: var(--docs-success);
}
.docs-callout-tip .docs-callout-title {
  color: #15803d;
}

.docs-callout-warning {
  background: linear-gradient(to right, #fffbeb, #ffffff);
  border-color: var(--docs-warning);
}

.docs-callout-warning .docs-callout-icon {
  color: var(--docs-warning);
}
.docs-callout-warning .docs-callout-title {
  color: #b45309;
}

.docs-callout-danger {
  background: linear-gradient(to right, #fef2f2, #ffffff);
  border-color: var(--docs-danger);
}

.docs-callout-danger .docs-callout-icon {
  color: var(--docs-danger);
}
.docs-callout-danger .docs-callout-title {
  color: #b91c1c;
}

.docs-callout-info {
  background: linear-gradient(to right, #f0f9ff, #ffffff);
  border-color: var(--docs-info);
}

.docs-callout-info .docs-callout-icon {
  color: var(--docs-info);
}
.docs-callout-info .docs-callout-title {
  color: #0369a1;
}

.docs-callout-note {
  background: linear-gradient(to right, #f8fafc, #ffffff);
  border-color: var(--docs-secondary);
}

.docs-callout-note .docs-callout-icon {
  color: var(--docs-secondary);
}
.docs-callout-note .docs-callout-title {
  color: #475569;
}

/* ============================================
   Table of Contents (On This Page)
   ============================================ */

.docs-toc {
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  padding: 1.25rem;
  background: white;
  border-radius: 0.75rem;
  border: 1px solid var(--docs-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.docs-toc::-webkit-scrollbar {
  width: 4px;
}

.docs-toc::-webkit-scrollbar-track {
  background: transparent;
}

.docs-toc::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 2px;
}

.docs-toc-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--docs-text);
  margin-bottom: 0.875rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--docs-border);
}

.docs-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-toc-item {
  margin: 0;
}

.docs-toc-link {
  display: block;
  padding: 0.3125rem 0;
  padding-left: 0.625rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--docs-text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}

.docs-toc-link:hover {
  color: var(--docs-primary);
  border-left-color: #cbd5e1;
}

.docs-toc-link.active {
  color: var(--docs-primary);
  border-left-color: var(--docs-primary);
  font-weight: 600;
}

.docs-toc-link[data-level="3"] {
  padding-left: 1.25rem;
  font-size: 0.75rem;
}

.docs-toc-link[data-level="4"] {
  padding-left: 1.875rem;
  font-size: 0.75rem;
}

/* ============================================
   Tabs Component
   ============================================ */

.docs-tabs {
  margin: 1.5rem 0;
  border: 1px solid var(--docs-border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.docs-tabs-header {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid var(--docs-border);
  overflow-x: auto;
}

.docs-tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--docs-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.docs-tab-btn:hover {
  color: var(--docs-text);
  background: #f1f5f9;
}

.docs-tab-btn.active {
  color: var(--docs-primary);
  border-bottom-color: var(--docs-primary);
  background: white;
}

.docs-tab-content {
  display: none;
  padding: 0;
}

.docs-tab-content.active {
  display: block;
}

.docs-tab-content .docs-code-block {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ============================================
   Collapsible Sections
   ============================================ */

.docs-collapse {
  margin: 1rem 0;
  border: 1px solid var(--docs-border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.docs-collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.docs-collapse-header:hover {
  background: #f1f5f9;
}

.docs-collapse-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--docs-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.docs-collapse-icon {
  width: 20px;
  height: 20px;
  color: var(--docs-text-muted);
  transition: transform 0.2s;
}

.docs-collapse.open .docs-collapse-icon {
  transform: rotate(180deg);
}

.docs-collapse-body {
  display: none;
  padding: 1.25rem;
  border-top: 1px solid var(--docs-border);
}

.docs-collapse.open .docs-collapse-body {
  display: block;
}

/* ============================================
   Prev/Next Navigation
   ============================================ */

.docs-nav-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--docs-border);
}

.docs-nav-link {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: #f8fafc;
  border: 1px solid var(--docs-border);
  border-radius: 0.5rem;
  text-decoration: none;
  transition: all 0.2s;
}

.docs-nav-link:hover {
  background: #f1f5f9;
  border-color: var(--docs-primary);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.docs-nav-link--next {
  text-align: right;
}

.docs-nav-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--docs-text-muted);
  margin-bottom: 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.docs-nav-link--next .docs-nav-label {
  justify-content: flex-end;
}

.docs-nav-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--docs-primary);
}

/* Empty state for single item */
.docs-nav-link--empty {
  visibility: hidden;
}

/* ============================================
   Quick Start Cards Enhancement
   ============================================ */

.docs-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: white;
  border: 1px solid var(--docs-border);
  border-radius: 0.75rem;
  text-decoration: none;
  transition: all 0.2s;
  overflow: hidden;
}

.docs-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--docs-primary), #818cf8);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}

.docs-card:hover {
  border-color: var(--docs-primary);
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.1),
    0 8px 10px -6px rgba(37, 99, 235, 0.05);
  transform: translateY(-2px);
}

.docs-card:hover::before {
  transform: scaleX(1);
}

.docs-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}

.docs-card-icon svg {
  width: 24px;
  height: 24px;
  color: var(--docs-primary);
}

.docs-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--docs-text);
  margin-bottom: 0.5rem;
}

.docs-card-description {
  font-size: 0.9375rem;
  color: var(--docs-text-muted);
  line-height: 1.5;
}

.docs-card-arrow {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--docs-primary);
}

.docs-card-arrow svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.docs-card:hover .docs-card-arrow svg {
  transform: translateX(4px);
}

/* ============================================
   Edit on GitHub Link
   ============================================ */

.docs-edit-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--docs-text-muted);
  text-decoration: none;
  border: 1px solid var(--docs-border);
  border-radius: 0.375rem;
  transition: all 0.2s;
}

.docs-edit-link:hover {
  color: var(--docs-text);
  background: #f8fafc;
  border-color: #cbd5e1;
}

.docs-edit-link svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   Typography Enhancements
   ============================================ */

.docs-content {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--docs-text);
}

.docs-content h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--docs-text);
}

.docs-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--docs-border);
  color: var(--docs-text);
}

.docs-content h2:first-child {
  margin-top: 0;
}

.docs-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--docs-text);
}

.docs-content h4 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--docs-text);
}

/* Anchor links for headings */
.docs-content h2[id],
.docs-content h3[id],
.docs-content h4[id] {
  position: relative;
  scroll-margin-top: 5rem;
}

.docs-content h2[id]:hover .docs-anchor-link,
.docs-content h3[id]:hover .docs-anchor-link,
.docs-content h4[id]:hover .docs-anchor-link {
  opacity: 1;
}

.docs-anchor-link {
  position: absolute;
  left: -1.5rem;
  padding-right: 0.5rem;
  color: var(--docs-text-muted);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.docs-anchor-link:hover {
  color: var(--docs-primary);
}

/* Lists */
.docs-content ul,
.docs-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.docs-content li {
  margin: 0.5rem 0;
}

.docs-content li::marker {
  color: var(--docs-primary);
}

/* Tables */
.docs-content table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.docs-content th,
.docs-content td {
  padding: 0.75rem 1rem;
  text-align: left;
  border: 1px solid var(--docs-border);
}

.docs-content th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--docs-text);
}

.docs-content tr:nth-child(even) {
  background: #fafbfc;
}

/* Blockquotes */
.docs-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-left: 4px solid var(--docs-primary);
  border-radius: 0 0.5rem 0.5rem 0;
  color: var(--docs-text-muted);
  font-style: italic;
}

.docs-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Horizontal rule */
.docs-content hr {
  margin: 3rem 0;
  border: none;
  border-top: 1px solid var(--docs-border);
}

/* ============================================
   Search Enhancement
   ============================================ */

.docs-search {
  position: relative;
}

.docs-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-size: 0.9375rem;
  background: white;
  border: 1px solid var(--docs-border);
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.docs-search-input:focus {
  outline: none;
  border-color: var(--docs-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.docs-search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--docs-text-muted);
  pointer-events: none;
}

.docs-search-kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--docs-text-muted);
  background: #f1f5f9;
  border: 1px solid var(--docs-border);
  border-radius: 0.25rem;
}

/* ============================================
   Sidebar Enhancements
   ============================================ */

.docs-sidebar {
  padding: 1.25rem;
  background: white;
  border-radius: 0.75rem;
  border: 1px solid var(--docs-border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.docs-sidebar-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--docs-text);
  margin-bottom: 0.875rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--docs-border);
}

.docs-sidebar-section {
  margin-bottom: 1.5rem;
}

.docs-sidebar-section:last-child {
  margin-bottom: 0;
}

.docs-sidebar-heading {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--docs-text);
  padding: 0.5rem 0;
  margin-bottom: 0.25rem;
}

.docs-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  margin-left: -0.625rem;
  margin-right: -0.625rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--docs-text-muted);
  text-decoration: none;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
}

.docs-sidebar-link:hover {
  color: var(--docs-primary);
  background: #f1f5f9;
}

.docs-sidebar-link.active {
  color: var(--docs-primary);
  background: #eff6ff;
  font-weight: 600;
}

.docs-sidebar-link--child {
  padding-left: 1rem;
  font-size: 0.75rem;
  border-left: 2px solid #e2e8f0;
  margin-left: 0.375rem;
  border-radius: 0;
}

.docs-sidebar-link--child:hover {
  border-left-color: var(--docs-primary);
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 1024px) {
  .docs-toc {
    display: none;
  }

  .docs-nav-footer {
    grid-template-columns: 1fr;
  }

  .docs-nav-link--next {
    text-align: left;
  }

  .docs-nav-link--next .docs-nav-label {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .docs-content h1 {
    font-size: 1.75rem;
  }

  .docs-content h2 {
    font-size: 1.25rem;
  }

  .docs-content h3 {
    font-size: 1.125rem;
  }

  .docs-code-header {
    padding: 0.375rem 0.75rem;
  }

  .docs-code-content pre {
    padding: 0.75rem !important;
  }

  .docs-callout {
    padding: 0.875rem 1rem;
  }

  .docs-tabs-header {
    overflow-x: auto;
  }

  .docs-tab-btn {
    padding: 0.625rem 1rem;
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .docs-toc,
  .docs-sidebar,
  .docs-nav-footer,
  .docs-copy-btn,
  .docs-edit-link {
    display: none !important;
  }

  .docs-code-block {
    break-inside: avoid;
  }

  .docs-callout {
    break-inside: avoid;
  }
}

/* ============================================
   Syntax Highlighting Override (Prism.js compatible)
   ============================================ */

/* Token colors - One Dark theme inspired */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #5c6370;
}

.token.punctuation {
  color: #abb2bf;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #e06c75;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #98c379;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #56b6c2;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #c678dd;
}

.token.function,
.token.class-name {
  color: #61afef;
}

.token.regex,
.token.important,
.token.variable {
  color: #c678dd;
}

.token.important,
.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}

.token.entity {
  cursor: help;
}

/* ============================================
   Animation Utilities
   ============================================ */

@keyframes docs-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.docs-animate-in {
  animation: docs-fade-in 0.3s ease-out;
}
