@use '../../themes/index' as *;
@use '../../abstracts/index' as *;

/* 
  Toast notification styles
*/

// Toast container positioning
.toast-container {
  position: fixed;
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  max-width: 400px;

  // Position variations
  &.top-right {
    top: 1rem;
    right: 1rem;
    align-items: flex-end;
  }

  &.top-left {
    top: 1rem;
    left: 1rem;
    align-items: flex-start;
  }

  &.bottom-right {
    bottom: 1rem;
    right: 1rem;
    align-items: flex-end;
  }

  &.bottom-left {
    bottom: 1rem;
    left: 1rem;
    align-items: flex-start;
  }

  &.top-center {
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
  }

  &.bottom-center {
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    align-items: center;
  }
}

// Individual toast styling
.toast {
  display: flex;
  align-items: flex-start;
  background-color: var(--elevated-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.25rem;
  max-width: 100%;
  min-width: 320px;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s var(--easing-bounce);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  cursor: default;

  &.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  &.closing {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }

  // Type-specific styling
  &.toast-success {
    border-left: 4px solid var(--success);

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

  &.toast-error {
    border-left: 4px solid var(--danger);

    .toast-icon {
      .toast-error-icon {
        color: var(--danger);
      }
    }
  }

  &.toast-warning {
    border-left: 4px solid var(--warning);

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

  &.toast-info {
    border-left: 4px solid var(--info);

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

  // Toast elements
  .toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: var(--tertiary-bg);
    border-radius: var(--radius-sm);
    padding: 0.35rem;
    margin-right: 0.75rem;
    margin-top: 0;

    .toast-type-icon {
      color: inherit;
    }
  }

  .toast-content {
    flex: 1;
    min-width: 0; // Required for proper overflow handling
    padding-top: 0.1rem;
  }

  .toast-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
    line-height: 1.3;
  }

  .toast-message {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    word-break: break-word;
    line-height: 1.4;
  }

  .toast-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-muted);
    padding: 0.4rem;
    cursor: pointer;
    margin-left: 0.75rem;
    border-radius: 50%;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;

    .toast-close-icon {
      color: var(--text-muted);
    }

    &:hover {
      background: rgba(255, 255, 255, 0.2);
      transform: scale(1.1);

      .toast-close-icon {
        color: var(--text-primary);
      }
    }

    &:active {
      transform: scale(0.95);
    }
  }
}
