/* ============================================================
   Training layout — full-height two-column split
   ============================================================ */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.training-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  height: 100vh;
  overflow: hidden;
}

@media (max-width: 860px) {
  html, body { overflow: auto; }
  .training-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .training-sidebar {
    height: auto !important;
    position: static !important;
    border-right: none !important;
    border-bottom: 1px solid var(--pico-muted-border-color);
  }
  .training-main { overflow: visible !important; }
}

/* ============================================================
   Sidebar
   ============================================================ */
.training-sidebar {
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--pico-muted-border-color);
  background: var(--pico-card-sectionning-background-color);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sidebar-logo {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 0.7rem;
  color: var(--pico-muted-color);
  margin-top: 1px;
}

.sidebar-intro {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
  flex-shrink: 0;
}

.sidebar-intro p {
  font-size: 0.79rem;
  color: var(--pico-muted-color);
  line-height: 1.55;
  margin: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0 0;
}

.sidebar-nav-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--pico-muted-color);
  margin: 0 0 0.4rem;
  padding: 0 1.25rem;
}

/* Sidebar accordion sections */
.sidebar-section {
  border-bottom: 1px solid var(--pico-muted-border-color);
  margin: 0;
}

.sidebar-section:last-child { border-bottom: none; }

.sidebar-section > summary {
  padding: 0.75rem 1.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  user-select: none;
  transition: background 0.12s;
}

.sidebar-section > summary:hover {
  background: var(--pico-muted-border-color);
}

.sidebar-section > summary::-webkit-details-marker { display: none; }
.sidebar-section > summary::marker { display: none; content: ''; }
.sidebar-section > summary::before { display: none; content: none; }
.sidebar-section > summary::after {
  content: '›';
  background-image: none;
  margin-left: auto;
  font-size: 1.1rem;
  line-height: 1;
  width: 1em;
  height: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--pico-muted-color);
  transform: rotate(0deg);
  transform-origin: center center;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.sidebar-section[open] > summary::after { transform: rotate(90deg); }

.sidebar-section[open] > summary {
  background: var(--pico-card-background-color);
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.sidebar-section-body {
  padding: 0.75rem 1.25rem 1rem;
  background: var(--pico-card-background-color);
}

.sidebar-section-body p {
  font-size: 0.78rem;
  color: var(--pico-muted-color);
  line-height: 1.55;
  margin: 0 0 0.6rem;
}

.sidebar-section-body p:last-child { margin-bottom: 0; }

.sidebar-section-body code {
  font-size: 0.71rem;
  background: var(--pico-card-sectionning-background-color);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-family: monospace;
}

.sidebar-section-body pre {
  background: var(--pico-card-sectionning-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 5px;
  padding: 0.55rem 0.7rem;
  font-size: 0.67rem;
  overflow-x: auto;
  margin: 0.5rem 0 0.6rem;
  white-space: pre;
  line-height: 1.5;
  font-family: monospace;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--pico-muted-border-color);
  font-size: 0.72rem;
  color: var(--pico-muted-color);
  flex-shrink: 0;
}
.sidebar-footer-links { flex: 1; min-width: 0; }

/* ============================================================
   Main content panel
   ============================================================ */
.training-main {
  height: 100vh;
  overflow-y: auto;
  padding: 1.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
}

.tab-panel {
  flex: 1;
}

/* ============================================================
   Theme toggle
   ============================================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin: 0;
}
.theme-toggle input { margin: 0; }
.theme-icon { font-size: 0.9rem; line-height: 1; }

/* ============================================================
   Tabs
   ============================================================ */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--pico-muted-border-color);
  margin-bottom: 1.75rem;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-top: 1px solid var(--pico-muted-border-color);
  border-right: 1px solid var(--pico-muted-border-color);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.55rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--pico-muted-color);
  cursor: pointer;
  border-radius: 0;
  text-align: center;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:first-child { border-left: 1px solid var(--pico-muted-border-color); }

.tab-btn:hover { color: var(--pico-primary); background: none; }
.tab-btn.active {
  color: var(--pico-primary);
  border-bottom-color: var(--pico-primary);
}

