/* ============================================================
   The Business Lab — Training Portal Design System
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --gold: #d4af37;
  --gold-light: #e8cc6e;
  --gold-dark: #b8962e;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --green: #16a34a;
  --green-light: #dcfce7;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --red: #dc2626;
  --red-light: #fee2e2;
  --sidebar-width: 280px;
  --toc-width: 200px;
  --content-max: 800px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --transition: .2s ease;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--slate-800);
  background: var(--slate-50);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--slate-900);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: .75rem;
}
h1 { font-size: 2rem; margin-top: 0; }
h2 { font-size: 1.5rem; border-bottom: 2px solid var(--slate-200); padding-bottom: .5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; font-family: var(--font-body); font-weight: 600; }

p { margin-bottom: 1rem; }
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: .35rem; }

code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: .88em;
  background: var(--slate-100);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--slate-700);
}

pre {
  background: var(--slate-900);
  color: var(--slate-200);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: .85rem;
  line-height: 1.6;
}
pre code { background: none; padding: 0; color: inherit; }

/* ---------- Layout Shell ---------- */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--slate-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--white);
}
.sidebar-logo:hover { color: var(--white); }

.sidebar-logo .icon-box {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--white);
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}
.sidebar-logo .logo-text small {
  display: block;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* Sidebar Search */
.sidebar-search {
  padding: 14px 16px 6px;
  flex-shrink: 0;
}
.sidebar-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
  transition: all var(--transition);
}
.sidebar-search input::placeholder { color: rgba(255,255,255,.35); }
.sidebar-search input:focus {
  background: rgba(255,255,255,.1);
  border-color: var(--gold);
}
.sidebar-search-wrap {
  position: relative;
}
.sidebar-search-wrap i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.35);
  font-size: 13px;
  pointer-events: none;
}

/* Sidebar Back Link */
.sidebar-back-link a:hover { color: var(--gold) !important; }

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 10px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }

.nav-module {
  margin-bottom: 2px;
}

.nav-module-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: rgba(255,255,255,.6);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.nav-module-toggle:hover {
  color: var(--white);
  background: rgba(255,255,255,.06);
}
.nav-module-toggle i.module-icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
  flex-shrink: 0;
}
.nav-module-toggle .module-label { flex: 1; }
.nav-module-toggle .chevron {
  font-size: 10px;
  transition: transform .2s;
  color: rgba(255,255,255,.3);
}
.nav-module.open > .nav-module-toggle .chevron {
  transform: rotate(90deg);
}
.nav-module.open > .nav-module-toggle,
.nav-module.active > .nav-module-toggle {
  color: var(--gold);
  background: rgba(212,175,55,.08);
}

.nav-pages {
  display: none;
  padding: 2px 0 6px 42px;
}
.nav-module.open > .nav-pages { display: block; }

.nav-page-link {
  display: block;
  padding: 5px 10px;
  border-radius: 4px;
  color: rgba(255,255,255,.45);
  font-size: 13px;
  text-decoration: none;
  transition: all var(--transition);
  border-left: 2px solid transparent;
}
.nav-page-link:hover {
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.04);
}
.nav-page-link.active {
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(212,175,55,.06);
}

/* Main Area */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 50;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--slate-500);
  flex-wrap: wrap;
}
.breadcrumbs a { color: var(--slate-500); }
.breadcrumbs a:hover { color: var(--gold); }
.breadcrumbs .sep { color: var(--slate-300); }
.breadcrumbs .current { color: var(--slate-800); font-weight: 500; }

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--slate-700);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.hamburger:hover { background: var(--slate-100); }

/* Content Area */
.content-area {
  display: flex;
  flex: 1;
  padding: 0;
}

.page-content {
  flex: 1;
  max-width: var(--content-max);
  padding: 32px 40px 60px;
  min-width: 0;
}

