/* ================= Toast Notification Styles ================= */
/* Modern toast notifications to replace alert() calls */

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 11000;
  /* Higher than subscription modal (10000) and cancel confirmation modal (10001) */
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 400px;
}

.toast {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: var(--shadow-2);
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toast-slide-in 0.3s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.hiding {
  opacity: 0;
  transform: translateX(100%);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-content {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 0.2s, color 0.2s;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}

.toast-close:hover {
  opacity: 1;
  color: var(--text);
  background: var(--surface);
}

.toast-success {
  border-left: 3px solid var(--dx-emerald);
}

.toast-success .toast-icon {
  color: var(--dx-emerald);
}

.toast-error {
  border-left: 3px solid #ef4444;
}

.toast-error .toast-icon {
  color: #ef4444;
}

.toast-warning {
  border-left: 3px solid var(--dx-gold);
}

.toast-warning .toast-icon {
  color: var(--dx-gold);
}

.toast-info {
  border-left: 3px solid var(--dx-cyan);
}

.toast-info .toast-icon {
  color: var(--dx-cyan);
}

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

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Light mode adjustments */
html.light .toast {
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

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

  .toast {
    min-width: auto;
    max-width: 100%;
    padding: 14px 16px;
    font-size: 14px;
  }

  .toast-content {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .toast-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  /* Ensure toasts don't overlap with mobile UI elements */
  .toast-container {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
  .toast {
    padding: 12px 14px;
    font-size: 13px;
  }

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

  .toast-container {
    right: 12px;
    left: 12px;
    top: 12px;
  }
}
