/* TMS User Guide — Custom Styles */
:root {
  --tm-color: #4f46e5;    /* Training Manager: Indigo */
  --ih-color: #0d9488;    /* Institute Head: Teal */
  --tc-color: #d97706;    /* Teacher: Amber */
  --ti-color: #2563eb;    /* Training Institute: Blue */
  --sidebar-w: 260px;
}

/* ── Reset / Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ── Layout ────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #1e293b;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  overflow-y: auto;
  z-index: 50;
  transition: transform .3s ease;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #334155;
}
.sidebar-logo .app-name {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
}
.sidebar-logo .guide-label {
  font-size: .7rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}
.sidebar-role-badge {
  margin: 12px 16px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .78rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: .3px;
}
.sidebar-section-label {
  padding: 16px 20px 6px;
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #64748b;
  font-weight: 600;
}
.sidebar-nav { padding: 4px 10px; list-style: none; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: .85rem;
  color: #94a3b8;
  transition: all .18s;
}
.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.sidebar-nav li a .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: .7;
}
.sidebar-nav li a:hover .nav-icon,
.sidebar-nav li a.active .nav-icon { opacity: 1; }
.sidebar-nav li a .nav-num {
  margin-left: auto;
  font-size: .7rem;
  background: rgba(255,255,255,.1);
  padding: 1px 6px;
  border-radius: 10px;
  color: #94a3b8;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid #334155;
  font-size: .75rem;
  color: #475569;
}
.sidebar-footer a { color: #64748b; }
.sidebar-footer a:hover { color: #94a3b8; }

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

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: #64748b;
}
.breadcrumb a { color: #94a3b8; }
.breadcrumb a:hover { color: #475569; }
.breadcrumb-sep { color: #cbd5e1; }
.breadcrumb-current { color: #1e293b; font-weight: 500; }
.topbar-page-num {
  font-size: .78rem;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 20px;
}

/* ── Page Content ──────────────────────────────────────── */
.page-content { padding: 32px; max-width: 1000px; flex: 1; }

/* ── Page Header ───────────────────────────────────────── */
.page-header {
  margin-bottom: 14px;
}
.page-header .role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 6px;
}
.page-header h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.5px;
  line-height: 1.2;
}
.page-header .subtitle {
  margin-top: 4px;
  font-size: .88rem;
  color: #475569;
  max-width: 680px;
}

/* ── Purpose Box ───────────────────────────────────────── */
.purpose-box {
  border-left: 4px solid currentColor;
  background: #f8fafc;
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin-bottom: 28px;
  font-size: .9rem;
  color: #334155;
}
.purpose-box strong { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px; color: currentColor; }

/* ── Section Card ──────────────────────────────────────── */
.section-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.section-card h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-card h2 svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ── Flowchart ─────────────────────────────────────────── */
.flowchart-wrap {
  background: #f8fafc;
  border-radius: 10px;
  padding: 20px;
  overflow-x: auto;
  text-align: center;
}
.mermaid { font-size: 13px; }

/* ── Screenshot Frame ──────────────────────────────────── */
.screenshot-frame {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  background: #f1f5f9;
  position: relative;
  overflow: hidden;
}
.screenshot-frame img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
.screenshot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: #94a3b8;
  gap: 10px;
}
.screenshot-placeholder svg {
  width: 40px;
  height: 40px;
  opacity: .5;
}
.screenshot-placeholder p {
  font-size: .82rem;
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}
.screenshot-caption {
  margin-top: 12px;
  font-size: .8rem;
  color: #64748b;
  font-style: italic;
}

/* ── Annotation Pins ────────────────────────────────────── */
.annotation-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Steps ──────────────────────────────────────────────── */
.steps-list { list-style: none; counter-reset: step-counter; }
.steps-list li {
  counter-increment: step-counter;
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  align-items: flex-start;
  transition: border-color .15s;
}
.steps-list li:hover { border-color: #cbd5e1; }
.step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
}
.step-body { flex: 1; }
.step-body strong {
  display: block;
  font-size: .9rem;
  color: #0f172a;
  margin-bottom: 3px;
}
.step-body p {
  font-size: .85rem;
  color: #475569;
  line-height: 1.5;
}
.step-body .step-tip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: .78rem;
  color: #64748b;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 4px;
}

/* ── Info / Warning / Tip Boxes ─────────────────────────── */
.alert-box {
  border-radius: 9px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: .87rem;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.alert-box svg { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }
.alert-box.info { background: #eff6ff; color: #1d4ed8; border-left: 4px solid #3b82f6; }
.alert-box.warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.alert-box.success { background: #f0fdf4; color: #166534; border-left: 4px solid #22c55e; }
.alert-box.error { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-box .alert-title { font-weight: 700; margin-bottom: 2px; }

/* ── Field Reference Table ──────────────────────────────── */
.field-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.field-table thead tr { background: #f1f5f9; }
.field-table th { padding: 10px 14px; text-align: left; font-weight: 600; color: #374151; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; }
.field-table td { padding: 10px 14px; border-bottom: 1px solid #e2e8f0; color: #374151; vertical-align: top; }
.field-table tr:last-child td { border-bottom: none; }
.field-table .req { color: #ef4444; font-weight: 700; }
.field-table .opt { color: #10b981; font-weight: 600; }
.badge-small {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 600;
}

/* ── Quick Nav Cards (role overview pages) ──────────────── */
.quick-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 10px;
}
.quick-nav-card {
  padding: 18px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all .18s;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.quick-nav-card:hover {
  border-color: currentColor;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  transform: translateY(-1px);
}
.quick-nav-card .qn-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.quick-nav-card .qn-icon svg { width: 20px; height: 20px; color: #fff; }
.quick-nav-card .qn-title { font-size: .9rem; font-weight: 700; color: #0f172a; }
.quick-nav-card .qn-desc { font-size: .78rem; color: #64748b; line-height: 1.4; }
.quick-nav-card .qn-arrow { margin-top: auto; font-size: .75rem; color: #94a3b8; }

/* ── Stat Cards ─────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 10px;
}
.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 800; }
.stat-card .stat-label { font-size: .78rem; color: #64748b; margin-top: 2px; }
.stat-card .stat-sub { font-size: .72rem; color: #94a3b8; margin-top: 4px; }

/* ── Role-specific color classes ───────────────────────── */
.c-tm { color: var(--tm-color); }
.c-ih { color: var(--ih-color); }
.c-tc { color: var(--tc-color); }
.c-ti { color: var(--ti-color); }
.bg-tm { background: var(--tm-color); }
.bg-ih { background: var(--ih-color); }
.bg-tc { background: var(--tc-color); }
.bg-ti { background: var(--ti-color); }
.border-tm { border-color: var(--tm-color) !important; }
.border-ih { border-color: var(--ih-color) !important; }
.border-tc { border-color: var(--tc-color) !important; }
.border-ti { border-color: var(--ti-color) !important; }
.bg-tm-light { background: #eef2ff; }
.bg-ih-light { background: #f0fdfa; }
.bg-tc-light { background: #fffbeb; }
.bg-ti-light { background: #eff6ff; }

/* ── Print styles ──────────────────────────────────────── */
@media print {
  .sidebar, .topbar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 20px !important; max-width: 100% !important; }
  .section-card { break-inside: avoid; }
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); }
  .sidebar.open { transform: translateX(0); width: 260px; }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .menu-toggle { display: flex !important; }
}
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: none;
  background: #f1f5f9;
  border-radius: 7px;
  cursor: pointer;
  color: #475569;
}
