/* ═══════════════════════════════════════════════════════════════
   tutorial.css — Tutorial system: panel, picker, pill, progress
   ═══════════════════════════════════════════════════════════════ */

/* ── Tutorial Panel (floating bottom-right) ─────────────────── */
.tut-panel {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  width: 380px;
  max-height: 520px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 200ms cubic-bezier(.2,0,.38,.9),
              transform 200ms cubic-bezier(.2,0,.38,.9);
  pointer-events: none;
}
.tut-panel.tut-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── Panel Header ───────────────────────────────────────────── */
.tut-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--blue-60);
  color: #fff;
  min-height: 3rem;
  flex-shrink: 0;
}
.tut-panel-header-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  min-width: 0;
}
.tut-panel-header-left svg {
  flex-shrink: 0;
}
.tut-panel-title {
  font-size: var(--body-md);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tut-panel-header-right {
  display: flex;
  align-items: center;
  gap: 2px;
}
.tut-panel-header-right button {
  background: none;
  border: none;
  color: #fff;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: .8;
  transition: opacity 100ms cubic-bezier(.2,0,.38,.9);
}
.tut-panel-header-right button:hover {
  opacity: 1;
  background: rgba(255,255,255,.12);
}

/* ── Progress Stepper ───────────────────────────────────────── */
.tut-progress {
  display: flex;
  align-items: center;
  gap: var(--spacing-2xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tut-progress-dot {
  width: 8px;
  height: 8px;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background 200ms cubic-bezier(.2,0,.38,.9);
}
.tut-progress-dot.completed {
  background: var(--support-success);
}
.tut-progress-dot.active {
  background: var(--blue-60);
  box-shadow: 0 0 0 2px var(--panel-bg), 0 0 0 4px var(--blue-60);
}
.tut-progress-line {
  flex: 1;
  height: 2px;
  background: var(--border);
}
.tut-progress-line.completed {
  background: var(--support-success);
}
.tut-progress-label {
  font-size: var(--label-sm);
  color: var(--text-secondary);
  margin-left: auto;
  white-space: nowrap;
  padding-left: var(--spacing-xs);
}

/* ── Step Content ───────────────────────────────────────────── */
.tut-step-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md) var(--spacing-lg);
}
.tut-step-title {
  font-size: var(--body-lg);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--spacing-xs) 0;
}
.tut-step-content p {
  font-size: var(--body-md);
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 var(--spacing-sm) 0;
}
.tut-step-content ol {
  margin: 0 0 var(--spacing-sm) 0;
  padding-left: var(--spacing-lg);
}
.tut-step-content ol li {
  font-size: var(--body-md);
  line-height: 1.7;
  color: var(--text);
  margin-bottom: var(--spacing-2xs);
}
.tut-step-content ol li strong {
  color: var(--link-primary);
}
.tut-step-hint {
  font-size: var(--label-md);
  color: var(--text-helper);
  background: var(--field);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-left: 3px solid var(--blue-60);
  margin-top: var(--spacing-sm);
}
.tut-step-content code {
  font-family: var(--digits-font-family);
  font-size: var(--label-md);
  background: var(--field);
  padding: 1px 4px;
}
.tut-step-content pre {
  font-family: var(--digits-font-family);
  font-size: var(--label-md);
  background: var(--field);
  padding: var(--spacing-sm);
  overflow-x: auto;
  line-height: 1.6;
  margin: var(--spacing-xs) 0 var(--spacing-sm) 0;
}

/* Navigate prompt (when user is on wrong page) */
.tut-navigate-prompt {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
}
.tut-navigate-prompt p {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}
.tut-navigate-prompt .tut-navigate-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--spacing-md);
  color: var(--text-helper);
}

/* Step complete checkmark animation */
.tut-step-complete-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2xs);
  background: var(--notification-bg-success);
  color: var(--support-success);
  padding: var(--spacing-2xs) var(--spacing-xs);
  font-size: var(--label-md);
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  animation: tut-fade-in 200ms cubic-bezier(.2,0,.38,.9);
}
@keyframes tut-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Panel Footer ───────────────────────────────────────────── */
.tut-panel-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Tutorial buttons */
.tut-btn {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: var(--body-md);
  font-weight: 500;
  height: 2rem;
  padding: 0 var(--spacing-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2xs);
  transition: background 100ms cubic-bezier(.2,0,.38,.9);
}
.tut-btn--primary {
  background: var(--btn-primary);
  color: #fff;
}
.tut-btn--primary:hover {
  background: var(--btn-primary-hover);
}
.tut-btn--ghost {
  background: none;
  color: var(--link-primary);
}
.tut-btn--ghost:hover {
  background: var(--hover-bg);
}
.tut-btn--secondary {
  background: var(--btn-secondary);
  color: #fff;
}
.tut-btn--secondary:hover {
  background: var(--btn-secondary-hover);
}
.tut-btn svg {
  width: 14px;
  height: 14px;
}

