/**
 * StoryTree 新手引导样式
 * 欢迎弹窗、任务清单、空状态引导
 */

/* ===== 欢迎弹窗 ===== */
.st-welcome-overlay {
  position: fixed;
  inset: 0;
  background: var(--st-bg-overlay, rgba(0, 0, 0, 0.5));
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: stWelcomeFadeIn 0.3s ease;
}

@keyframes stWelcomeFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.st-welcome-modal {
  background: var(--st-bg-primary, #fff);
  border-radius: 20px;
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(45, 93, 90, 0.2), 0 8px 24px rgba(0, 0, 0, 0.1);
  animation: stWelcomeSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes stWelcomeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.st-welcome-header {
  text-align: center;
  padding: 2rem 2rem 1rem;
}

.st-welcome-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 16px;
}

.st-welcome-title {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--st-text-primary, #1a1a1a);
  margin: 0 0 0.5rem;
}

.st-welcome-subtitle {
  font-size: 0.9rem;
  color: var(--st-text-secondary, #6b7280);
  line-height: 1.6;
  margin: 0;
}

/* ===== 任务清单 ===== */
.st-task-list {
  padding: 1rem 2rem;
  list-style: none;
  margin: 0;
}

.st-task-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  transition: background 0.2s ease;
  cursor: pointer;
}

.st-task-item:hover {
  background: var(--st-bg-secondary, #f9fafb);
}

.st-task-item.completed {
  opacity: 0.6;
}

.st-task-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  background: #f0f4f3;
  color: #2d5d5a;
  transition: all 0.3s ease;
}

.st-task-item.completed .st-task-icon {
  background: #2d5d5a;
  color: #fff;
}

.st-task-content {
  flex: 1;
}

.st-task-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--st-text-primary, #1a1a1a);
  margin: 0;
}