/* Config tab */
.config-code {
  background: var(--pico-card-sectionning-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  padding: 1rem 1.25rem;
  font-size: 0.8rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
.config-code code { background: none; padding: 0; font-size: inherit; }
.json-key  { color: #7c3aed; }
.json-str  { color: #16a34a; }
.json-num  { color: #d97706; }
.json-bool { color: #d97706; }
.json-null { color: #d97706; }
[data-theme="dark"] .json-key  { color: #a78bfa; }
[data-theme="dark"] .json-str  { color: #4ade80; }
[data-theme="dark"] .json-num  { color: #fbbf24; }
[data-theme="dark"] .json-bool { color: #fbbf24; }
[data-theme="dark"] .json-null { color: #fbbf24; }

/* Dashboard iframe */
.dashboard-iframe {
  width: 100%;
  height: calc(100vh - 80px);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 8px;
}

/* ============================================================
   Progress bar
   ============================================================ */
.progress-labels { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--pico-muted-color); margin-bottom: 0.4rem; }
progress { width: 100%; }

/* ============================================================
   Option cards
   ============================================================ */
.options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin: 1.5rem 0; }
@media (max-width: 600px) { .options { grid-template-columns: repeat(2, 1fr); } }

.option-card { border: 2px solid var(--pico-muted-border-color); border-radius: var(--pico-border-radius); padding: 0.75rem 0.5rem; cursor: pointer; transition: border-color 0.15s, background 0.15s; text-align: center; user-select: none; }
.option-card:hover { border-color: var(--pico-primary); }
.option-card.selected { border-color: var(--pico-primary); background: var(--pico-primary-background); }
.option-card .emoji { font-size: 2rem; display: block; margin-bottom: 0.4rem; }
.option-card .label { font-weight: 600; }
.option-card .desc { font-size: 0.8rem; color: var(--pico-muted-color); }
.option-card.selected .label { color: #fff; }
.option-card.selected .desc { color: rgba(255, 255, 255, 0.72); }

/* ============================================================
   Results list
   ============================================================ */
.result-list { list-style: none; padding: 0; }
.result-list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; border-bottom: 1px solid var(--pico-muted-border-color); }
.result-list li:last-child { border-bottom: none; }
.result-list .step-label { color: var(--pico-muted-color); font-size: 0.8rem; min-width: 90px; }
.result-list .step-value { font-weight: 600; }

/* ============================================================
   Start screen
   ============================================================ */
#start-screen { text-align: center; padding: 3rem 1rem; }
#start-screen .pizza-hero { font-size: 5rem; margin-bottom: 1rem; }

/* ============================================================
   Wizard navigation
   ============================================================ */
.btn-row { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

.screen { display: none; }
.screen.active { display: block; }

/* ============================================================
   RUM event log — header & controls
   ============================================================ */
#rum-log-wrap { margin-top: 3rem; border-top: 1px solid var(--pico-muted-border-color); padding-top: 1.25rem; }
#rum-log-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
#rum-log-header h3 { margin: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--pico-muted-color); }
.log-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.filter-btn { font-size: 0.7rem; padding: 2px 8px; border-radius: 3px; cursor: pointer; border: 1px solid transparent; font-weight: 600; opacity: 0.45; transition: opacity 0.15s; }
.filter-btn.active { opacity: 1; }
.filter-btn.view      { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.filter-btn.action    { background: #dcfce7; color: #15803d; border-color: #86efac; }
.filter-btn.resource  { background: #fef9c3; color: #854d0e; border-color: #fde68a; }
.filter-btn.error     { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.filter-btn.long_task { background: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }
#clear-log-btn { font-size: 0.72rem; padding: 2px 10px; }

/* ============================================================
   RUM event log — table
   ============================================================ */
#rum-table-wrap { max-height: 300px; overflow-y: auto; border: 1px solid var(--pico-muted-border-color); border-radius: 6px; }
table#rum-table { width: 100%; border-collapse: collapse; font-size: 0.72rem; font-family: monospace; table-layout: fixed; margin: 0; }
#rum-table thead th { position: sticky; top: 0; background: var(--pico-card-background-color); padding: 5px 8px; text-align: left; font-weight: 700; border-bottom: 1px solid var(--pico-muted-border-color); white-space: nowrap; font-family: monospace; }
#rum-table tbody tr:nth-child(even) { background: var(--pico-card-sectionning-background-color); }
#rum-table td { padding: 4px 8px; vertical-align: top; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#rum-table td.wrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
#rum-empty-row td { text-align: center; color: var(--pico-muted-color); padding: 1.5rem; font-family: sans-serif; }

.type-badge { display: inline-block; font-size: 0.65rem; padding: 1px 5px; border-radius: 3px; font-weight: 700; white-space: nowrap; }
.type-badge.view      { background: #dbeafe; color: #1d4ed8; }
.type-badge.action    { background: #dcfce7; color: #15803d; }
.type-badge.resource  { background: #fef9c3; color: #854d0e; }
.type-badge.error     { background: #fee2e2; color: #991b1b; }
.type-badge.long_task { background: #ede9fe; color: #6d28d9; }
.type-badge.other     { background: #f3f4f6; color: #6b7280; }

/* Column widths */
.col-time { width: 100px; }
.col-type { width: 90px; }
.col-a    { width: 40%; }
.col-b    { width: calc(60% - 190px); }

/* ============================================================
   Sidebar tags & step chips
   ============================================================ */
.sidebar-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 0;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-sizing: border-box;
}
.tag-view   { background: #dbeafe; color: #1d4ed8; }
.tag-action { background: #dcfce7; color: #15803d; }
.tag-metric { background: #fef3c7; color: #92400e; }
.tag-funnel { background: #f3e8ff; color: #6d28d9; }
.tag-slo    { background: #fce7f3; color: #9d174d; }

.sidebar-section-title {
  flex: 1;
  min-width: 0;
}

.sidebar-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0.6rem 0;
  font-size: 0.7rem;
}
.sidebar-steps .step-chip {
  background: var(--pico-card-sectionning-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: monospace;
  font-size: 0.68rem;
}
.sidebar-steps .arrow { color: var(--pico-muted-color); font-size: 0.65rem; }
