/* ==========================================================================
   TIS POS Academy V2 — Lesson & Documentation Stylesheet
   Modern Technical Learning Interface • Responsive & Accessible
   ========================================================================== */

/* 1. Documentation Shell Layout */
.doc-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 240px;
  gap: 40px;
  padding-block: 36px 80px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.doc-main-col {
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

@media (max-width: 1200px) {
  .doc-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
  .doc-toc-col {
    display: none;
  }
}

@media (max-width: 900px) {
  .doc-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-block: 20px 60px;
  }
  .doc-sidebar-col {
    display: none;
  }
}

/* 2. Sticky Sidebar */
.doc-sidebar {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-inline-end: 12px;
}

.sidebar-heading {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  margin-bottom: 12px;
}

.sidebar-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}

.sidebar-nav-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.sidebar-nav-item a:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.sidebar-nav-item.active a {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 700;
}

.sidebar-nav-badge {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-subtle);
}

.sidebar-nav-item.active .sidebar-nav-badge {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.sidebar-nav-item.disabled span.sidebar-nav-link-disabled {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-subtle);
  opacity: 0.6;
  cursor: not-allowed;
  user-select: none;
  background: transparent;
}

/* 3. In-Page Table of Contents (TOC) */
.doc-toc {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border-inline-start: 1px solid var(--border-subtle);
  padding-inline-start: 18px;
}

.toc-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-link {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: block;
  line-height: 1.45;
  transition: color var(--transition-fast);
}

.toc-link:hover, .toc-link.active {
  color: var(--primary);
  font-weight: 600;
}

/* 4. Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

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

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

.breadcrumb-separator {
  color: var(--border-main);
  font-size: 0.75rem;
}

.breadcrumb-current {
  color: var(--primary-text);
  font-weight: 600;
}

/* 5. Main Lesson Article Content */
.lesson-article {
  display: flex;
  flex-direction: column;
  gap: 40px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.lesson-article > * {
  min-width: 0;
  max-width: 100%;
}

.lesson-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lesson-meta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lesson-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--primary-subtle);
  color: var(--primary-text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lesson-meta-item {
  font-size: 0.85rem;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
}

.lesson-h1 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

@media (max-width: 768px) {
  .lesson-h1 {
    font-size: 2rem;
  }
}

.lesson-lead {
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--text-muted);
}

/* 6. Callout Boxes */
.callout {
  padding: 20px 24px;
  border-radius: var(--radius-md);
  margin-block: 18px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  line-height: 1.65;
  font-size: 0.95rem;
}

.callout-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
  line-height: 1;
}

.callout-body {
  flex: 1;
}

.callout-title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 1rem;
}

.callout-info {
  background: var(--primary-subtle);
  border-inline-start: 4px solid var(--primary);
  color: var(--text-main);
}
.callout-info .callout-title { color: var(--primary); }

.callout-warning {
  background: var(--accent-subtle);
  border-inline-start: 4px solid var(--accent);
  color: var(--text-main);
}
.callout-warning .callout-title { color: var(--accent-text); }

.callout-audit {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-inline-start: 4px solid #6366f1;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.callout-audit .callout-title { color: #6366f1; }

/* 7. Step Instructional Cards */
.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-block: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.step-card:hover {
  border-color: var(--border-main);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.step-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.step-body {
  font-size: 0.98rem;
  color: var(--text-muted);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.step-body ul, .step-body ol {
  padding-inline-start: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 8. Field Reference Definition Table */
.field-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  contain: paint;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-block: 20px;
  background: var(--bg-card);
}

.field-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.92rem;
  text-align: start;
}

.field-table th {
  background: var(--bg-subtle);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-subtle);
  white-space: nowrap;
}

.field-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  vertical-align: top;
}

.field-table tr:last-child td {
  border-bottom: none;
}

.field-badge-required {
  display: inline-block;
  background: #fee2e2;
  color: #dc2626;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

[data-theme="dark"] .field-badge-required {
  background: rgba(220, 38, 38, 0.2);
  color: #f87171;
}

.field-badge-optional {
  display: inline-block;
  background: var(--bg-subtle);
  color: var(--text-subtle);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* 9. Practical Supermarket Example Card */
.example-box {
  background: var(--bg-card);
  border: 2px solid var(--primary-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-block: 24px;
  position: relative;
}

.example-box-tag {
  position: absolute;
  top: -12px;
  inset-inline-start: 20px;
  background: var(--primary);
  color: #ffffff;
  padding: 2px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.example-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  margin-top: 4px;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 14px;
  background: var(--bg-subtle);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.example-item-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-subtle);
}

.example-item-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

/* 10. Troubleshooting Table */
.troubleshoot-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  contain: paint;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-block: 24px;
  background: var(--bg-card);
}

.troubleshoot-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.92rem;
  text-align: start;
}

.troubleshoot-table th {
  background: var(--bg-subtle);
  padding: 12px 18px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-subtle);
}

.troubleshoot-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
  line-height: 1.6;
}

.troubleshoot-table tr:last-child td {
  border-bottom: none;
}

.troubleshoot-problem {
  font-weight: 700;
  color: var(--text-main);
  width: 38%;
}

.troubleshoot-action {
  color: var(--text-muted);
}

/* 11. Pagination / Prev-Next Bar */
.lesson-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border-subtle);
}

.lesson-nav-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  transition: all var(--transition-fast);
  max-width: 48%;
}

.lesson-nav-card:hover {
  border-color: var(--primary);
  background: var(--bg-subtle);
}

.lesson-nav-dir {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-subtle);
}

.lesson-nav-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
}

@media (max-width: 640px) {
  .lesson-nav-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .lesson-nav-card {
    max-width: 100%;
  }
}

/* 12. Responsive Screenshot Grid */
.lesson-screenshots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-block: 20px;
}

@media (max-width: 640px) {
  .lesson-screenshots-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