/* Table of Contents (right side) */
.toc {
  width: var(--toc-width);
  flex-shrink: 0;
  padding: 32px 20px 32px 0;
  position: sticky;
  top: 60px;
  align-self: flex-start;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.toc-title {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--slate-400);
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-list li { margin-bottom: 0; }
.toc-list a {
  display: block;
  padding: 4px 0 4px 12px;
  font-size: 12.5px;
  color: var(--slate-500);
  border-left: 2px solid var(--slate-200);
  transition: all var(--transition);
}
.toc-list a:hover {
  color: var(--slate-800);
  border-left-color: var(--slate-400);
}
.toc-list a.active {
  color: var(--gold-dark);
  border-left-color: var(--gold);
  font-weight: 500;
}

/* ---------- Page Header ---------- */
.page-header { margin-bottom: 2rem; }

.module-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(212,175,55,.1);
  color: var(--gold-dark);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.module-badge i { font-size: 11px; }

.page-header h1 {
  font-size: 2rem;
  margin-bottom: .5rem;
}

.page-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--slate-500);
}
.page-meta i { margin-right: 4px; }

/* ---------- Steps ---------- */
.steps {
  list-style: none;
  padding: 0;
  counter-reset: step-counter;
  margin-bottom: 2rem;
}

.steps > li {
  counter-increment: step-counter;
  position: relative;
  padding: 0 0 1.5rem 56px;
  margin-bottom: 0;
  border-left: 2px solid var(--slate-200);
  margin-left: 18px;
}
.steps > li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.steps > li::before {
  content: counter(step-counter);
  position: absolute;
  left: -19px;
  top: 0;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(212,175,55,.35);
}

.step-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  color: var(--slate-900);
  margin-bottom: .35rem;
  margin-top: 4px;
}

.step-desc {
  color: var(--slate-600);
  line-height: 1.7;
}

/* ---------- Callouts ---------- */
.callout {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 14px;
  line-height: 1.65;
  display: flex;
  gap: 12px;
}
.callout i {
  flex-shrink: 0;
  font-size: 16px;
  margin-top: 2px;
}
.callout p { margin: 0; }
.callout p + p { margin-top: .5rem; }

.callout-tip {
  background: var(--green-light);
  border-left: 4px solid var(--green);
  color: #14532d;
}
.callout-tip i { color: var(--green); }

.callout-warning {
  background: var(--amber-light);
  border-left: 4px solid var(--amber);
  color: #78350f;
}
.callout-warning i { color: var(--amber); }

.callout-important {
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  color: #1e3a5f;
}
.callout-important i { color: var(--blue); }

.callout-success {
  background: var(--green-light);
  border-left: 4px solid var(--green);
  color: #14532d;
}
.callout-success i { color: var(--green); }

/* ---------- UI References ---------- */
kbd {
  display: inline-block;
  padding: 2px 7px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-700);
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--slate-300);
}

.ui-element {
  display: inline;
  font-weight: 600;
  color: var(--slate-900);
  background: var(--slate-100);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: .93em;
}

/* ---------- Screenshot ---------- */
.screenshot {
  margin: 1.25rem 0 1.75rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow);
}
.screenshot img {
  width: 100%;
  display: block;
}
.screenshot-caption {
  padding: 8px 14px;
  background: var(--slate-50);
  font-size: 12.5px;
  color: var(--slate-500);
  text-align: center;
  border-top: 1px solid var(--slate-200);
}

/* ---------- Quick Reference Tables ---------- */
.quick-ref {
  margin: 2rem 0;
}
.quick-ref h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 14px;
}
thead th {
  background: var(--slate-800);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: top;
}
tbody tr:hover { background: var(--slate-50); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Prev / Next Navigation ---------- */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--slate-200);
}

.lesson-nav a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  color: var(--slate-700);
  transition: all var(--transition);
  min-width: 0;
  max-width: 48%;
}
.lesson-nav a:hover {
  border-color: var(--gold);
  background: rgba(212,175,55,.04);
  color: var(--slate-900);
}
.lesson-nav a .nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--slate-400);
  font-weight: 600;
}
.lesson-nav a .nav-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lesson-nav a.next { text-align: right; margin-left: auto; }

