/**
 * Toast Notification Styles for ArcX Marketplace
 * Responsive, accessible, and professional design
 */

/* Toast Container */
.toast-container {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}

/* Desktop: Top-right corner */
@media (min-width: 768px) {
  .toast-container {
    top: 24px;
    right: 24px;
  }
}

/* Mobile: Bottom-center */
@media (max-width: 767px) {
  .toast-container {
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 100%;
  }
}

/* Toast Base */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
  pointer-events: auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: white;
  min-width: 300px;
  max-width: 100%;
  position: relative;
  overflow: hidden;
}

/* Toast Types */
.toast-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-left: 4px solid #047857;
}

.toast-error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-left: 4px solid #b91c1c;
}

.toast-info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-left: 4px solid #1d4ed8;
}

.toast-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-left: 4px solid #b45309;
}

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

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

/* Toast Message */
.toast-message {
  flex: 1;
  word-break: break-word;
  padding-top: 2px;
}

/* Close Button */
.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s;
  opacity: 0.8;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.2);
  opacity: 1;
}

.toast-close:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* Toast Animations */
@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-slide-in-mobile {
  from {
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes toast-slide-out-mobile {
  from {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
  to {
    transform: translateX(-50%) translateY(100%);
    opacity: 0;
  }
}

/* Desktop animations */
@media (min-width: 768px) {
  .toast-enter {
    animation: toast-slide-in 0.3s ease-out;
  }

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

  .toast-exit {
    animation: toast-slide-out 0.3s ease-in;
  }
}

/* Mobile animations */
@media (max-width: 767px) {
  .toast-enter {
    animation: toast-slide-in-mobile 0.3s ease-out;
  }

  .toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }

  .toast-exit {
    animation: toast-slide-out-mobile 0.3s ease-in;
  }
}

/* Button Loading Spinner */
.button-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Progress Indicator */
.progress-indicator {
  width: 100%;
  padding: 16px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.progress-current {
  font-weight: 600;
  color: #1f2937;
  font-size: 14px;
}

.progress-step-name {
  font-size: 13px;
  color: #6b7280;
}

.progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 4px;
  transition: width 0.3s ease-out;
}

.progress-percentage {
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
}

/* Mobile Responsive Adjustments */
@media (max-width: 767px) {
  .toast {
    min-width: unset;
    width: 100%;
    font-size: 13px;
    padding: 14px;
  }

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

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

  .progress-indicator {
    padding: 12px;
  }

  .progress-current {
    font-size: 13px;
  }

  .progress-step-name {
    font-size: 12px;
  }
}

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

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .toast-enter,
  .toast-exit,
  .button-spinner {
    animation: none;
  }

  .toast-show {
    opacity: 1;
  }

  .progress-fill {
    transition: none;
  }
}

/* Focus Visible Support */
.toast-close:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}

/* Print Styles (hide toasts when printing) */
@media print {
  .toast-container {
    display: none;
  }
}

/* Enhanced Error Toast with Actions */
.toast-with-action {
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  align-items: stretch;
}

.toast-with-action .toast-icon {
  position: absolute;
  top: 18px;
  left: 16px;
}

.toast-with-action .toast-close {
  position: absolute;
  top: 14px;
  right: 14px;
}

.toast-with-action .toast-content {
  margin-left: 36px;
  margin-right: 24px;
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  color: white;
}

.toast-message {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.4;
}

.toast-help {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 6px;
  font-style: italic;
}

.toast-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  margin-left: 36px;
}

.toast-retry-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.toast-retry-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

.toast-retry-btn:active {
  transform: translateY(0);
}

.toast-retry-btn:focus {
  outline: 2px solid white;
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .toast-with-action {
    padding: 14px;
  }

  .toast-with-action .toast-content {
    margin-left: 32px;
    margin-right: 20px;
  }

  .toast-title {
    font-size: 14px;
  }

  .toast-message {
    font-size: 13px;
  }

  .toast-help {
    font-size: 12px;
  }

  .toast-actions {
    margin-left: 32px;
    margin-top: 10px;
  }

  .toast-retry-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}
