/* ========================================
   Onboarding Styles
   ======================================== */

/* ----- Welcome Modal ----- */
.welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.welcome-modal.is-active {
  opacity: 1;
  visibility: visible;
}

.welcome-modal__container {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--clr-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.welcome-modal.is-active .welcome-modal__container {
  transform: translateY(0);
}

.welcome-modal__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: var(--clr-text-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.welcome-modal__close:hover {
  background: var(--clr-base);
  color: var(--clr-text);
}

.welcome-modal__content {
  padding: var(--space-lg);
}

/* Steps */
.welcome-step {
  display: none;
  text-align: center;
}

.welcome-step.is-active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-step__icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  border-radius: 50%;
  font-size: 2.5rem;
  color: #fff;
}

.welcome-step__title {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
  font-weight: var(--font-weight-bold);
  color: var(--clr-text);
}

.welcome-step__description {
  margin: 0 0 var(--space-md);
  color: var(--clr-text-muted);
  line-height: 1.6;
}

/* Features Grid */
.welcome-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.welcome-feature {
  padding: var(--space-sm);
  background: var(--clr-base);
  border-radius: var(--radius-card);
  text-align: center;
}

.welcome-feature__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-surface);
  border-radius: 50%;
  font-size: 1.25rem;
  color: var(--clr-primary);
}

.welcome-feature__label {
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-medium);
  color: var(--clr-text);
}

.welcome-feature__description {
  font-size: 0.75rem;
  color: var(--clr-text-muted);
  margin-top: 4px;
}

/* User Type Selection */
.welcome-types {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.welcome-type {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--clr-base);
  border: 2px solid transparent;
  border-radius: var(--radius-card);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.welcome-type:hover {
  background: var(--clr-surface);
  border-color: var(--clr-primary);
}

.welcome-type.is-selected {
  background: var(--clr-surface);
  border-color: var(--clr-primary);
}

.welcome-type__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-surface);
  border-radius: 50%;
  font-size: 1.125rem;
  color: var(--clr-primary);
}

.welcome-type.is-selected .welcome-type__icon {
  background: var(--clr-primary);
  color: #fff;
}

.welcome-type__content {
  flex: 1;
  text-align: left;
}

.welcome-type__label {
  font-weight: var(--font-weight-medium);
  color: var(--clr-text);
}

.welcome-type__description {
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
}

/* Navigation */
.welcome-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--clr-base);
}

.welcome-indicators {
  display: flex;
  gap: 8px;
}

.welcome-indicator {
  width: 8px;
  height: 8px;
  background: var(--clr-base);
  border-radius: 50%;
  transition: background 0.2s ease;
}

.welcome-indicator.is-active {
  background: var(--clr-primary);
}

.welcome-nav__btn {
  padding: var(--space-xs) var(--space-md);
  background: var(--clr-base);
  border: none;
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-medium);
  color: var(--clr-text);
  cursor: pointer;
  transition: background 0.2s ease;
}

.welcome-nav__btn:hover {
  background: var(--clr-text-muted);
  color: #fff;
}

.welcome-nav__btn--primary {
  background: var(--clr-primary);
  color: #fff;
}

.welcome-nav__btn--primary:hover {
  background: var(--clr-primary);
  filter: brightness(1.1);
}

.welcome-nav__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ----- Tour Overlay ----- */
.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  display: none;
}

.tour-overlay.is-active {
  display: block;
  pointer-events: auto;
}

.tour-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tour-overlay.is-active .tour-backdrop {
  opacity: 1;
}

.tour-highlight {
  position: fixed;
  z-index: 9999;
  box-sizing: border-box;
  box-shadow: 0 0 0 4px var(--clr-primary), 0 0 0 9999px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  pointer-events: none;
  transition: top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease;
  display: none;
}

.tour-tooltip {
  position: fixed;
  z-index: 10000;
  width: 300px;
  max-width: calc(100vw - 32px);
  padding: var(--space-md);
  background: var(--clr-surface);
  border-radius: var(--radius-card);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  pointer-events: auto;
}

.tour-tooltip__arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--clr-surface);
  transform: rotate(45deg);
}

.tour-tooltip[data-position="bottom"] .tour-tooltip__arrow {
  top: -6px;
  left: 50%;
  margin-left: -6px;
}

.tour-tooltip[data-position="top"] .tour-tooltip__arrow {
  bottom: -6px;
  left: 50%;
  margin-left: -6px;
}

.tour-tooltip[data-position="left"] .tour-tooltip__arrow {
  right: -6px;
  top: 50%;
  margin-top: -6px;
}

