.hds-toast-container {
  position: fixed;
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
  pointer-events: none;
}

.hds-toast-container.hds-toast-pos--top-right {
  right: 20px;
  top: 20px;
}

.hds-toast-container.hds-toast-pos--top-left {
  left: 20px;
  top: 20px;
}

.hds-toast-container.hds-toast-pos--top-center {
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  align-items: center;
}

.hds-toast-container.hds-toast-pos--bottom-right {
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  flex-direction: column-reverse;
}

.hds-toast-container.hds-toast-pos--bottom-left {
  left: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  flex-direction: column-reverse;
}

.hds-toast-container.hds-toast-pos--bottom-center {
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  align-items: center;
  flex-direction: column-reverse;
}

.hds-toast-container.hds-toast-pos--center {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  align-items: center;
}

@media (max-width: 768px) {
  .hds-toast-container {
    right: 10px;
    left: 10px;
    max-width: none;
    width: auto;
    transform: none;
    align-items: stretch;
  }

  .hds-toast-container.hds-toast-pos--top-left,
  .hds-toast-container.hds-toast-pos--top-right,
  .hds-toast-container.hds-toast-pos--top-center {
    top: 10px;
    flex-direction: column;
  }

  .hds-toast-container.hds-toast-pos--bottom-left,
  .hds-toast-container.hds-toast-pos--bottom-right,
  .hds-toast-container.hds-toast-pos--bottom-center,
  .hds-toast-container.hds-toast-pos--center {
    bottom: calc(10px + env(safe-area-inset-bottom));
    flex-direction: column-reverse;
    top: auto;
    transform: none;
  }
}

.hds-toast {
  background: var(--hds-color-surface);
  border: 1px solid var(--hds-color-border);
  border-radius: var(--hds-radius-md);
  box-shadow: var(--hds-shadow-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
}

.hds-toast--visible {
  animation-duration: 0.25s;
  animation-timing-function: ease-out;
  animation-fill-mode: both;
}

.hds-toast.hds-toast-anim--slide-in {
  animation-name: hds-toast-in;
}

.hds-toast.hds-toast-anim--fade-in {
  animation-name: hds-toast-fade-in;
}

.hds-toast.hds-toast-anim--pop-in {
  animation-name: hds-toast-pop-in;
}

@media (max-width: 768px) {
  .hds-toast.hds-toast-anim--slide-in {
    animation-name: hds-toast-in-mobile;
  }

  .hds-toast.hds-toast-anim--fade-in {
    animation-name: hds-toast-fade-in;
  }

  .hds-toast.hds-toast-anim--pop-in {
    animation-name: hds-toast-pop-in;
  }
}

.hds-toast-exit {
  animation: hds-toast-out 0.2s ease-out forwards;
}

@media (max-width: 768px) {
  .hds-toast-exit {
    animation: hds-toast-out-mobile 0.2s ease-out forwards;
  }
}

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

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

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

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

@keyframes hds-toast-fade-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hds-toast-pop-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.hds-toast--success .hds-toast__icon {
  color: var(--hds-color-success);
}

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

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

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

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

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

.hds-toast--error .hds-toast__icon {
  color: var(--hds-color-primary);
}

.hds-toast__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hds-toast__icon .fas {
  font-size: 18px;
}

.hds-toast__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.hds-toast__message {
  font-size: 14px;
  line-height: 1.4;
  color: var(--hds-color-text);
  word-wrap: break-word;
}

.hds-toast__cta {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  background: var(--hds-color-primary);
  color: var(--hds-color-frame-contrast);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  border-radius: var(--hds-radius-md);
  cursor: pointer;
  transition: background var(--hds-transition), transform var(--hds-transition);
}

.hds-toast__cta:hover {
  background: var(--hds-color-primary-alt);
}

.hds-toast__cta:active {
  transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  .hds-toast,
  .hds-toast--visible,
  .hds-toast-exit {
    animation: none !important;
  }

  .hds-toast__cta {
    transition: none;
  }
}
