/**
 * Engagement Prompts & Toast Notification Styles
 *
 * Contextual prompts and achievement notifications
 * that appear at key moments during user interaction.
 */

/* Toast container */
.engagement-toast {
  position: fixed;
  bottom: 100px;  /* Above help bubble */
  right: 20px;
  background: white;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.1);
  max-width: 360px;
  min-width: 280px;
  z-index: 9998;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.engagement-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Celebratory variant (for achievements) */
.engagement-toast.celebratory {
  border: 2px solid #00D9FF;
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  box-shadow:
    0 8px 24px rgba(0, 217, 255, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Close button */
.engagement-toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #999;
  font-size: 18px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.engagement-toast-close:hover {
  background: #f0f0f0;
  color: #333;
}

/* Toast content */
.engagement-toast-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Title (optional) */
.engagement-toast-title {
  font-size: 18px;
  font-weight: 700;
  color: #1565c0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/* Body */
.engagement-toast-body {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.engagement-toast-achievement-icon {
  font-size: 48px;
  line-height: 1;
  flex-shrink: 0;
}

.engagement-toast-message {
  color: #333;
  font-size: 15px;
  line-height: 1.5;
  flex: 1;
}

.engagement-toast-icon {
  font-size: 20px;
  margin-right: 8px;
}

.engagement-toast-description {
  color: #666;
  font-size: 13px;
  margin-top: 4px;
  font-style: italic;
}

/* Buttons */
.engagement-toast-buttons {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.engagement-toast-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  flex: 1;
}

.engagement-toast-btn.primary {
  background: #00D9FF;
  color: white;
}

.engagement-toast-btn.primary:hover {
  background: #00c4e6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 217, 255, 0.3);
}

.engagement-toast-btn:not(.primary) {
  background: transparent;
  color: #666;
  border: 1px solid #ccc;
}

.engagement-toast-btn:not(.primary):hover {
  background: #f5f5f5;
  border-color: #999;
}

/* Animation variants */
@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

/* Confetti effect for achievements (optional enhancement) */
.engagement-toast.celebratory::before {
  content: '✨';
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 24px;
  animation: sparkle 1s ease infinite;
}

@keyframes sparkle {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.2) rotate(180deg);
    opacity: 0.7;
  }
}

/* Progress quick button (optional floating button) */
.progress-quick-btn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1565c0;
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-quick-btn:hover {
  background: #1350a8;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.progress-quick-btn:active {
  transform: scale(0.95);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .engagement-toast {
    left: 50%;
    right: auto;
    bottom: 20px;
    transform: translate(-50%, 20px);
    max-width: calc(100vw - 40px);
    min-width: auto;
  }

  .engagement-toast.show {
    transform: translate(-50%, 0);
  }

  .engagement-toast-content {
    gap: 10px;
  }

  .engagement-toast-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .engagement-toast-achievement-icon {
    font-size: 40px;
  }

  .engagement-toast-buttons {
    flex-direction: column;
    width: 100%;
  }

  .engagement-toast-btn {
    width: 100%;
  }

  .progress-quick-btn {
    bottom: 80px;  /* Above mobile nav if present */
    left: 50%;
    transform: translateX(-50%);
  }

  .progress-quick-btn:hover {
    transform: translateX(-50%) scale(1.1);
  }
}

/* Prevent toast overlap with help bubble */
.help-bubble-wrapper + .engagement-toast {
  bottom: 100px;
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
  .engagement-toast {
    background: #2d2d2d;
    color: #f0f0f0;
    box-shadow:
      0 4px 12px rgba(0, 0, 0, 0.5),
      0 2px 6px rgba(0, 0, 0, 0.3);
  }

  .engagement-toast.celebratory {
    border-color: #00D9FF;
    background: linear-gradient(135deg, #2d2d2d 0%, #1a3a4a 100%);
  }

  .engagement-toast-title {
    color: #00D9FF;
  }

  .engagement-toast-message {
    color: #e0e0e0;
  }

  .engagement-toast-description {
    color: #aaa;
  }

  .engagement-toast-btn:not(.primary) {
    color: #e0e0e0;
    border-color: #555;
  }

  .engagement-toast-btn:not(.primary):hover {
    background: #3a3a3a;
    border-color: #777;
  }

  .engagement-toast-close {
    color: #aaa;
  }

  .engagement-toast-close:hover {
    background: #3a3a3a;
    color: #f0f0f0;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .engagement-toast,
  .engagement-toast.show,
  .engagement-toast-btn,
  .progress-quick-btn {
    transition: none;
    animation: none;
  }

  .engagement-toast.celebratory::before {
    animation: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .engagement-toast {
    border: 2px solid #000;
  }

  .engagement-toast.celebratory {
    border-width: 3px;
  }

  .engagement-toast-btn.primary {
    border: 2px solid #000;
  }
}

/* Print styles (hide toasts) */
@media print {
  .engagement-toast,
  .progress-quick-btn {
    display: none !important;
  }
}
