/**
 * ========================================================
 * Toast Notification Styles
 * ========================================================
 * Visual feedback system for points, badges, streaks,
 * and achievements
 * ========================================================
 */

/* Toast Container */
.toast-container {
  position: fixed;
  top: 80px; /* Below header */
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 320px; /* Reduced from 400px */
  pointer-events: none;
}

/* Individual Toast */
.toast {
  display: flex;
  align-items: center; /* Changed from flex-start for better centering */
  gap: 10px; /* Reduced from 12px */
  background: #fff;
  border-radius: 6px; /* Slightly smaller radius */
  padding: 12px; /* Reduced from 16px */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  max-width: 100%;
  position: relative;
  overflow: hidden;
  min-height: 56px; /* Consistent height */
}

/* Show animation */
.toast.toast-show {
  opacity: 1;
  transform: translateX(0);
}

/* Hide animation */
.toast.toast-hide {
  opacity: 0;
  transform: translateX(120%);
}

/* Toast Icon */
.toast-icon {
  font-size: 20px; /* Reduced from 24px */
  line-height: 1;
  flex-shrink: 0;
  width: 28px; /* Reduced from 32px */
  height: 28px; /* Reduced from 32px */
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
}

/* Toast Content */
.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: 0.9em; /* Reduced from 1em */
  color: #1a202c;
  margin-bottom: 2px; /* Reduced from 4px */
  line-height: 1.3;
}

.toast-message {
  font-size: 0.8em; /* Reduced from 0.9em */
  color: #4a5568;
  line-height: 1.4;
}

/* Close Button */
.toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 20px;
  color: #a0aec0;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
  line-height: 1;
}

.toast-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #4a5568;
}

/* ========================================================
   Type-Specific Styles
   ======================================================== */

/* Points Toast */
.toast-points {
  font-size: 1.2em; /* Reduced from 1.5em */
  font-weight: 700;
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-top: 2px; /* Reduced from 4px */
  animation: pointsPulse 0.6s ease-in-out;
}

@keyframes pointsPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); } /* Reduced from 1.15 */
}

.toast.toast-points {
  border-left: 4px solid #ffd700;
}

.toast.toast-points .toast-icon {
  background: linear-gradient(135deg, #ffd700, #ffed4e);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Badge Toast */
.toast-badge-image {
  width: 48px; /* Reduced from 64px */
  height: 48px; /* Reduced from 64px */
  object-fit: contain;
  margin-top: 4px; /* Reduced from 8px */
  animation: badgeBounce 0.8s cubic-bezier(0.36, 0, 0.66, -0.56);
}

@keyframes badgeBounce {
  0% { transform: scale(0) rotate(-180deg); }
  50% { transform: scale(1.1) rotate(5deg); } /* Reduced rotation */
  100% { transform: scale(1) rotate(0deg); }
}

.toast.toast-badge {
  border-left: 4px solid #48bb78;
}

.toast.toast-badge .toast-icon {
  background: linear-gradient(135deg, #48bb78, #68d391);
  color: #fff;
}

/* Streak Toast */
.toast-streak-count {
  font-size: 1.4em; /* Reduced from 2em */
  font-weight: 700;
  color: #f56565;
  margin-top: 2px; /* Reduced from 4px */
  animation: streakFlame 1s ease-in-out infinite;
}

@keyframes streakFlame {
  0%, 100% { transform: scale(1); filter: hue-rotate(0deg); }
  50% { transform: scale(1.05); filter: hue-rotate(10deg); }
}

.toast.toast-streak {
  border-left: 4px solid #f56565;
  background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
}

.toast.toast-streak .toast-icon {
  background: linear-gradient(135deg, #f56565, #fc8181);
  font-size: 20px;
}

/* Achievement Toast */
.toast.toast-achievement {
  border-left: 4px solid #9f7aea;
}

.toast.toast-achievement .toast-icon {
  background: linear-gradient(135deg, #9f7aea, #b794f4);
  color: #fff;
}

/* Success Toast */
.toast.toast-success {
  border-left: 4px solid #48bb78;
}

.toast.toast-success .toast-icon {
  background: #48bb78;
  color: #fff;
  font-weight: bold;
}

/* Error Toast */
.toast.toast-error {
  border-left: 4px solid #f56565;
}

.toast.toast-error .toast-icon {
  background: #f56565;
  color: #fff;
  font-weight: bold;
}

/* Info Toast */
.toast.toast-info {
  border-left: 4px solid #4299e1;
}

.toast.toast-info .toast-icon {
  background: #4299e1;
  color: #fff;
  font-weight: bold;
}

/* Warning Toast */
.toast.toast-warning {
  border-left: 4px solid #ed8936;
}

.toast.toast-warning .toast-icon {
  background: #ed8936;
  color: #fff;
  font-weight: bold;
}

/* ========================================================
   Dark Mode
   ======================================================== */

@media (prefers-color-scheme: dark) {
  .toast {
    background: #2d3748;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
  }

  .toast-title {
    color: #f7fafc;
  }

  .toast-message {
    color: #cbd5e0;
  }

  .toast-close {
    color: #718096;
  }

  .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
  }

  .toast.toast-streak {
    background: linear-gradient(135deg, #2d3748 0%, #3d2828 100%);
  }
}

/* ========================================================
   Responsive Design
   ======================================================== */

@media (max-width: 768px) {
  .toast-container {
    top: 60px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toast {
    padding: 14px;
  }

  .toast-icon {
    font-size: 20px;
    width: 28px;
    height: 28px;
  }

  .toast-title {
    font-size: 0.95em;
  }

  .toast-message {
    font-size: 0.85em;
  }

  .toast-badge-image {
    width: 48px;
    height: 48px;
  }

  .toast-points {
    font-size: 1.3em;
  }

  .toast-streak-count {
    font-size: 1.5em;
  }
}
