/* Advoke CV — Toast Notification Component */

.toast-host {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 380px;
  width: calc(100vw - var(--space-4) * 2);
  pointer-events: none;
}

@media (min-width: 640px) {
  .toast-host {
    bottom: var(--space-6);
    right: var(--space-6);
    width: auto;
    max-width: 400px;
  }
}

.toast-host--top {
  top: calc(var(--header-height) + var(--space-3));
  bottom: auto;
}

.toast-host--left {
  left: var(--space-4);
  right: auto;
}

.toast-host--left-all {
  left: var(--space-4);
  right: var(--space-4);
  margin-inline: auto;
  max-width: 400px;
}

.toast-host--center {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background-color: var(--ink-900);
  color: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  animation: toast-in var(--duration-base) var(--ease-spring) both;
  min-height: 48px;
}

.toast.is-closing {
  animation: toast-out var(--duration-fast) var(--ease-in) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
}

.toast__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 1px;
}

.toast__icon svg {
  width: 100%;
  height: 100%;
}

.toast__content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.toast__title {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1.4;
  color: var(--white);
  margin: 0;
}

.toast__message {
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--ink-200);
  margin: 0;
}

.toast__message a {
  color: var(--yellow-300);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.toast__message a:hover {
  color: var(--yellow-200);
}

.toast__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.toast__action {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  min-height: 28px;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--yellow-300);
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-colors);
}

.toast__action:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--yellow-200);
}

.toast__action:focus-visible {
  outline: 2px solid var(--yellow-300);
  outline-offset: 2px;
}

.toast__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  color: var(--ink-200);
  background-color: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition-colors);
  margin: -2px -4px -2px 0;
}

.toast__close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.toast__close:focus-visible {
  outline: 2px solid var(--yellow-300);
  outline-offset: 2px;
}

.toast__close svg {
  width: 14px;
  height: 14px;
}

.toast__progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  background-color: rgba(255, 255, 255, 0.3);
  animation: toast-progress linear both;
  transform-origin: left center;
}

@keyframes toast-progress {
  from { width: 100%; }
  to   { width: 0%; }
}

.toast--success {
  background-color: #14532D;
}

.toast--success .toast__icon {
  color: #4ADE80;
}

.toast--error {
  background-color: #7F1D1D;
}

.toast--error .toast__icon {
  color: #FCA5A5;
}

.toast--warning {
  background-color: #78350F;
}

.toast--warning .toast__icon {
  color: #FCD34D;
}

.toast--info {
  background-color: #0C4A6E;
}

.toast--info .toast__icon {
  color: #7DD3FC;
}

.toast--accent {
  background-color: var(--color-accent);
  color: var(--color-accent-text);
}

.toast--accent .toast__title {
  color: var(--color-accent-text);
}

.toast--accent .toast__message {
  color: var(--color-text);
  opacity: 0.85;
}

.toast--accent .toast__icon {
  color: var(--color-accent-text);
}

.toast--light {
  background-color: var(--white);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.toast--light .toast__title {
  color: var(--color-text);
}

.toast--light .toast__message {
  color: var(--color-text-secondary);
}

.toast--light .toast__close {
  color: var(--color-text-muted);
}

.toast--light .toast__close:hover {
  background-color: var(--ink-100);
  color: var(--color-text);
}

.toast--light .toast__progress {
  background-color: var(--color-border);
}

.toast--light .toast__action {
  color: var(--color-accent-active);
  border-color: var(--color-accent);
}

.toast--light .toast__action:hover {
  background-color: var(--color-accent-tint);
}

.toast--compact {
  padding: var(--space-2) var(--space-3);
  min-height: 40px;
}

.toast--compact .toast__title {
  font-size: var(--text-xs);
}

.toast--compact .toast__message {
  font-size: var(--text-xs);
}

.toast__icon--spin svg {
  animation: spin 800ms linear infinite;
}

@media (max-width: 639px) {
  .toast-host {
    left: var(--space-3);
    right: var(--space-3);
    bottom: max(var(--space-3), env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
  }
  .toast {
    padding: var(--space-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.is-closing {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .toast__progress {
    animation: none;
    display: none;
  }
}