/* ==========================================================================
   ONBOARDING CHECKLIST COMPONENT
   ========================================================================== */

/* Container - Fixed to bottom-right corner */
.checklist-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 900;
  max-width: 360px;
  width: auto;
  
  /* Initial state - hidden below viewport */
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.4s ease-out;
}

/* Visible state */
.checklist-container.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Minimized state - compact pill at bottom right */
.checklist-container.is-minimized {
  max-width: 200px;
  min-width: 240px;
}

.checklist-container.is-minimized .checklist-card {
  border-radius: 50px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12),
              0 0 0 1px rgba(255, 1, 51, 0.12);
  padding: 0 var(--space-2);
  border-color: rgba(255, 1, 51, 0.2);
}

.checklist-container.is-minimized .checklist-header {
  padding: var(--space-3) var(--space-6);
  border-radius: 50px;
  gap: var(--space-3);
}

.checklist-container.is-minimized .checklist-title {
  padding-left: var(--space-1);
}

.checklist-container.is-minimized .checklist-body {
  max-height: 0;
  opacity: 0;
  padding: 0;
  margin-top: 0;
  overflow: hidden;
}

.checklist-container.is-minimized .checklist-progress-bar {
  display: none;
}

.checklist-container.is-minimized .checklist-toggle i {
  transform: rotate(180deg);
}

.checklist-container.is-minimized .checklist-title-text {
  font-size: var(--font-size-sm);
}

.checklist-container.is-minimized .checklist-progress {
  font-size: var(--font-size-xs);
}

.checklist-container.is-minimized .checklist-toggle {
  width: 32px;
  height: 32px;
  margin-left: var(--space-2);
}

/* Main card */
.checklist-card {
  background: var(--color-surface-elevated);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
              0 2px 8px rgba(0, 0, 0, 0.08),
              0 0 0 1px rgba(255, 1, 51, 0.08);
  overflow: hidden;
  border: 1px solid rgba(255, 1, 51, 0.15);
  transition: all 0.3s ease;
}

/* Header */
.checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-elevated);
  border-bottom: 1px solid rgba(255, 1, 51, 0.1);
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
}

.checklist-header:hover {
  background: var(--color-bg-secondary);
}

.checklist-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.checklist-title-text {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

.checklist-progress {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-medium);
}

.checklist-toggle {
  background: transparent;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.checklist-toggle:hover {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  transform: scale(1.05);
}

.checklist-toggle i {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Progress bar */
.checklist-progress-bar {
  height: 3px;
  background: var(--color-border-light);
  overflow: hidden;
}

.checklist-progress-fill {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Body - Task list */
.checklist-body {
  padding: var(--space-3);
  max-height: 400px;
  opacity: 1;
  transition: max-height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease,
              margin-top 0.3s ease;
  margin-top: 0;
}

/* Task item */
.checklist-task {
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--border-radius-sm);
  margin-bottom: var(--space-2);
  overflow: hidden;
  transition: all 0.3s ease;
}

.checklist-task:last-child {
  margin-bottom: 0;
}

.checklist-task:hover {
  border-color: var(--color-primary-light);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Task completed state */
.checklist-task.is-completed {
  opacity: 0.65;
  background: var(--color-bg-secondary);
  border-color: var(--color-border-medium);
}

.checklist-task.is-completed:hover {
  opacity: 0.75;
}

/* Cross-through line animation */
.checklist-task-title {
  position: relative;
  display: inline-block;
}

.checklist-task-title::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 0%;
  height: 2px;
  background: var(--color-text-secondary);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.checklist-task.is-completed .checklist-task-title::after {
  width: 100%;
}

/* Task header (always visible) */
.checklist-task-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  cursor: pointer;
  user-select: none;
}

/* Custom checkbox */
.checklist-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border-medium);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--color-surface-elevated);
}

.checklist-task:hover .checklist-checkbox {
  border-color: var(--color-primary);
}

.checklist-checkbox i {
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: white;
  font-size: var(--font-size-sm);
}

.checklist-task.is-completed .checklist-checkbox {
  background: var(--color-success);
  border-color: var(--color-success);
  transform: scale(1);
}

.checklist-task.is-completed .checklist-checkbox i {
  opacity: 1;
  transform: scale(1);
}

