/* ============================================
   Tutorial page styles — AI Agent Roadmap
   DataTalks.ru
   ============================================ */

/* Reuse root variables from styles.css */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161f;
  --bg-card-hover: #1c1c28;
  --border: #2a2a3a;
  --border-light: #333348;

  --text-primary: #f0f0f8;
  --text-secondary: #9090b0;
  --text-muted: #60607a;

  --accent: #7c6fff;
  --accent-light: #9d92ff;
  --accent-dim: rgba(124, 111, 255, 0.15);

  --green: #4ade80;
  --blue: #60a5fa;
  --orange: #fb923c;
  --yellow: #fbbf24;
  --red: #f87171;

  --gradient: linear-gradient(135deg, #7c6fff 0%, #a855f7 50%, #ec4899 100%);

  --radius: 12px;
  --radius-sm: 8px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-light); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--text-primary); }

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.02em; }
.logo-brand { color: var(--text-primary); }
.logo-dot { color: var(--accent); }
.header-right { display: flex; align-items: center; gap: 20px; }
.header-right a { color: var(--text-secondary); font-size: 0.88rem; font-weight: 500; }
.header-right a:hover { color: var(--text-primary); }
.btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary) !important;
  font-size: 0.85rem;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: all 0.2s;
}
.btn-back:hover {
  color: var(--text-primary) !important;
  border-color: var(--border-light);
}

/* ============================================
   LAYOUT
   ============================================ */
.page-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 240px 1fr 200px;
  gap: 48px;
  padding-top: 48px;
  padding-bottom: 80px;
  align-items: start;
}

/* ============================================
   SIDEBAR NAV (left)
   ============================================ */
.sidebar-nav {
  position: sticky;
  top: 80px;
  align-self: start;
}
.sidebar-nav-inner {
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.sidebar-nav-inner::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav-inner::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar-nav-inner::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
}
.sidebar-nav-inner::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.15);
}
.sidebar-module-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 0 8px;
}
.sidebar-section {
  margin-bottom: 20px;
}
.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  padding: 6px 8px;
  margin-bottom: 4px;
}
.sidebar-link {
  display: block;
  padding: 7px 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  line-height: 1.4;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}
.sidebar-link:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}
.sidebar-link.active {
  color: var(--accent-light);
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.sidebar-link.current-page {
  color: var(--text-primary);
  font-weight: 600;
  background: rgba(255,255,255,0.04);
  border-left-color: var(--border-light);
}
.sidebar-link.locked {
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.82rem;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.tutorial-content {
  min-width: 0;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-light); }
.breadcrumb-sep { color: var(--border-light); }
.breadcrumb span { color: var(--text-secondary); }

/* Page header */
.tutorial-header {
  margin-bottom: 48px;
}
.tutorial-tag {
  display: inline-block;
  background: var(--accent-dim);
  border: 1px solid rgba(124, 111, 255, 0.3);
  color: var(--accent-light);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.tutorial-title {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}
.tutorial-intro {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 680px;
  margin-bottom: 28px;
}
.tutorial-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}
.meta-item strong { color: var(--text-secondary); }

/* ============================================
   ARTICLE BODY
   ============================================ */
.article-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.article-body h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 56px 0 20px;
  padding-top: 56px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 80px;
}
.article-body h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.article-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 36px 0 14px;
  scroll-margin-top: 80px;
  color: var(--text-primary);
}

.article-body h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--accent-light);
}

.article-body p {
  margin-bottom: 18px;
  color: var(--text-secondary);
}

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

.article-body ul, .article-body ol {
  margin: 0 0 18px 0;
  padding-left: 0;
  list-style: none;
}

.article-body li {
  color: var(--text-secondary);
  padding: 5px 0 5px 24px;
  position: relative;
  font-size: 0.97rem;
}

.article-body ul li::before {
  content: '·';
  position: absolute;
  left: 8px;
  color: var(--accent);
  font-size: 1.2rem;
  line-height: 1.4;
}

.article-body ol {
  counter-reset: ol-counter;
}
.article-body ol li {
  counter-increment: ol-counter;
}
.article-body ol li::before {
  content: counter(ol-counter);
  position: absolute;
  left: 0;
  width: 20px;
  height: 20px;
  background: var(--accent-dim);
  color: var(--accent-light);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  top: 7px;
  line-height: 1;
}

