/**
 * Console Maven - Toast Notification Styles
 * Non-blocking notifications to replace alert()
 */

/* Toast Container */
#cm-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* Hide scrollbar but keep functionality */
#cm-toast-container::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Toast Base */
.cm-toast {
  background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
  border-radius: 8px;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.2),
    0 4px 6px -2px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  min-width: 320px;
  max-width: 420px;
  pointer-events: all;
  animation: cm-toast-slide-in 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
  overflow: hidden;
}

@keyframes cm-toast-slide-in {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Toast dismissing animation */
.cm-toast-dismissing {
  animation: cm-toast-slide-out 0.3s ease forwards;
}

@keyframes cm-toast-slide-out {
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* Toast Content */
.cm-toast-content {
  display: flex;
  align-items: flex-start;
  padding: 14px 16px;
  gap: 12px;
  position: relative;
}

/* Toast Icon */
.cm-toast-icon {
  font-size: 20px;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Toast Message */
.cm-toast-message {
  flex: 1;
  color: #f3f4f6;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  padding-top: 2px;
}

.cm-toast-message strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  color: #fff;
}

.cm-toast-details {
  font-size: 13px;
  opacity: 0.9;
  display: block;
  margin-top: 4px;
}

/* Close Button */
.cm-toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  line-height: 1;
}

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

.cm-toast-close:active {
  transform: scale(0.9);
}

/* Toast Types with colored left border and icon */
.cm-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: currentColor;
}

/* Success Toast */
.cm-toast-success {
  border-left: 4px solid #10b981;
}

.cm-toast-success::before {
  background: #10b981;
}

.cm-toast-success .cm-toast-icon {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 50%;
}

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

.cm-toast-error::before {
  background: #ef4444;
}

.cm-toast-error .cm-toast-icon {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border-radius: 50%;
}

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

.cm-toast-warning::before {
  background: #f59e0b;
}

.cm-toast-warning .cm-toast-icon {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border-radius: 50%;
}

/* Info Toast */
.cm-toast-info {
  border-left: 4px solid #3b82f6;
}

.cm-toast-info::before {
  background: #3b82f6;
}

.cm-toast-info .cm-toast-icon {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 50%;
}

/* Detailed Toast */
.cm-toast-detailed .cm-toast-content {
  padding: 16px;
}

.cm-toast-detailed .cm-toast-message {
  font-size: 14px;
}

/* Progress Toast */
.cm-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.cm-toast-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
  transition: width 0.3s ease;
  width: 0;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

/* Mobile Responsive */
@media (max-width: 480px) {
  #cm-toast-container {
    left: 10px;
    right: 10px;
    top: 10px;
  }

  .cm-toast {
    min-width: auto;
    max-width: 100%;
    width: 100%;
  }

  @keyframes cm-toast-slide-in {
    from {
      transform: translateY(-100px);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  @keyframes cm-toast-slide-out {
    to {
      transform: translateY(-100px);
      opacity: 0;
    }
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .cm-toast {
    animation: cm-toast-fade-in 0.2s ease;
  }

  @keyframes cm-toast-fade-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  .cm-toast-dismissing {
    animation: cm-toast-fade-out 0.2s ease forwards;
  }

  @keyframes cm-toast-fade-out {
    to {
      opacity: 0;
    }
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .cm-toast {
    border: 2px solid #fff;
  }

  .cm-toast-close {
    border: 1px solid rgba(255, 255, 255, 0.5);
  }
}

/* Light Mode Support */
@media (prefers-color-scheme: light) {
  .cm-toast {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    box-shadow:
      0 10px 15px -3px rgba(0, 0, 0, 0.1),
      0 4px 6px -2px rgba(0, 0, 0, 0.05),
      0 0 0 1px rgba(0, 0, 0, 0.05);
  }

  .cm-toast-message {
    color: #1f2937;
  }

  .cm-toast-message strong {
    color: #111827;
  }

  .cm-toast-close {
    color: rgba(0, 0, 0, 0.4);
  }

  .cm-toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.7);
  }

  .cm-toast-progress {
    background: rgba(0, 0, 0, 0.1);
  }
}

/* Stack toasts with proper spacing */
#cm-toast-container .cm-toast:not(:last-child) {
  margin-bottom: 0;
}

/* Ensure toasts don't interfere with Console Maven widgets */
@media (min-width: 1024px) {
  #cm-toast-container {
    max-width: 440px;
  }
}

/* Animation for toast appearance from top (alternative) */
.cm-toast-from-top {
  animation: cm-toast-drop-in 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes cm-toast-drop-in {
  from {
    transform: translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}