.st-task-item.completed .st-task-title {
  text-decoration: line-through;
  color: var(--st-text-secondary, #6b7280);
}

.st-task-desc {
  font-size: 0.8rem;
  color: var(--st-text-secondary, #6b7280);
  margin: 2px 0 0;
}

.st-task-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.st-task-item.completed .st-task-check {
  border-color: #2d5d5a;
  background: #2d5d5a;
  color: #fff;
}

/* ===== 欢迎弹窗底部按钮区 ===== */
.st-welcome-footer {
  padding: 1rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.st-welcome-btn-primary {
  width: 100%;
  padding: 0.875rem;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #2d5d5a 0%, #3a7a76 100%);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(45, 93, 90, 0.3);
}

.st-welcome-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(45, 93, 90, 0.4);
}

.st-welcome-btn-secondary {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--st-text-secondary, #6b7280);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.st-welcome-btn-secondary:hover {
  color: #2d5d5a;
  background: #f0f4f3;
}

/* ===== 导航栏任务入口图标 ===== */
.st-onboarding-nav-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  color: var(--st-text-secondary, #6b7280);
  transition: all 0.2s ease;
  font-size: 1.1rem;
  line-height: 1;
}

.st-onboarding-nav-btn:hover {
  background: #f0f4f3;
  color: #2d5d5a;
}

.st-onboarding-nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: stBadgePulse 2s ease-in-out infinite;
}

@keyframes stBadgePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

/* ===== 首页进度卡片 ===== */
.st-progress-card {
  max-width: 720px;
  margin: 1.5rem auto;
  padding: 0;
  border-radius: 16px;
  background: var(--st-bg-primary, #fff);
  border: 1px solid var(--st-gray-100, #f3f4f6);
  box-shadow: 0 4px 16px rgba(45, 93, 90, 0.08);
  overflow: hidden;
  transition: all 0.3s ease;
}

.st-progress-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  cursor: pointer;
}

.st-progress-card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #2d5d5a;
}

.st-progress-card-title i {
  font-size: 1rem;
  color: #f59e0b;
}

.st-progress-card-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--st-text-tertiary, #9ca3af);
  background: var(--st-bg-secondary, #f9fafb);
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
}

.st-progress-card-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 6px;
  color: var(--st-text-tertiary, #9ca3af);
  transition: all 0.2s ease;
  line-height: 1;
}

.st-progress-card-toggle:hover {
  background: var(--st-bg-secondary, #f3f4f6);
  color: var(--st-text-primary, #1a1a1a);
}

.st-progress-card-body {
  padding: 0 1.5rem 1.25rem;
  transition: all 0.3s ease;
}

.st-progress-card--collapsed .st-progress-card-body {
  display: none;
}

.st-progress-bar {
  height: 6px;
  background: var(--st-gray-100, #f3f4f6);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.st-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2d5d5a, #3a9e8f);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.st-progress-tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.st-progress-task {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;
  font-size: 0.85rem;
  color: var(--st-text-secondary, #6b7280);
}

.st-progress-task.completed {
  color: var(--st-text-tertiary, #9ca3af);
  text-decoration: line-through;
}

.st-progress-task-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
}

.st-progress-task.completed .st-progress-task-check {
  border-color: #2d5d5a;
  background: #2d5d5a;
  color: #fff;
}

.st-progress-card-action {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.625rem;
  border: 1px solid var(--st-gray-200, #e5e7eb);
  border-radius: 10px;
  background: transparent;
  color: #2d5d5a;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.st-progress-card-action:hover {
  background: #f0f9f8;
  border-color: #2d5d5a;
}

/* ===== 空状态引导增强 ===== */
.st-empty-guide {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-radius: 16px;
  background: linear-gradient(135deg, #f0f9f8 0%, #e8f5f3 100%);
  border: 1px solid rgba(45, 93, 90, 0.1);
}

.st-empty-guide-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2d5d5a;
  margin: 0 0 0.75rem;
}

.st-empty-guide-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.st-empty-guide-step {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.st-empty-guide-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2d5d5a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.st-empty-guide-step-text {
  font-size: 0.85rem;
  color: var(--st-text-primary, #1a1a1a);
}

.st-empty-guide-cta {
  margin-top: 1rem;
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  background: #2d5d5a;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.st-empty-guide-cta:hover {
  background: #245250;
  transform: translateY(-1px);
}

/* ===== 暗黑模式 ===== */
@media (prefers-color-scheme: dark) {
  .st-welcome-modal {
    background: var(--st-bg-primary, #1f2937);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  }

  .st-welcome-title {
    color: var(--st-text-primary, #f9fafb);
  }

  .st-task-item:hover {
    background: var(--st-bg-secondary, #374151);
  }

  .st-task-icon {
    background: #374151;
    color: #6ee7b7;
  }

  .st-task-item.completed .st-task-icon {
    background: #2d5d5a;
  }

  .st-task-title {
    color: var(--st-text-primary, #f9fafb);
  }

  .st-task-check {
    border-color: #4b5563;
  }

  .st-empty-guide {
    background: linear-gradient(135deg, #1a2e2d 0%, #1f3736 100%);
    border-color: rgba(45, 93, 90, 0.3);
  }

  .st-empty-guide-step {
    background: #1f2937;
  }

  .st-onboarding-nav-btn:hover {
    background: #374151;
    color: #6ee7b7;
  }

  .st-progress-card {
    background: var(--st-bg-primary, #1f2937);
    border-color: #374151;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  }

  .st-progress-card-title {
    color: #6ee7b7;
  }

  .st-progress-card-count {
    background: #374151;
    color: #9ca3af;
  }

  .st-progress-bar {
    background: #374151;
  }

  .st-progress-task-check {
    border-color: #4b5563;
  }

  .st-progress-card-action {
    border-color: #4b5563;
    color: #6ee7b7;
  }

  .st-progress-card-action:hover {
    background: #1a2e2d;
    border-color: #2d5d5a;
  }
}

/* ===== 移动端响应式 ===== */
@media (max-width: 480px) {
  .st-welcome-modal {
    max-width: 100%;
    border-radius: 16px;
    margin: 0.5rem;
  }

  .st-welcome-header {
    padding: 1.5rem 1.5rem 0.75rem;
  }

  .st-welcome-title {
    font-size: 1.25rem;
  }

  .st-task-list {
    padding: 0.75rem 1.5rem;
  }

  .st-task-item {
    padding: 0.625rem 0.75rem;
  }

  .st-welcome-footer {
    padding: 0.75rem 1.5rem 1.5rem;
  }

  .st-empty-guide-steps {
    flex-direction: column;
  }

  .st-progress-card {
    margin: 1rem 0.75rem;
    border-radius: 12px;
  }

  .st-progress-card-header {
    padding: 0.875rem 1rem;
  }

  .st-progress-card-body {
    padding: 0 1rem 1rem;
  }

  .st-progress-tasks {
    grid-template-columns: 1fr;
    gap: 0.375rem;
  }

  .st-progress-task {
    font-size: 0.8rem;
  }
}

/* ===== 下一步提示 Toast ===== */
.st-next-step-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  z-index: 10002;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.st-next-step-toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.st-next-step-content {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--st-bg-primary, #fff);
  border: 1px solid rgba(45, 93, 90, 0.15);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  max-width: 480px;
  min-width: 300px;
}

.st-next-step-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.st-next-step-text strong {
  font-size: 14px;
  color: var(--st-text-primary, #1f2937);
}

.st-next-step-text span {
  font-size: 12px;
  color: var(--st-text-tertiary, #6b7280);
}

.st-next-step-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: linear-gradient(135deg, #2d5d5a 0%, #3a7a76 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.st-next-step-btn:hover {
  background: linear-gradient(135deg, #245250 0%, #2d5d5a 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 93, 90, 0.3);
}

.st-next-step-close {
  background: none;
  border: none;
  color: var(--st-text-tertiary, #9ca3af);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s ease;
}

.st-next-step-close:hover {
  color: var(--st-text-primary, #374151);
}

@media (max-width: 480px) {
  .st-next-step-toast {
    left: 12px;
    right: 12px;
    transform: translateX(0) translateY(100px);
  }

  .st-next-step-toast--visible {
    transform: translateX(0) translateY(0);
  }

  .st-next-step-content {
    min-width: unset;
    max-width: unset;
  }
}

/* ===== 暗黑模式 Toast ===== */
@media (prefers-color-scheme: dark) {
  .st-next-step-content {
    background: #1f2937;
    border-color: rgba(110, 231, 183, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }

  .st-next-step-text strong {
    color: #f9fafb;
  }

  .st-next-step-text span {
    color: #9ca3af;
  }

  .st-next-step-btn {
    background: linear-gradient(135deg, #2d5d5a 0%, #059669 100%);
  }

  .st-next-step-close {
    color: #6b7280;
  }

  .st-next-step-close:hover {
    color: #f9fafb;
  }
}

/* ===== 祝贺完成弹窗 ===== */
.st-celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 10010;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.st-celebration-overlay--visible {
  opacity: 1;
}

.st-celebration-modal {
  background: var(--st-bg-primary, #fff);
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: st-celebration-pop 0.4s ease 0.2s both;
}

@keyframes st-celebration-pop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.st-celebration-icon {
  margin: 0 auto 20px;
  width: 80px;
  height: 80px;
}

.st-celebration-svg {
  width: 100%;
  height: 100%;
}

.st-celebration-circle {
  animation: st-celebration-draw-circle 0.6s ease 0.5s forwards;
}

@keyframes st-celebration-draw-circle {
  to { stroke-dashoffset: 0; }
}

.st-celebration-check {
  animation: st-celebration-draw-check 0.4s ease 1.1s forwards;
}

@keyframes st-celebration-draw-check {
  to { stroke-dashoffset: 0; }
}

.st-celebration-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--st-text-primary, #1f2937);
  margin: 0 0 12px;
}

.st-celebration-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--st-text-secondary, #6b7280);
  margin: 0 0 24px;
}

.st-celebration-btn {
  display: inline-block;
  padding: 12px 28px;
  background: linear-gradient(135deg, #2d5d5a 0%, #059669 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.st-celebration-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45, 93, 90, 0.3);
}

@media (max-width: 480px) {
  .st-celebration-modal {
    padding: 32px 20px;
    border-radius: 16px;
  }

  .st-celebration-title {
    font-size: 19px;
  }

  .st-celebration-desc {
    font-size: 13px;
  }
}

@media (prefers-color-scheme: dark) {
  .st-celebration-modal {
    background: #1f2937;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  }

  .st-celebration-title {
    color: #f9fafb;
  }

  .st-celebration-desc {
    color: #9ca3af;
  }

  .st-celebration-circle,
  .st-celebration-check {
    stroke: #6ee7b7;
  }
}
