/* ===== TK-TIS Documentation Styles ===== */

/* Reset & Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.6);
  --bg-code: #0c1222;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-blue: #3b82f6;
  --accent-violet: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --gradient-glow: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(139,92,246,0.15));
  --border-subtle: rgba(148, 163, 184, 0.1);
  --border-active: rgba(59, 130, 246, 0.4);
  --radius: 12px;
  --radius-lg: 20px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --sidebar-width: 280px;
  --toc-width: 220px;
  --header-height: 64px;
}

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

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

a { color: var(--accent-blue); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-cyan); }
img { max-width: 100%; display: block; }

/* ===== Header ===== */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

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

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.header-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

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

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

.header-search {
  position: relative;
  width: 260px;
}

.header-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.header-search input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.header-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.header-search-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  pointer-events: none;
}

.header-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}

.header-link:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.08);
}

.header-cta {
  padding: 7px 16px;
  border-radius: 8px;
  background: var(--gradient-primary);
  color: #fff !important;
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.header-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  color: #fff;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

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

/* ===== Sidebar ===== */
.docs-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  padding: 24px 16px;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.sidebar-section {
  margin-bottom: 28px;
}

.sidebar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

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

.sidebar-nav li { margin: 1px 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.sidebar-nav a:hover {
  color: var(--text-primary);
  background: rgba(148, 163, 184, 0.06);
}

.sidebar-nav a.active {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.08);
  font-weight: 600;
}

.sidebar-nav .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav a.active .nav-icon { opacity: 1; }

.sidebar-subnav {
  list-style: none;
  padding-left: 26px;
}

.sidebar-subnav a {
  font-size: 12.5px;
  padding: 5px 12px;
}

/* ===== Main Content ===== */
.docs-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 40px 48px 80px;
  max-width: calc(100% - var(--sidebar-width));
}

.docs-main.has-toc {
  margin-right: var(--toc-width);
  max-width: calc(100% - var(--sidebar-width) - var(--toc-width));
}

.docs-content {
  max-width: 780px;
}

/* ===== Table of Contents ===== */
.docs-toc {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  width: var(--toc-width);
  overflow-y: auto;
  padding: 40px 16px 40px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding-left: 16px;
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  border-left: 1px solid var(--border-subtle);
  padding-left: 0;
}

.toc-list li { margin: 2px 0; }

.toc-list a {
  display: block;
  padding: 4px 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: all 0.15s;
}

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

.toc-list a.active {
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
}

.toc-list .toc-h3 {
  padding-left: 28px;
  font-size: 11.5px;
}

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-size: 13px;
}

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover { color: var(--text-secondary); }

.breadcrumbs .separator {
  color: var(--text-muted);
  opacity: 0.5;
}

.breadcrumbs .current {
  color: var(--text-secondary);
}

/* ===== Typography ===== */
.docs-content h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 16px;
}

.docs-content h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 56px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.docs-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 12px;
}

.docs-content h4 {
  font-size: 15px;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 8px;
}

.docs-content p {
  margin-bottom: 16px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.docs-content .lead {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.7;
}

.docs-content ul, .docs-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.docs-content li {
  margin-bottom: 8px;
  line-height: 1.7;
}

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

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

/* ===== Gradient Text ===== */
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Code Blocks ===== */
.code-block {
  position: relative;
  margin-bottom: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(30, 41, 59, 0.5);
  border-bottom: 1px solid var(--border-subtle);
}

.code-block-lang {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.code-block-copy {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
}

.code-block-copy:hover {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-secondary);
  border-color: rgba(148, 163, 184, 0.2);
}

.code-block-copy.copied {
  color: var(--accent-emerald);
  border-color: rgba(16, 185, 129, 0.3);
}

.code-block pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  background: var(--bg-code);
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
}

/* Inline code */
.docs-content code:not(pre code) {
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--accent-cyan);
}

/* ===== Tables ===== */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

.docs-content thead th {
  text-align: left;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.docs-content thead th:first-child { border-radius: 8px 0 0 0; }
.docs-content thead th:last-child { border-radius: 0 8px 0 0; }

.docs-content tbody td {
  padding: 10px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.docs-content tbody tr:hover {
  background: rgba(148, 163, 184, 0.03);
}

/* ===== Callouts / Alerts ===== */
.callout {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  border-left: 3px solid;
  font-size: 14px;
}

.callout-title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.callout-info {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--accent-blue);
}
.callout-info .callout-title { color: var(--accent-blue); }

.callout-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--accent-amber);
}
.callout-warning .callout-title { color: var(--accent-amber); }