/* Checkbox celebration animation */
@keyframes checkboxPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.checklist-checkbox.celebrating {
  animation: checkboxPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Task content */
.checklist-task-content {
  flex: 1;
  min-width: 0;
}

.checklist-task-title {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  margin-bottom: 0;
}

/* Expand icon */
.checklist-task-expand {
  width: 24px;
  height: 24px;
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.checklist-task-header:hover .checklist-task-expand {
  background: var(--color-bg-tertiary);
  color: var(--color-primary);
}

.checklist-task-expand i {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: var(--font-size-sm);
}

.checklist-task.is-expanded .checklist-task-expand i {
  transform: rotate(180deg);
}

/* Task details (expandable) */
.checklist-task-details {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.3s ease,
              padding 0.3s ease;
  padding: 0 var(--space-3);
}

.checklist-task.is-expanded .checklist-task-details {
  max-height: 200px;
  opacity: 1;
  padding: 0 var(--space-3) var(--space-3) var(--space-3);
}

.checklist-task-description {
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-2);
}

.checklist-task-action {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  justify-content: center;
}

.checklist-task-action:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 1, 51, 0.3);
}

.checklist-task-action:active {
  transform: translateY(0);
}

/* Completion celebration overlay */
@keyframes confettiPop {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.5) rotate(180deg);
    opacity: 0.8;
  }
  100% {
    transform: scale(2) rotate(360deg);
    opacity: 0;
  }
}

.checklist-confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: var(--border-radius-full);
  pointer-events: none;
  animation: confettiPop 0.8s ease-out forwards;
}

/* Final completion animation */
.checklist-container.completing {
  animation: celebrateAndSlideOut 2s ease-in-out forwards;
}

@keyframes celebrateAndSlideOut {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  15% {
    transform: translateY(-10px) scale(1.05);
  }
  30% {
    transform: translateY(0) scale(1);
  }
  70% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(120%) scale(0.9);
    opacity: 0;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .checklist-container {
    bottom: 16px;
    right: 16px;
    max-width: calc(100% - 32px);
  }
  
  .checklist-header {
    padding: var(--space-3) var(--space-4);
  }
  
  .checklist-title-text {
    font-size: var(--font-size-base);
  }
  
  .checklist-body {
    padding: var(--space-2);
  }
  
  .checklist-task-header {
    padding: var(--space-3);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .checklist-container,
  .checklist-body,
  .checklist-task,
  .checklist-task-details,
  .checklist-checkbox,
  .checklist-toggle i,
  .checklist-task-expand i,
  .checklist-progress-fill {
    transition: none;
    animation: none;
  }
  
  .checklist-checkbox.celebrating {
    animation: none;
  }
}

/* Dark mode adjustments */
[data-theme="dark"] .checklist-card {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3),
              0 4px 16px rgba(0, 0, 0, 0.2),
              0 0 0 1px rgba(139, 92, 246, 0.25);
  border: 1px solid rgba(139, 92, 246, 0.3);
  background: linear-gradient(135deg, rgba(45, 27, 78, 0.15) 0%, rgba(30, 30, 33, 0.95) 100%);
}

[data-theme="dark"] .checklist-header {
  border-bottom-color: rgba(139, 92, 246, 0.2);
}

[data-theme="dark"] .checklist-container.is-minimized .checklist-card {
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.15),
              0 0 0 1px rgba(139, 92, 246, 0.25);
}

[data-theme="dark"] .checklist-task {
  background: var(--color-surface-elevated);
  border-color: rgba(139, 92, 246, 0.15);
}

[data-theme="dark"] .checklist-task:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border-color: rgba(139, 92, 246, 0.3);
}

[data-theme="dark"] .checklist-progress-bar {
  background: rgba(139, 92, 246, 0.15);
}

/* Checklist guide highlight animation */
.checklist-guide-highlight {
  position: relative;
  z-index: 10000;
  animation: checklistGuidePulse 2s ease-in-out infinite;
}

@keyframes checklistGuidePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 1, 51, 0.7),
                0 0 0 0 rgba(255, 1, 51, 0.5),
                0 0 20px rgba(255, 1, 51, 0.3);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(255, 1, 51, 0),
                0 0 0 30px rgba(255, 1, 51, 0),
                0 0 40px rgba(255, 1, 51, 0.2);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 1, 51, 0),
                0 0 0 0 rgba(255, 1, 51, 0),
                0 0 20px rgba(255, 1, 51, 0.3);
    transform: scale(1);
  }
}

/* Dark mode guide highlight - use purple */
[data-theme="dark"] .checklist-guide-highlight {
  animation: checklistGuidePulseDark 2s ease-in-out infinite;
}

@keyframes checklistGuidePulseDark {
  0% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.8),
                0 0 0 0 rgba(139, 92, 246, 0.6),
                0 0 25px rgba(139, 92, 246, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(139, 92, 246, 0),
                0 0 0 30px rgba(139, 92, 246, 0),
                0 0 50px rgba(139, 92, 246, 0.3);
    transform: scale(1.05);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0),
                0 0 0 0 rgba(139, 92, 246, 0),
                0 0 25px rgba(139, 92, 246, 0.4);
    transform: scale(1);
  }
}

/* Ensure highlighted button stays on top */
.checklist-guide-highlight::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
}

