.toast {
  align-items: center;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  font-size: 1rem;
  gap: 12px;
  line-height: 1.5;
  margin: 8px;
  max-width: 400px;
  min-width: 280px;
  min-height: 20px;
  opacity: 0;
  padding: 16px;
  position: fixed;
  overflow: visible; // Changed from hidden to visible
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 10000;

  &:focus {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
  }

  &-show {
    opacity: 1;
    transform: translateY(0);
  }

  &-content {
    flex: 1;
    gap: 12px;

    &,
    &-icon {
      align-items: center;
      display: flex;
    }
  }

  &-icon {
    flex-shrink: 0;
	line-height: 10px;
    svg {
      height: 24px;
      width: 24px;
    }
  }

  &-close {
    align-items: center;
    background: none;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    margin: -4px;
    opacity: 0.8;
    padding: 4px;
    transition: all 0.2s;

    svg {
      fill: currentColor;
      height: 20px;
      width: 20px;
    }

    &:hover {
      background: rgba(0, 0, 0, 0.1);
      opacity: 1;
    }

    &:focus {
      border-color: currentColor;
      opacity: 1;
      outline: none;
    }
  }

  &-progress {
    background: var(--progress-background, hsla(0, 0%, 100%, 0.2));
	position: absolute;
	bottom: 0;
	left: 0;
	height: var(--progress-height, 4px);
	width: 100%;
	z-index: 1;
	/* Match the toast's border-radius on the bottom corners only */
	border-bottom-left-radius: 8px;
	border-bottom-right-radius: 8px;

    &-bar {
     	background: var(--progress-color, hsla(0, 0%, 100%, 0.7));
		height: 100%;
		width: 100%;
		transform: scaleX(0);
		transform-origin: left;
		transition: transform 0.3s linear;
    }
  }

  &-anchored {
    margin: 0;
    position: absolute;
    overflow: visible; // Changed from auto to visible
  }

  &-droplet {
    position: absolute;
    width: 12px;
    height: 12px;
    background: inherit;
    transform: rotate(45deg);
    // Remove negative z-index
    z-index: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); // Add shadow to match toast

    &:after {
      content: '';
      position: absolute;
      background-color: inherit;
      width: 2px;
      opacity: 0.5;
      transition: height 0.2s ease;
      // height: var(--connector-height, 0); // Use connector height directly
    }

    // Improve positioning for each direction
    &[data-point="top"] {
      top: -6px;
      left: var(--droplet-left, 50%);
      transform: translateX(-50%) rotate(45deg);
      box-shadow: -3px -3px 5px rgba(0, 0, 0, 0.05);
      
      &:after {
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
      }
    }

    &[data-point="bottom"] {
      bottom: -6px;
      left: var(--droplet-left, 50%);
      transform: translateX(-50%) rotate(45deg);
      box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.05);
      
      &:after {
        bottom: 100%;
        left: 50%;
        transform: translateX(-50%);
      }
    }

    &[data-point="left"] {
      left: -6px;
      top: 50%;
      transform: translateY(-50%) rotate(45deg);
      box-shadow: -3px 0 5px rgba(0, 0, 0, 0.05);
    }

    &[data-point="right"] {
      right: -6px;
      top: 50%;
      transform: translateY(-50%) rotate(45deg);
      box-shadow: 3px 0 5px rgba(0, 0, 0, 0.05);
    }
  }
}

.droplet-toast-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  left: 0;
  pointer-events: none;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;

  .toast {
    pointer-events: auto;
    position: relative;
  }

  &[data-position^="top"] {
    align-items: flex-start;
  }

  &[data-position^="top-center"] {
    align-items: center;
  }

  &[data-position^="bottom"] {
    align-items: center;
    flex-direction: column-reverse;
  }

  &[data-position$="right"] {
    align-items: flex-end;
  }

  &[data-position$="left"] {
    align-items: flex-start;
  }

  &[data-position="center"] {
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast-droplet,
  .toast-progress-bar {
    transition: none;
  }
}

.toast--dark {
  background: #1f2937;
  color: #fff;
}

@media (max-width: 480px) {
  .toast {
    min-width: auto;
    width: calc(100vw - 40px);

    &--full-width {
      border-radius: 0;
      margin: 0;
      width: 100vw;
    }
  }
}
