/* ============================================================
   Spring AI & RAG Course — shared stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: #1e293b;
  color: #cbd5e1;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid #334155;
}

.sidebar-brand a {
  text-decoration: none;
  color: #f1f5f9;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  display: block;
}

.sidebar-brand span {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: #94a3b8;
  margin-top: 2px;
}

.sidebar-module {
  padding: 12px 16px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}

.sidebar nav a {
  display: block;
  padding: 6px 16px 6px 20px;
  font-size: 0.8rem;
  color: #94a3b8;
  text-decoration: none;
  line-height: 1.4;
  border-left: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.sidebar nav a:hover {
  color: #e2e8f0;
  background: #263548;
  border-left-color: #3b82f6;
}

.sidebar nav a.active {
  color: #ffffff;
  background: #1d3a5f;
  border-left-color: #3b82f6;
  font-weight: 600;
}

.sidebar nav a .topic-num {
  display: inline-block;
  width: 22px;
  font-size: 0.7rem;
  color: #475569;
  font-weight: 500;
}

.sidebar nav a.active .topic-num { color: #93c5fd; }

/* ---------- Content area ---------- */
.content {
  margin-left: 260px;
  flex: 1;
  padding: 40px 48px 80px;
  max-width: calc(260px + 860px);
}

.content-inner {
  max-width: 860px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 20px;
}

.breadcrumb a {
  color: #3b82f6;
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb span { margin: 0 6px; color: #94a3b8; }

/* ---------- Typography ---------- */
h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #1e293b;
  margin: 36px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: #334155;
  margin: 24px 0 8px;
}

p {
  color: #334155;
  line-height: 1.75;
  margin-bottom: 14px;
}

.meta {
  font-size: 0.82rem;
  color: #64748b;
  margin-bottom: 32px;
}

ul, ol {
  margin: 0 0 16px 24px;
  color: #334155;
  line-height: 1.75;
}

li { margin-bottom: 4px; }

strong { color: #1e293b; }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.88rem;
}

th {
  background: #1e293b;
  color: #e2e8f0;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 9px 14px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
}

tr:nth-child(even) td { background: #f8fafc; }

tr:hover td { background: #eff6ff; }

/* ---------- Code blocks ---------- */
.code-block {
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  font-size: 0.78rem;
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: #1d4ed8;
  color: #bfdbfe;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.72rem;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  transition: background 0.15s;
}

.source-link:hover { background: #2563eb; color: #fff; }

.code-block pre {
  padding: 20px;
  overflow-x: auto;
}

.code-block code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  color: #86efac;
  line-height: 1.65;
  white-space: pre;
}

/* Inline code */
p code, li code, td code {
  background: #e2e8f0;
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
}

/* ---------- Concept box ---------- */
.concept-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #3b82f6;
  border-radius: 6px;
  padding: 16px 20px;
  margin: 20px 0;
  color: #1e3a5f;
  font-size: 0.92rem;
  line-height: 1.7;
}

.concept-box strong { color: #1d4ed8; }

/* ---------- Pipeline step ---------- */
.pipeline-step {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-left: 3px solid #3b82f6;
  margin: 12px 0;
  background: #f8fafc;
  border-radius: 0 6px 6px 0;
}

.pipeline-step .step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: #3b82f6;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.pipeline-step .step-body { flex: 1; }

.pipeline-step .step-title {
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 4px;
}

.pipeline-step .step-desc {
  font-size: 0.87rem;
  color: #475569;
  line-height: 1.6;
}

/* ---------- Tip callout ---------- */
.tip {
  background: #f0fdf4;
  border-left: 4px solid #22c55e;
  border-radius: 0 6px 6px 0;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 0.9rem;
  color: #14532d;
  line-height: 1.65;
}

.tip::before {
  content: "Tip  ";
  font-weight: 700;
  color: #16a34a;
}

/* ---------- Warning callout ---------- */
.warning {
  background: #fff7ed;
  border-left: 4px solid #f97316;
  border-radius: 0 6px 6px 0;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 0.9rem;
  color: #7c2d12;
  line-height: 1.65;
}

.warning::before {
  content: "Warning  ";
  font-weight: 700;
  color: #ea580c;
}

/* ---------- External links ---------- */
a[target="_blank"]::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.7;
}

/* ---------- Page navigation ---------- */
.page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: #3b82f6;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s, transform 0.1s;
}

.btn-nav:hover { background: #2563eb; transform: translateY(-1px); }

.btn-nav.disabled {
  background: #e2e8f0;
  color: #94a3b8;
  pointer-events: none;
}

/* ---------- Index page hero ---------- */
.hero {
  background: linear-gradient(135deg, #1e293b 0%, #1d3a5f 100%);
  border-radius: 12px;
  padding: 48px 40px;
  margin-bottom: 40px;
  color: #e2e8f0;
}

.hero h1 {
  color: #fff;
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.hero p {
  color: #94a3b8;
  font-size: 1.05rem;
  max-width: 600px;
  margin-bottom: 24px;
}

.btn-start {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  background: #3b82f6;
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  transition: background 0.15s, transform 0.1s;
}

.btn-start:hover { background: #2563eb; transform: translateY(-2px); }

/* ---------- Prerequisites box ---------- */
.prereq-box {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-left: 4px solid #f59e0b;
  border-radius: 6px;
  padding: 16px 20px;
  margin: 24px 0;
}

.prereq-box h3 {
  color: #92400e;
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.prereq-box ul { margin: 0 0 0 18px; }

.prereq-box li { color: #78350f; font-size: 0.88rem; }

/* ---------- Module section on index ---------- */
.module-section { margin-bottom: 36px; }

.module-header {
  background: #1e293b;
  color: #e2e8f0;
  padding: 10px 16px;
  border-radius: 6px 6px 0 0;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.module-table { width: 100%; border-collapse: collapse; }

.module-table th {
  background: #334155;
  color: #cbd5e1;
  padding: 8px 14px;
  font-size: 0.8rem;
  text-align: left;
}

.module-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.87rem;
}

.module-table td:first-child { color: #64748b; font-weight: 500; width: 36px; }

.module-table td a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.module-table td a:hover { text-decoration: underline; }

.badge-time {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.73rem;
  font-weight: 600;
}

/* ---------- ASCII diagram ---------- */
.ascii-diagram {
  background: #0f172a;
  color: #93c5fd;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 20px 24px;
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  margin: 20px 0;
}

/* ---------- Responsive: collapse sidebar ---------- */
@media (max-width: 768px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 220px;
    overflow-y: scroll;
  }

  .content {
    margin-left: 0;
    padding: 24px 20px 60px;
  }

  body { flex-direction: column; }

  .hero { padding: 32px 24px; }
  .hero h1 { font-size: 1.7rem; }
}