.article-body li strong { color: var(--text-primary); }

/* Inline code */
.article-body code:not(pre code) {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(124, 111, 255, 0.12);
  color: var(--accent-light);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(124, 111, 255, 0.2);
}

/* Code blocks */
.code-block {
  margin: 24px 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0d0d14;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}

.code-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-light);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 4px;
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
  margin-left: 8px;
}
.copy-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

.code-block pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.65;
}

/* highlight.js theme overrides */
.hljs { background: transparent !important; }

/* Callout boxes */
.callout {
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 24px 0;
  border-left: 3px solid;
  font-size: 0.93rem;
  line-height: 1.6;
}
.callout-icon { font-size: 1.1rem; margin-right: 8px; }
.callout-title { font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; }
.callout p { margin-bottom: 0; }
.callout p + p { margin-top: 8px; }

.callout.info { background: rgba(96, 165, 250, 0.08); border-color: var(--blue); }
.callout.info .callout-title { color: var(--blue); }
.callout.warning { background: rgba(251, 191, 36, 0.08); border-color: var(--yellow); }
.callout.warning .callout-title { color: var(--yellow); }
.callout.tip { background: rgba(74, 222, 128, 0.08); border-color: var(--green); }
.callout.tip .callout-title { color: var(--green); }
.callout.danger { background: rgba(248, 113, 113, 0.08); border-color: var(--red); }
.callout.danger .callout-title { color: var(--red); }

/* Comparison table */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.9rem;
}
.compare-table th {
  background: var(--bg-card);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
}
.compare-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: rgba(255,255,255,0.02); }
.compare-table .good { color: var(--green); }
.compare-table .bad { color: var(--red); }

/* Schema diagram */
.diagram {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text-secondary);
  overflow-x: auto;
}
.diagram .hl { color: var(--accent-light); }
.diagram .green { color: var(--green); }
.diagram .orange { color: var(--orange); }
.diagram .blue { color: var(--blue); }
.diagram pre {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  font-size: inherit;
  font-family: inherit;
  color: inherit;
  line-height: inherit;
  white-space: pre;
}

/* Section cards */
.concept-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.summary-card .s-icon { font-size: 1.4rem; margin-bottom: 10px; }
.summary-card h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 6px; }
.summary-card p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }

/* Quiz / check knowledge */
.knowledge-check {
  background: var(--bg-card);
  border: 1px solid rgba(124, 111, 255, 0.3);
  border-radius: var(--radius);
  padding: 24px;
  margin: 40px 0;
}
.knowledge-check h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  margin-bottom: 16px;
}
.knowledge-check ol li {
  color: var(--text-primary);
  margin-bottom: 8px;
}

/* Next steps */
.next-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.next-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all 0.2s;
}
.next-card:hover {
  border-color: rgba(124, 111, 255, 0.4);
  transform: translateY(-2px);
}
.next-card-icon { font-size: 1.4rem; flex-shrink: 0; }
.next-card h4 { font-size: 0.88rem; font-weight: 700; margin-bottom: 4px; }
.next-card p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }

/* ============================================
   TOC (right column)
   ============================================ */
.toc-sidebar,
.toc-nav {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.toc-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 0 8px;
}
.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc-list a {
  display: block;
  padding: 6px 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  line-height: 1.4;
  border-left: 2px solid transparent;
}
.toc-list a:hover { color: var(--text-secondary); background: rgba(255,255,255,0.03); }
.toc-list a.active { color: var(--accent-light); border-left-color: var(--accent); background: var(--accent-dim); }
.toc-list .toc-h3 { padding-left: 18px; font-size: 0.78rem; }

/* Progress bar at top of page */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--gradient);
  z-index: 200;
  transition: width 0.1s linear;
  width: 0%;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  .page-layout { grid-template-columns: 200px 1fr; }
  .toc-sidebar, .toc-nav { display: none; }
}
@media (max-width: 768px) {
  .page-layout { grid-template-columns: 1fr; padding-top: 32px; }
  .sidebar-nav { display: none; }
  .tutorial-title { font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .page-layout { padding: 24px 16px 60px; }
}
