/* 
 * Nikov Tracker - Toast Notification Component
 * Design System: Modern Glassmorphism, Dark Theme, Smooth Animations.
 */

:root {
  --toast-success: #10b981;
  --toast-error: #ef4444;
  --toast-warning: #f59e0b;
  --toast-info: var(--accent2);
  --toast-bg: rgba(15, 15, 20, 0.85);
  --toast-border: rgba(124, 58, 237, 0.25);
  --toast-text: #f8fafc;
  --toast-width: 320px;
  --toast-radius: 14px;
}

#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 999999;
  pointer-events: none; /* Allow clicks to pass through if no toasts */
}

.toast-item {
  width: var(--toast-width);
  max-width: calc(100vw - 48px);
  background: var(--toast-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--toast-border);
  border-radius: var(--toast-radius);
  padding: 14px 18px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.05);
  color: var(--toast-text);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  
  /* Initial State for Animation */
  opacity: 0;
  transform: translateX(40px) scale(0.95);
  transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.toast-item.visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.toast-item.hiding {
  opacity: 0;
  transform: translateY(-10px) scale(0.9);
  pointer-events: none;
}

/* Icon Section */
.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-icon svg {
  width: 100%;
  height: 100%;
}

/* Content Section */
.toast-content {
  flex-grow: 1;
}

.toast-title {
  display: none; /* Keep clean by default, but ready if needed */
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

/* Close Button */
.toast-close {
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Type Specific Styles */
.toast-success { border-left: 4px solid var(--toast-success); }
.toast-success .toast-icon { color: var(--toast-success); }

.toast-error { border-left: 4px solid var(--toast-error); }
.toast-error .toast-icon { color: var(--toast-error); }

.toast-warning { border-left: 4px solid var(--toast-warning); }
.toast-warning .toast-icon { color: var(--toast-warning); }

.toast-info { border-left: 4px solid var(--toast-info); }
.toast-info .toast-icon { color: var(--toast-info); }

/* Progress Bar */
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  transform-origin: left;
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  background: var(--toast-border); /* Matches the primary purple */
  transform: scaleX(1);
}

.toast-success .toast-progress-bar { background: var(--toast-success); }
.toast-error .toast-progress-bar { background: var(--toast-error); }
.toast-warning .toast-progress-bar { background: var(--toast-warning); }
.toast-info .toast-progress-bar { background: var(--toast-info); }

/* Animation for the progress bar */
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #toast-container {
    top: auto;
    bottom: 24px;
    right: 0;
    left: 0;
    align-items: center;
    padding: 0 16px;
  }
  
  .toast-item {
    width: 100%;
    transform: translateY(40px) scale(0.95);
  }
  
  .toast-item.visible {
    transform: translateY(0) scale(1);
  }
}