/* ── Minimized Pill ─────────────────────────────────────────── */
.tut-pill {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  height: 2.5rem;
  background: var(--blue-60);
  color: #fff;
  padding: 0 var(--spacing-md) 0 var(--spacing-sm);
  border: none;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  cursor: pointer;
  z-index: 900;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: var(--body-sm);
  font-weight: 500;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 200ms cubic-bezier(.2,0,.38,.9),
              transform 200ms cubic-bezier(.2,0,.38,.9),
              background 100ms cubic-bezier(.2,0,.38,.9);
  pointer-events: none;
}
.tut-pill.tut-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.tut-pill:hover {
  background: var(--blue-70);
}
.tut-pill svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Tutorial Picker (dropdown from sidenav) ────────────────── */
.tut-picker {
  position: fixed;
  z-index: 200;
  width: 340px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.16);
  padding: var(--spacing-xs) 0;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 200ms cubic-bezier(.2,0,.38,.9),
              transform 200ms cubic-bezier(.2,0,.38,.9);
  pointer-events: none;
}
.tut-picker.tut-visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
.tut-picker-title {
  font-size: var(--label-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-secondary);
  padding: var(--spacing-xs) var(--spacing-md) var(--spacing-2xs);
}
.tut-picker-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  transition: background 100ms cubic-bezier(.2,0,.38,.9);
}
.tut-picker-item:hover {
  background: var(--hover-bg);
}
.tut-picker-item-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--blue-10);
  color: var(--blue-60);
}
html.dark .tut-picker-item-icon {
  background: rgba(69,137,255,.15);
  color: var(--blue-40);
}
.tut-picker-item-content {
  flex: 1;
  min-width: 0;
}
.tut-picker-item-title {
  display: block;
  font-size: var(--body-md);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.tut-picker-item-desc {
  display: block;
  font-size: var(--label-md);
  color: var(--text-secondary);
  line-height: 1.4;
}
.tut-picker-item-badge {
  font-size: var(--label-sm);
  font-weight: 600;
  padding: 2px 6px;
  flex-shrink: 0;
  align-self: center;
}
.tut-picker-item-badge.in-progress {
  background: var(--blue-10);
  color: var(--blue-60);
}
html.dark .tut-picker-item-badge.in-progress {
  background: rgba(69,137,255,.15);
  color: var(--blue-40);
}
.tut-picker-item-badge.done {
  background: var(--notification-bg-success);
  color: var(--support-success);
}

/* ── Completion Screen ──────────────────────────────────────── */
.tut-complete {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-lg);
}
.tut-complete-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--spacing-md);
  color: var(--support-success);
}
.tut-complete-icon svg {
  width: 48px;
  height: 48px;
}
.tut-complete-title {
  font-size: var(--heading-md);
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--spacing-xs) 0;
}
.tut-complete-desc {
  font-size: var(--body-md);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 var(--spacing-lg) 0;
}

/* ── API Reference Block (inside steps) ────────────────────── */
.tut-step-api {
  margin-top: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--gray-10);
  border-left: 3px solid var(--blue-60);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text-secondary);
}
.tut-step-api code {
  font-family: var(--digits-font-family);
  font-size: 0.6875rem;
  background: var(--gray-20);
  padding: 1px 4px;
  color: var(--text);
}
.tut-api-label {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-60);
  margin-right: var(--spacing-xs);
  vertical-align: middle;
}
html.dark .tut-step-api {
  background: var(--gray-90);
}
html.dark .tut-step-api code {
  background: var(--gray-80);
}
html.dark .tut-api-label {
  color: var(--blue-40);
}

/* ── Element Highlight Pulse ────────────────────────────────── */
.tut-highlight-pulse {
  position: relative;
}
.tut-highlight-pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 2px solid var(--blue-60);
  pointer-events: none;
  animation: tut-border-pulse 2s cubic-bezier(.2,0,.38,.9) infinite;
  z-index: 1;
}
@keyframes tut-border-pulse {
  0%, 100% { opacity: .25; }
  50%      { opacity: 1; }
}
html.dark .tut-highlight-pulse::after {
  border-color: var(--blue-40);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .tut-panel {
    left: var(--spacing-xs);
    right: var(--spacing-xs);
    bottom: var(--spacing-xs);
    width: auto;
    max-height: 60vh;
  }
  .tut-pill {
    right: var(--spacing-xs);
    bottom: var(--spacing-xs);
  }
  .tut-picker {
    width: 280px;
  }
}