.tour-tooltip[data-position="right"] .tour-tooltip__arrow {
  left: -6px;
  top: 50%;
  margin-top: -6px;
}

.tour-tooltip__title {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-heading);
  font-size: var(--fs-lg);
  font-weight: var(--font-weight-bold);
  color: var(--clr-text);
}

.tour-tooltip__content {
  margin: 0 0 var(--space-md);
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  line-height: 1.5;
}

.tour-tooltip__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.tour-tooltip__progress {
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
}

.tour-tooltip__buttons {
  display: flex;
  gap: var(--space-xs);
}

.tour-btn {
  padding: 6px 12px;
  background: var(--clr-base);
  border: none;
  border-radius: 6px;
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-medium);
  color: var(--clr-text);
  cursor: pointer;
  transition: background 0.2s ease;
}

.tour-btn:hover {
  background: var(--clr-text-muted);
  color: #fff;
}

.tour-btn--primary {
  background: var(--clr-primary);
  color: #fff;
}

.tour-btn--primary:hover {
  filter: brightness(1.1);
}

.tour-btn--skip {
  background: transparent;
  color: var(--clr-text-muted);
}

.tour-btn--skip:hover {
  background: var(--clr-base);
  color: var(--clr-text);
}

/* ----- Progress Widget ----- */
.onboarding-progress {
  background: var(--clr-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.onboarding-progress__header {
  padding: var(--space-md);
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  color: #fff;
}

.onboarding-progress__title {
  margin: 0 0 var(--space-xs);
  font-family: var(--font-heading);
  font-size: var(--fs-lg);
  font-weight: var(--font-weight-bold);
}

.onboarding-progress__subtitle {
  margin: 0;
  font-size: var(--fs-sm);
  opacity: 0.9;
}

.onboarding-progress__bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  margin-top: var(--space-sm);
  overflow: hidden;
}

.onboarding-progress__fill {
  height: 100%;
  background: #fff;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.onboarding-progress__body {
  padding: var(--space-md);
}

.onboarding-progress__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.onboarding-progress__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}

.onboarding-progress__item + .onboarding-progress__item {
  border-top: 1px solid var(--clr-base);
}

.onboarding-progress__check {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-base);
  border-radius: 50%;
  font-size: 0.75rem;
  color: var(--clr-text-muted);
}

.onboarding-progress__item--completed .onboarding-progress__check {
  background: var(--clr-primary);
  color: #fff;
}

.onboarding-progress__label {
  flex: 1;
  font-size: var(--fs-sm);
  color: var(--clr-text);
}

.onboarding-progress__item--completed .onboarding-progress__label {
  color: var(--clr-text-muted);
  text-decoration: line-through;
}

.onboarding-progress__footer {
  padding: var(--space-sm) var(--space-md);
  background: var(--clr-base);
  text-align: center;
}

.onboarding-progress__percentage {
  font-size: var(--fs-sm);
  font-weight: var(--font-weight-medium);
  color: var(--clr-primary);
}

/* ----- Glossary Tooltip ----- */
.glossary-term {
  border-bottom: 1px dashed var(--clr-primary);
  cursor: help;
  position: relative;
}

.glossary-tooltip {
  position: absolute;
  z-index: 1000;
  width: 280px;
  padding: var(--space-sm) var(--space-md);
  background: var(--clr-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  transform: translateY(5px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.glossary-term:hover .glossary-tooltip,
.glossary-term:focus .glossary-tooltip,
.glossary-tooltip.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.glossary-tooltip__term {
  margin: 0 0 4px;
  font-weight: var(--font-weight-bold);
  color: var(--clr-text);
}

.glossary-tooltip__short {
  margin: 0 0 8px;
  font-size: var(--fs-sm);
  color: var(--clr-primary);
}

.glossary-tooltip__long {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--clr-text-muted);
  line-height: 1.5;
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
  .welcome-modal__content {
    padding: var(--space-md);
  }

  .welcome-features {
    grid-template-columns: 1fr;
  }

  .welcome-step__icon {
    width: 64px;
    height: 64px;
    font-size: 2rem;
  }

  .tour-tooltip {
    width: 260px;
    padding: var(--space-sm);
  }

  .onboarding-progress {
    margin: var(--space-md);
  }
}

/* ----- Dark Mode ----- */
@media (prefers-color-scheme: dark) {
  .welcome-modal {
    background: rgba(0, 0, 0, 0.8);
  }

  .tour-highlight {
    box-shadow: 0 0 0 4px var(--clr-primary), 0 0 0 9999px rgba(0, 0, 0, 0.7);
  }
}