.callout-tip {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--accent-emerald);
}
.callout-tip .callout-title { color: var(--accent-emerald); }

.callout-danger {
  background: rgba(244, 63, 94, 0.08);
  border-color: var(--accent-rose);
}
.callout-danger .callout-title { color: var(--accent-rose); }

.callout p { margin-bottom: 0; color: var(--text-secondary); }

/* ===== Cards Grid ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.doc-card {
  padding: 24px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s;
}

.doc-card:hover {
  border-color: var(--border-active);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.doc-card-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.doc-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.doc-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

/* ===== Prev/Next Navigation ===== */
.docs-nav-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--border-subtle);
}

.docs-nav-link {
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.docs-nav-link:hover {
  border-color: var(--border-active);
  background: rgba(59, 130, 246, 0.04);
  color: inherit;
}

.docs-nav-link.next { text-align: right; }

.docs-nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.docs-nav-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-blue);
}

/* ===== Edit on GitHub ===== */
.edit-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 48px;
  padding: 8px 0;
  transition: color 0.2s;
}

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

/* ===== Search Modal ===== */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  align-items: flex-start;
  justify-content: center;
  padding-top: 120px;
}

.search-overlay.open { display: flex; }

.search-modal {
  width: 560px;
  max-height: 480px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

.search-modal-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-sans);
  outline: none;
}

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

.search-results {
  overflow-y: auto;
  max-height: 380px;
  padding: 8px;
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  transition: background 0.1s;
}

.search-result-item:hover,
.search-result-item.active {
  background: rgba(59, 130, 246, 0.08);
  color: inherit;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

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

.search-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== Feature List ===== */
.feature-list {
  list-style: none;
  padding: 0;
  margin-bottom: 24px;
}

.feature-list li {
  padding: 8px 0;
  padding-left: 28px;
  position: relative;
  color: var(--text-secondary);
}

.feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 6L5 8.5L9.5 4' stroke='%2310b981' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* ===== Badge ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-free {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-pro {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-violet);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-new {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ===== Pricing Table ===== */
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 32px;
}

.pricing-table th {
  padding: 14px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.pricing-table th:first-child { text-align: left; }

.pricing-table th.highlight {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
}

.pricing-table td {
  padding: 10px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
}

.pricing-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text-primary);
}

.pricing-table .check { color: var(--accent-emerald); }
.pricing-table .cross { color: var(--text-muted); opacity: 0.4; }

/* ===== Responsive ===== */
@media (max-width: 1200px) {
  .docs-toc { display: none; }
  .docs-main.has-toc {
    margin-right: 0;
    max-width: calc(100% - var(--sidebar-width));
  }
}

@media (max-width: 900px) {
  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 500;
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .docs-main,
  .docs-main.has-toc {
    margin-left: 0;
    max-width: 100%;
    padding: 32px 24px 80px;
  }

  .sidebar-toggle { display: block; }

  .header-search { width: 180px; }

  .header-link { display: none; }

  .cards-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .docs-main,
  .docs-main.has-toc { padding: 24px 16px 64px; }

  .header-search { width: 140px; }

  .docs-content h1 { font-size: 28px; }
  .docs-content h2 { font-size: 20px; }

  .docs-nav-footer { grid-template-columns: 1fr; }

  .header-cta { display: none; }
}

/* ===== Sidebar Overlay (mobile) ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(0, 0, 0, 0.5);
}

.sidebar-overlay.open { display: block; }

/* ===== Prism Theme Overrides ===== */
code[class*="language-"],
pre[class*="language-"] {
  color: #e2e8f0;
  background: none;
  text-shadow: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: #64748b; }

.token.punctuation { color: #94a3b8; }

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted { color: #f43f5e; }

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted { color: #10b981; }

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string { color: #f59e0b; }

.token.atrule,
.token.attr-value,
.token.keyword { color: #3b82f6; }

.token.function,
.token.class-name { color: #8b5cf6; }

.token.regex,
.token.important,
.token.variable { color: #06b6d4; }