/* ---------- Home Page ---------- */
.home-hero {
  text-align: center;
  padding: 48px 32px 40px;
  background: linear-gradient(135deg, var(--slate-900), var(--slate-800));
  color: var(--white);
  border-radius: 0 0 var(--radius) var(--radius);
  margin: -32px -40px 32px;
}
.home-hero h1 {
  color: var(--white);
  font-size: 2.2rem;
  margin-bottom: .5rem;
}
.home-hero p {
  color: var(--slate-300);
  font-size: 16px;
  max-width: 520px;
  margin: 0 auto;
}
.home-hero .gold { color: var(--gold); }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 2rem;
}

.module-card {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.module-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}

.module-card .card-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--white);
  margin-bottom: 14px;
}

.module-card .card-number {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--slate-400);
  margin-bottom: 4px;
}

.module-card h3 {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-900);
  margin: 0 0 8px;
}

.module-card p {
  font-size: 13.5px;
  color: var(--slate-500);
  flex: 1;
  margin-bottom: 12px;
}

.module-card .card-meta {
  font-size: 12px;
  color: var(--slate-400);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- Search Page ---------- */
.search-input-wrap {
  position: relative;
  margin-bottom: 2rem;
}
.search-input-wrap input {
  width: 100%;
  padding: 14px 18px 14px 44px;
  font-size: 16px;
  font-family: var(--font-body);
  border: 2px solid var(--slate-200);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition);
}
.search-input-wrap input:focus { border-color: var(--gold); }
.search-input-wrap i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
  font-size: 16px;
}

.search-results { margin-bottom: 2rem; }
.search-result {
  padding: 16px 0;
  border-bottom: 1px solid var(--slate-200);
}
.search-result:last-child { border-bottom: none; }
.search-result h3 {
  font-family: var(--font-body);
  font-size: 16px;
  margin: 0 0 4px;
}
.search-result h3 a { color: var(--slate-900); }
.search-result h3 a:hover { color: var(--gold); }
.search-result .result-path {
  font-size: 12px;
  color: var(--green);
  margin-bottom: 4px;
}
.search-result .result-excerpt {
  font-size: 13.5px;
  color: var(--slate-600);
}
.search-result .result-excerpt mark {
  background: var(--amber-light);
  padding: 0 2px;
  border-radius: 2px;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--slate-500);
}
.no-results i { font-size: 36px; margin-bottom: 12px; color: var(--slate-300); display: block; }

/* ---------- Troubleshooting Section ---------- */
.troubleshooting {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--slate-200);
}
.troubleshooting h2 {
  border-bottom: none;
  padding-bottom: 0;
}

.trouble-item {
  margin-bottom: 1.25rem;
}
.trouble-item strong {
  display: block;
  color: var(--slate-900);
  margin-bottom: .25rem;
}
.trouble-item p {
  margin: 0;
  color: var(--slate-600);
  font-size: 14px;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .toc { display: none; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }

  .main { margin-left: 0; }
  .hamburger { display: block; }

  .page-content {
    padding: 20px 18px 40px;
  }

  .home-hero {
    margin: -20px -18px 24px;
    padding: 32px 18px 28px;
  }
  .home-hero h1 { font-size: 1.6rem; }

  .module-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .lesson-nav { flex-direction: column; }
  .lesson-nav a { max-width: 100%; }

  .topbar { padding: 10px 16px; }
  .breadcrumbs { font-size: 12px; }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.25rem; }

  .steps > li { padding-left: 44px; }

  table { font-size: 13px; }
  thead th, tbody td { padding: 8px 10px; }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .toc, .topbar, .lesson-nav, .hamburger { display: none !important; }
  .main { margin-left: 0 !important; }
  .page-content { max-width: 100%; padding: 0; }
}
